Skip to content

Phase C.1: v2.lens.determinism — grounded map_keys root, emergent boundary-relative determinism lens + live contract - #6570

Merged
briansrls merged 11 commits into
mainfrom
session/deep-koi-605
Jul 14, 2026
Merged

briansrls merged 11 commits into
mainfrom
session/deep-koi-605

Conversation

@briansrls

@briansrls briansrls commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Phase C.1 — v2.lens.determinism: the determinism authority's first live consumer

Phase A (#6551) landed the grounded DeterminismAxis authority but left it inert (self-test only). This PR gives it a live consumer: a lens that derives a node's determinism by folding its structure to grounded nondeterministic roots.

What it does

  • Grounds ^map_keys as the single nondeterministic root (DeterminismRoot registry, mirroring cardinality.dag's measure_descent_fact_registry); its sibling sorted_map_keys canonicalizes the order.
  • Emergent, not labeled: determinism_axis_for_node is a fold_node catamorphism whose fold body is std.determinism.determinism_compose — a node is NonDeterministic { source } iff its structural closure reaches a registered root; the leak carries a DeclarationRef to the reached root, not a coined tag.
  • Boundary-relative (per the operator model): the verdict is over the within-function structural closure. An unregistered callee contributes Deterministic at that boundary — sound, because map_keys is always a readable atom and never missed. This is not the agent-proposed fail-closed-to-NonDeterministic default, which would red every function that calls any unregistered builtin.
  • determinism_contract_witness is the fail-closed contract surface: Violates (located at the offending node) on a reach, Holds otherwise.
  • Enrolled in the lens registry (LensIdV0 Determinism arm + bound row).

Scope is explicit, not silently narrowed

src/v2 has zero map_keys — so this is the mechanism plus a forward-looking contract over the clean v2 emit layer (reds the instant a bare map_keys enters). Deliberately deferred:

  • C.2 — binding-aware dataflow to be precise over v1 05_emit_rust.dag (where map_keys also appears order-safe: |> count, |> sort_by, let-bound). Required before the x2 gate can be deleted (Phase D / O1(b)); until then v1 emit stays under the x2 gate.
  • Phase B — clock/entropy roots (needs kind: Observation seed work).
  • Phase F — cross-function reach (needs resolved call edges / SymbolIndex).

Green-by-execution

  • 5 witness claims PASS: map_keys + nested-in-subtree → Violates; sorted_map_keys sibling + clean call → Holds; axis → NonDeterministic.
  • Registry coverage: 2 PASS (Determinism resolves to exactly one bound row).
  • Discriminating RED confirmed: disable the map_keys root → determinism_flags_map_keys_reach FAILs; revert → PASS.
  • Hygiene floors green: non_fold_residue, inert_carrier, wiring_liveness, and 10 enforcement gate_test consumers of LensIdV0.
  • Whole-corpus gunbc compile --target dag: 0 diagnostics.

🤖 Generated with Claude Code

Brian Searls and others added 11 commits July 14, 2026 00:30
…e authority

Replace the forked, inert determinism model with one grounded authority.

- dag/std/determinism.dag: Determinism = Deterministic | NonDeterministic{source: DeclarationRef},
  built on std.perturbation (determinism_from_perturbation bridges ResponseConsistent/Violation) +
  determinism_compose. The leak source is a reference to the reached root (emergent), not a
  NonDetSource label enum. Deletes the orphaned DeterminismAxis.
- src/v2/std/determinism.dag: imports the authority; keeps only the signature binding
  (DeterminismFact) and the Bool projection (v2 side of the Bool fork). Deletes NonDetSource,
  the forked DeterminismClass, and the phantom-symbol roster.
- determinism_contract_test.dag: rewritten to the grounded shape. 6 claims green by execution;
  discriminating RED verified (break compose -> propagation claims FAIL, revert -> PASS).

Also fixes the CI red at bfd97ca, where a mid-edit snapshot paired the new v2 module with the
stale test still importing the deleted symbols.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…minism §3 collision), dissolve determinism_is_deterministic Bool projection into a test-local helper, reconcile signed design doc with the emergent/perturbation pivot

Two REQUEST_CHANGES reviews on #6551:
- claude-opus-4-7: stale NON_FOLD_RESIDUE_ROSTER entries (fixed in 96cc568).
- cursor/composer-2.5: (1) type Determinism collided with std.behavioral.Determinism
  -> renamed back to DeterminismAxis (the signed-doc core name); the single-Determinism
  rename + behavioral dissolution stays in Phase E where EventuallyConsistent is handled.
  (2) determinism_is_deterministic was a v2.std coproduct->Bool predicate dissolution
  -> dissolved out of substrate; the contract test asserts via a test-local helper,
  mirroring the descent_evidence_lattice precedent. (3) signed design doc unreconciled
  -> supersession note records the operator's 2026-07-13 emergent/perturbation direction
  (no forged re-sign; new shape's details remain open to operator shape-review).

Green-by-execution: 6 contract claims PASS, non_fold_residue_clean_holds PASS
(unrostered+stale=0), discriminating RED confirmed (break compose left-propagation -> FAIL).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ndary-relative fold, live contract + discriminating witness

The determinism authority (Phase A, #6551) gains its first live consumer. A new lens
v2.lens.determinism grounds ^map_keys as the single nondeterministic root (its sibling
sorted_map_keys canonicalizes it) and DERIVES a node's determinism by folding its
structural closure to that root via std.determinism.determinism_compose — emergent, not
labeled; boundary-relative (within-function structural closure). Unregistered callees
contribute Deterministic at that boundary (map_keys is always a readable atom, never
missed); cross-function reach is Phase F (resolved call edges), other roots (clock/entropy)
Phase B (kind:Observation seed work).

Mirrors cardinality.dag exactly: grounded List<DeterminismRoot> registry + first-match fold
lookup + fold_node catamorphism (determinism_axis_for_node) + Witness<DeterminismFact>
contract (determinism_contract_witness) that Violates (located) on a nondeterministic reach.
Enrolled in the lens registry (LensIdV0 Determinism arm + bound row).

Scope is explicit, NOT silently narrowed: this is the mechanism + the contract over the
clean v2 emit layer (src/v2 has zero map_keys — a forward-looking wall that reds the instant
one enters). v1 05_emit_rust.dag stays under the x2 gate: its map_keys sites are order-safe
(|>count, |>sort_by, let-bound) and need binding-aware dataflow (Phase C.2) before the gate
can be deleted (Phase D / O1(b)).

Green-by-execution: 5 witness claims PASS (map_keys+nested->Violates, sorted_map_keys+clean
->Holds, axis->NonDeterministic); registry coverage 2 PASS; discriminating RED confirmed
(disable the map_keys root -> determinism_flags_map_keys_reach FAIL). Hygiene floors green:
non_fold_residue, inert_carrier, wiring_liveness, and 10 enforcement gate_test consumers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gunbai-bot gunbai-bot Bot changed the title emit determinism Phase C.1: v2.lens.determinism — grounded map_keys root, emergent boundary-relative determinism lens + live contract Jul 14, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 14, 2026 03:18
@briansrls
briansrls merged commit 7297c84 into main Jul 14, 2026
4 of 6 checks passed
@briansrls
briansrls deleted the session/deep-koi-605 branch July 14, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant