arborist/tests/test_world_namespace.py
russell@unturf.com ee22a83a0a
#000013 closed: v7-W spatial-temporal substrate paper + namespace
Three artifacts landing per ticket §4.1 closure criterion:

1. docs/_source/merkle-agi-v7w-spatial-temporal.rst (658 lines)
============================================================

Substrate paper for the third commitment substrate — sister to v7
(logic / math) and arborist v9.8 (language / claim-lattice). v7-W
commits derived spatial-temporal world-state: objects, relations,
events, places, agent traces, observations. Six parts + appendix:

  Part 1 — Introduction & motivation. The third-substrate gap;
           why v7 § 11 multimodal composition isn't enough.
  Part 2 — Substrate definition. Hierarchical-grid spatial
           discretization (S2 / H3 / octree); frame as committed
           object with explicit transforms; substrate-declared
           clock (single-agent) + Lamport (multi-agent);
           quantized centi-confidence (range opt-in); five
           canonical tuple-classes (object / relation / event /
           place / agent_trace) each with its own π*_w.
  Part 3 — Theorems. T1-W (state binding), T2-W (causal
           completeness), T3-W (frame-transform soundness),
           T4-W (ε at affine frontiers).
  Part 4 — Verifier kernels. Pose integration, observation
           update (Kalman), object logits, relation logits.
           Each affine after canonical projection.
  Part 5 — Multimodal composition with v7. Where v7 ends, v7-W
           begins; cumulative ε across substrates; frame-
           transform anchoring.
  Part 6 — Adversarial corners. Frame spoofing, time skew,
           observation injection, privacy.
  Appendix — Worked SLAM example with full ε budget.

Hard constraints honored: stays inside SQD A1-A3 (canonical
encoding, public quantization, collision-resistant hash); no new
axiom; every π*_w defined on quantized integer state, never on
continuous tensors.

2. docs/v7w-frontier-catalog.md (262 lines)
============================================

Operator-facing quick reference for the four ε-frontiers from
substrate-paper Part 4. Each entry:

  - canonical input / output bytes
  - operator (linear / bilinear / Kalman / SE(3))
  - ε bound expression
  - "affine after canonical projection" justification
  - when to use

Reference table + cumulative-ε section so operators sizing
deployment grid choices can read off their ε_total under typical
agent-trace + scene-graph workloads.

3. arborist/world/__init__.py — namespace reservation
======================================================

Reserved ``arborist.world`` package. No kernels yet. Module
exports V7W_VERSION ('v0-draft') + STATUS ('namespace_reserved')
metadata. Package docstring lays out the future shape per
substrate-paper Part 4:

  arborist/world/
  ├── pi_star/        — π*_w canonical projections (5 tuple classes)
  ├── frontier/       — ε-frontier kernels (4 frontiers)
  ├── frame.py        — frame definitions + transforms
  ├── clock.py        — wall-clock + Lamport
  ├── manifest.py     — substrate manifest schema
  └── adapters/       — sensor adapters land here, separate tickets

Implementation tickets cite the substrate paper and land kernels
one at a time; the stub exists so cross-referencing imports (mesh
peers, sibling repos) can pin the namespace before anything
implements it.

5 tests pin the reservation contract (test_world_namespace.py):
import succeeds, V7W_VERSION reports v0-draft, STATUS reads
namespace_reserved, __all__ exposes only metadata, substrate
paper + frontier catalog files exist alongside the namespace.

Closure criterion (#000013 §7): substrate paper lands and is
ready for review. Done. Status flipped to closed in the ticket
file + TICKETS.md index entry.

Test suite: 1641 passed, 37 skipped (was 1636; +5).
2026-05-09 15:00:05 -04:00

55 lines
2.1 KiB
Python

"""Smoke tests for ``arborist.world`` — v7-W namespace reservation
(#000013).
This package is a namespace-only stub today (substrate paper at
``docs/_source/merkle-agi-v7w-spatial-temporal.rst``; no kernels
yet). These tests pin the reservation contract so downstream
consumers can rely on the import path being stable.
"""
from __future__ import annotations
import importlib
def test_world_namespace_imports():
"""Reservation: arborist.world loads without error."""
mod = importlib.import_module("arborist.world")
assert mod is not None
def test_world_namespace_reports_draft_version():
"""V7W_VERSION is the draft-version pin. Downstream consumers
can read this to detect spec drift before a kernel ships."""
from arborist.world import V7W_VERSION
assert isinstance(V7W_VERSION, str)
assert V7W_VERSION.startswith("v")
def test_world_namespace_status_is_reserved():
"""STATUS pins the namespace's lifecycle stage. Today: just
reserved (no kernels). Becomes 'kernel_in_progress' once the
first verifier kernel lands; 'v1' once all four ε-frontiers
+ their kernels ship."""
from arborist.world import STATUS
assert STATUS == "namespace_reserved"
def test_world_namespace_exports_only_metadata():
"""Stub contract: nothing but metadata. No kernels, no sources,
no public-API surface yet. __all__ pins this."""
import arborist.world as world
assert set(world.__all__) == {"V7W_VERSION", "STATUS"}
def test_substrate_paper_lands_alongside_namespace():
"""Closure-criterion guard for #000013: the substrate paper
must exist alongside the namespace stub. Future maintainers
that delete one without the other break the ticket's closure
contract."""
from pathlib import Path
repo_root = Path(__file__).resolve().parent.parent
paper = repo_root / "docs" / "_source" / "merkle-agi-v7w-spatial-temporal.rst"
catalog = repo_root / "docs" / "v7w-frontier-catalog.md"
assert paper.is_file(), f"missing substrate paper at {paper}"
assert catalog.is_file(), f"missing frontier catalog at {catalog}"