Skip to content

Namespace flip Dispatch 1 — turn on namespace-only resolution (global flip) + inline-qualify the import-dependent references. Residue=0 banked on main by #7165. Plan: docs/plans/namespace-flip-last-28-root-a-two-std-defork.md - #7178

Merged
briansrls merged 14 commits into
mainfrom
test-flip-verify
Jul 25, 2026

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

What: Dispatch 1 — flip NAME_RESOLUTION_POLICY_NAMESPACE_ONLY default false → true (global NamespaceOnlyY; runtime_rust.dag + regen pair v1_rt.rs / v1_compiler_runtime_rust.rs) and inline-qualify bare references the witness corpus exposes as ambiguous under the flip (v2.std.nat.*, v2.std.cardinality.*). Net diff: 92 files, no dag/std/* edits — pure qualify pass.

Why: Residue=0 on the compile-clean histogram (#7165) does not cover witness-scope closures (whole_tree_strict_resolve_exclusion_substrings skips /test/ and several lens/*). The floor / CI witness corpus under the flipped default is the completeness oracle. Operator direction (2026-07-24): (A) inline-qualify — do not consolidate forks in this PR.

Declared scaffold (section 5 — de-fork deferred)

Two genuine section-3 forks; inline qualification unblocks the flip; consolidation is a separate lane (operator: re-ground these concepts on cited extdeps foundations, not std-to-std fold):

  1. Numeric-tower fork — Nat / Zero / Succ: dag/std/nat vs src/v2/std/nat.
  2. Cardinality fork — TerminationProof / RankingDimension: dag/std/termination vs src/v2/std/cardinality.

Mechanism extras (not qualify churn)

  • namespace_unique_on_chain_policy_test.rs: ResolutionPolicyGuard save/restore; ImportScoped cases bracket set(false) explicitly.
  • Carrier notes in 04_env.dag / 04_sigs.dag (+ seed strings): default ON = NamespaceOnlyY.

Discovery oracle

gh run view 30122932237 --repo gunb-ai/gunbc --log-failed

First AmbiguousReference rows surfaced via CI floor batch 3 (discovery-corpus resolve), not histogram or quick-bee census.

Test plan

  • cargo run -p v1-compiler --bin regen_stage0 --release -- --verify → regen_divergence_count=0
  • cargo run -p v1-compiler --bin compile_clean_diagnostic_histogram --release → HISTOGRAM_TOTAL_HARD 0 (partial oracle)
  • cargo test -p v1-compiler-tests namespace_unique_on_chain --release → policy discriminating witness green
  • CI floor green under flipped default (completeness gate — in flight)

briansrls and others added 7 commits July 24, 2026 18:54
…ault ON.

The prior commit updated the embedded concat in v1_compiler_runtime_rust.rs
but regen left v1_rt.rs at false, failing the regen_verify gate. Regen now
matches: NAME_RESOLUTION_POLICY_NAMESPACE_ONLY defaults to true (§8 step 4).

Co-authored-by: Cursor <cursoragent@cursor.com>
fact_density.dag: Nat/Zero/Succ → v2.std.nat.* (std.nat homonym).
infer_fixture.dag: TerminationProof/RankingDimension → v2.std.cardinality.*
(std.termination homonyms). Fixes CI discovery-corpus AmbiguousReference
refusals under the global NamespaceOnlyY default.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 24, 2026 21:05
@gunbai-bot

gunbai-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

Addressed review 42283 (REQUEST_CHANGES):

  1. namespace_unique_on_chain_policy_test.rs — ResolutionPolicyGuard now save/restores the thread-local gate; ImportScoped cases bracket set(false) explicitly; NamespaceOnlyY cases bracket set(true). cargo test -p v1-compiler-tests namespace_unique_on_chain --release green locally.

  2. Carrier notes — updated 04_env.dag, 04_sigs.dag, and matching seed strings in v1_compiler_infer_env.rs / v1_compiler_infer_sigs.rs: default ON = NamespaceOnlyY (step 4); host bracket false = ImportScoped.

— sent from snappy-tern-366

@gunbai-bot

gunbai-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Flip floor red — root-caused to a pre-existing interpreter bug, NOT the qualification pass. Fix is a standalone PR.

The floor red at batch 3: re-eval generated_nat_mul_annihilator_claim in generated_conformance_floor_test.dag: non-exhaustive pattern match on: 0.

This is not a resolution ambiguity and not a missed qualification — resolution succeeded. Root cause: the interpreter's native-coproduct reconciliation in match_pattern (v1_interpreter.rs, the Value::Int(n) if name == "Zero" || name == "Succ" arm) compares the full pattern name against the short literal "Zero". Under NamespaceOnlyY the resolver stamps a bare Zero/Succ pattern arm with its qualified containment path (v2.std.nat.Zero), so name == "Zero" is false, the grounded Int(0) (Zero→Int(0), #5428) matches no arm, and the match falls through non-exhaustive.

Pre-existing, not flip-caused — reproduced on origin/main (default ImportScoped) with an explicitly-qualified pattern:

FAIL qualified_pattern_matches_grounded_zero (runtime error: non-exhaustive pattern match on: 0)

The flip merely makes qualified pattern arms universal, so it surfaces corpus-wide. The Value::Variant arm already handles this via a pat_last short-name fallback (with a comment naming exactly this hazard); the native-coproduct arms (Nat Int, List Str/List, Optional/Witness Null) never got that treatment.

Fix — PR #7186 (standalone, off main): normalize the pattern arm name to its last segment (name_last) at every native-reconciliation guard — mirrors the existing pat_last invariant; a no-op for bare patterns, correct for qualified ones. Ships with a discriminating regression witness (qualified_pattern_reconcile_test.dag) that reds without the fix and greens with it. Verified by execution under the actual flip. This PR (#7178) should merge main once the fix lands, then re-run the floor — the qualification work here is correct and complete; it was blocked on this interpreter bug.

— sent from clever-pike-49

@briansrls
briansrls merged commit e9fe09e into main Jul 25, 2026
3 of 4 checks passed
@briansrls
briansrls deleted the test-flip-verify branch July 25, 2026 02:02
briansrls added a commit that referenced this pull request Jul 25, 2026
…7178 cost) (#7204)

The namespace-only flip #7178 (merged 2026-07-25) makes bare references resolve
by containment-walk (#6848 per-entry bare-reference fixpoint), adding ~200s to
the affected-set discovery-corpus resolve wall vs the import-scoped basis the
prior 1680 was sized on (#7137, all pre-flip). This is a real, attributed cost
shift, not a per-PR regression: THREE disjoint post-flip observations exceed
1680 -- #7198 (run 30140810666) 1820001ms, #7188 (run 30142221249) 1859345ms,
and the falsifier lane's warm post-flip run (~36min, same signature).

Operator-signed raise (briansrls, 2026-07-25): 2100s (35min), sized to the
+/-20% fleet host envelope over the observations so a slow-host broad-touch run
does not round-trip this row a third time. STOPGAP until #6848 cuts per-entry
resolve (dispatched as a lane) and the row dissolves into #7162's derived clamp.
Remedy stays diagnose-or-signed-raise, never rerun.

Standalone budget PR -- unblocks the fleet (#7198, #7188, and main's next push
all red on batch-3 over-budget) in one commit, disjoint from the feature lanes.

Co-authored-by: Brian Searls <briansrls@gunb.ai>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
briansrls added a commit that referenced this pull request Jul 25, 2026
…EN (#7214)

Dispatch 2 (#7200, global import deletion) went red on six sites in
src/v2/std/node.dag, all `Primitive(std.types.ContentHash) vs
Product(<anon>)`. Root-caused by execution against main+#7178 with an
eight-probe witness set; recorded as §14 of the existing #6985 diagnosis
rather than a new doc.

Two findings:

1. The qualified spelling buys no binding. `std.types.ContentHash` written
   out in full, in type position, resolves no better than the bare name —
   there is no containment binding path for cross-module TYPE references.
   The flip gave containment binding to values/functions, not to types, so
   the premise Dispatch 2 was cleared on is false for types.

2. The failure arm widens instead of refusing. Name absent from the pool
   refuses correctly (`unresolved type`, located); name present in the pool
   but not import-reachable fabricates `Product(<anon>)`, which unifies with
   everything downstream. Proven to pass a real cross-module consumer
   boundary at `0 blocking error(s)`. Only an incidental `if` juxtaposition
   catches it — DESIGN §5 fabricated-plausible-output, sitting under a
   1658-file strip whose green would have meant nothing.

Consequence: §13's blocker extends to Dispatch 2, which was not exempt.
Fix order is the fail-open first (it is what makes any binding fix
verifiable), then a containment path for type references.

Receipt only — no fix lands here, and #7200's branch is left as evidence.

Co-authored-by: Brian Searls <briansrls@gunb.ai>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
briansrls added a commit that referenced this pull request Jul 25, 2026
…ip containment-walk resolve isn't recomputed once-per-entry-per-worker (~200s/run on batch-3 since namespace flip #7178; this is the STOPGAP-dissolving root behind the #7204 budget raise). Root-cause + share the resolve across entr (#7217)

* WIP: Floor #6848: memoize the per-entry bare-reference fixpoint so post-flip

* WIP: Floor #6848: memoize the per-entry bare-reference fixpoint so post-flip

* WIP: Floor #6848: memoize the per-entry bare-reference fixpoint so post-flip

* WIP: Floor #6848: memoize the per-entry bare-reference fixpoint so post-flip

* WIP: Floor #6848: memoize the per-entry bare-reference fixpoint so post-flip

* WIP: Floor #6848: memoize the per-entry bare-reference fixpoint so post-flip

* Doc + carrier notes: assembly sub-row dissolution trigger, second cost-shape fix

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* WIP: Floor #6848: memoize the per-entry bare-reference fixpoint so post-flip

* WIP: Floor #6848: memoize the per-entry bare-reference fixpoint so post-flip

* Review 42566: caller reads local_names from the export-name index instead of re-folding

One extra O(|bindings|) fold per module per pass — the same authority computed
twice in the function whose thesis is that the set is ONE derived fact. The Absent
arm computes the true value from that same authority, so the structurally-unreachable
fallback stays honest rather than fabricating a default.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* WIP: Floor #6848: memoize the per-entry bare-reference fixpoint so post-flip

* Restore the regen-emitted seed clobbered by an auto-commit mid-experiment

An auto-commit captured a TEMPORARY revert of v1_compiler_infer.rs (a6a0a90) that I
had made only to build a before-arm test binary for the unit-suite comparison. That
left the .dag authority carrying the change while the emitted seed carried main's
version - regen drift, which the self-host gate would have redded.

This restores the regen output that src/v1/04_infer.dag actually emits. No .dag change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* WIP: Floor #6848: memoize the per-entry bare-reference fixpoint so post-flip

---------

Co-authored-by: Brian Searls <briansrls@gunb.ai>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
briansrls pushed a commit that referenced this pull request Jul 25, 2026
The raise discipline requires an appended dated line. This one does not
just co-sign: the dissolve-on the note carries names a MECHANISM my
diagnosis refutes, and leaving that standing would send the next reader
after the wrong thing.

The note hypothesised the cold-spawn / per-entry-reconcile class, on the
wasted_ms=166525 reading. Measured on the perturb spawn shape, it is two
independent corpus-denominated costs in different places:

  A  the bare-name census, parsed between normalize.done and reconcile.done
     (main.rs:491-514 + v1_compiler_compile.rs:2580), so it BOOKS to the
     reconcile bin and reads as "reconcile is slow" while being a
     whole-tree parse wearing reconcile's label — ~23s local, ~12-13s fleet

  B  the post-compile policy gate (cli_run.rs:2105) resolving
     default_source_roots() — the WHOLE TREE — to evaluate one nullary Bool,
     ~34-42s, once per process, independent of what was compiled

B is proven independent by running the same module with only its own source
root: zero pool, every phase 0ms, still 42.4s wall.

The asymmetry closes the arithmetic. main.rs:566/598 exit(1) on hard
diagnostics, so a RED compile never reaches the gate (~2s tail) while a
GREEN one pays it in full (~34s). The row makes 4 spawns, 2 red and 2 green:
~2x14.5 + ~2x60 = ~149s against the measured 148495.7ms. Pre-#7179 the same
row is census-only, ~52s — which IS the 53s basis. So B is the entire
53->148s regression and A was always there.

Consequence for this row: "near 350s" still holds directionally but by a
different mechanism, and fixing B alone returns it to ~55s.

Also recorded: no bisect was run and none is needed. The three-run
measurement attributes the split directly, so the bisect across #7178/#7179
in the probe plan is superseded work — confirming a known answer is not free
(DESIGN §2).

Verified: ci_floor_plan_witnesses green with the amended note.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013GELyMsZrGgZRrxte2TCsk
gunbai-bot Bot pushed a commit that referenced this pull request Aug 1, 2026
Frame N2 as binding-authority extension completing #7178; N1/N2 swap seam; lookup vs admission prose fix; peel_alias_once adjacent defect on N1.

Co-authored-by: Cursor <cursoragent@cursor.com>
gunbai-bot Bot pushed a commit that referenced this pull request Aug 1, 2026
Codex review 46849: values/fns do not already use namespace-reference-derived-closure
and OccurrenceBindingResult; those roadmap nodes remain active and #7178 predates them.
Clarify N2 sequencing against producer/changeover dependencies.

Co-authored-by: Cursor <cursoragent@cursor.com>
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