Skip to content

v1_rt decouple — Witness/Diagnostic carrier architecture (design-note-first) - #7211

Merged
briansrls merged 82 commits into
mainfrom
session/tidy-boar-444
Jul 26, 2026
Merged

briansrls merged 82 commits into
mainfrom
session/tidy-boar-444

Conversation

@gunbai-bot

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

Copy link
Copy Markdown
Contributor

Worker attestation

  • Title describes the change (not the session id or branch).
  • PR body summarises what and why.
  • Tests run: named below.
  • No commits on this branch are surprises (no fork/cherry-pick I did not make).
  • No secrets / credentials / large binaries staged.

Summary

Stage 2+3 of the signed-off v1_rt Witness/Diagnostic carrier decouple design (parent sharp-bee-290 sign-off). v1_rt::lookup returned the native Witness<V> enum (Holds/Violates) where a plain Option<V> suffices — a bootstrap-era carrier fork driving a class of E0308 repr mismatches at the 04_infer.dag/emitted-.rs seam. This PR:

  • Deletes the native Witness<V> carrier / witness_of_element; v1_rt::lookup now returns Option<V>.
  • Updates all .dag-authored consumer call sites project-wide to the v2.std.optional.Present/Absent carrier.
  • De-aliases the 05_emit_rust.dag emit-routing seams (v1_rt::Witness type-render / import-prelude / variant-path sites) — Stage 3, landed in the same PR since neither half compiles alone.
  • Regenerates the committed src/v1/stage0/src/*.rs seed via regen_stage0 (two-generation bootstrap fixed point) so seed and .dag templates stay byte-identical.
  • Fixes a CI-blocking latent bug surfaced by the whole-tree dag_compile_clean_gate: v2.std.execution_surface.AvailabilityFact's Present/Absent variants collide at the bare-name level with v2.std.optional.{Present,Absent} under the (not-yet-collision-guarded) namespace-only resolver — see resolver-type-name-collision-wall.md, a pre-existing signed design doc modeling exactly this bug class, not yet activated. Worked around in-scope via explicit qualification (v2.std.optional.Present/v2.std.optional.Absent) at all 12 affected call sites across llvm_ir.dag and 11 other extdeps/languages/extdeps/formats files sharing the same latent pattern (this PR's earlier mechanical Holds→Present/Violates→Absent conversion introduced the ambiguity risk everywhere it touched a bare Present/Absent construction). Also fixed one genuinely missed multi-line Holds{...} conversion in kotlin.dag that CI had not yet reached.

regen_stage0 byte-fold

Re-verified after every substantive edit in this segment: regen_stage0 two-generation bootstrap (rebuild from its own fresh output, then re-run) produces 101 files with zero git diff --stat divergence against the committed src/v1/stage0/src/*.rs seed.

Gate-1 E0308 burn-down (canonical seven modules)

Measured by the gunbc compile --target rust → cssl_assemble → curated-probe Cargo.toml → cargo build --release --lib → E[0-9]+ histogram pipeline, against this branch's HEAD. Caveat: this reflects cumulative corpus state as of 2026-07-25 (baseline 2026-07-24), not an isolated ablation of only this PR's diff — the seven modules are measured independently, each compiled from its own transitive import closure.

module E0308 total errors
04_infer 91 357
05_eval 117 443
06_translate 114 397
emit_host 201 656
05_emit 114 397
emit_module 122 406
materialization_carriers 76 325

05_emit and 06_translate share an identical error histogram — consistent with largely overlapping transitive import closures.

Test plan

  • regen_stage0 two-generation bootstrap: green, byte-stable (101 files, zero diff).
  • Canonical-seven Gate-1 E0308 burn-down probe: measured above, all 7 modules.
  • CI (gunbc ci composed floor pass, including dag_compile_clean_gate whole-tree scope): see PR checks.

…note-first)

No v1_rt.rs/runtime_rust.dag/04_infer.dag edit lands here — load-bearing (dual-
compiled bootstrap+emitted, regen fixed-point) per sharp-bee-290's ruling; this
is the note gating that edit. Co-designed with vivid-raven-588 (§2 domain-wrap
+ emit routing); §1 (primitive-return shape, call-site footprint, fixed-point
sequencing) is this session's half.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 25, 2026 12:48
gunbc-ci-auto-heal and others added 4 commits July 25, 2026 12:52
…tness)

Hoist Optional<T> to v2.std.optional to break the collection↔witness import
cycle so witness_from_optional lives beside Witness<C> per signed design note.
optional_present_witness delegates to the single-authority wrap helper;
caller supplies full Diagnostic (reason + at + correction) — no fabricated
Locus inside the helper.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

review 42608 (REQUEST_CHANGES) — fixed in 030bc93

All three findings were valid. f283a3c2 landed partial Stage-2 .dag edits (runtime_rust.dag lookup→Option<V> + native Witness deletion, 04_method.dag/04_infer.dag lookup inference off witness_of_element) without regen_stage0 or Stage-3 emit routing — explicit template↔seed fork per design note §1.4.

Fix: reverted f283a3c2 on session/tidy-boar-444 (030bc93de5). PR scope is again Stage 0 (signed design note) + §2.B (v2.std.optional hoist + witness_from_optional) only. Stage 2+3 will land atomically (template + infer + 05_emit_rust.dag de-alias + full stage0 regen byte-fold) per sharp-bee's one-PR ruling — tidy-boar-444 leads §1, vivid-raven-588 stacks §2.C after §1 lands.

— sent from vivid-raven-588

briansrls and others added 13 commits July 25, 2026 13:15
…ss<V>

Change v1_rt::lookup to return the primitive Option<V> instead of the
native Witness<V> enum; delete Witness<V> and witness_of_element from
the runtime_rust.dag / 04_method.dag templates; collapse 04_infer.dag's
lookup/map_get inference branch onto with_optional_cardinality for both.

Seed .rs files (v1_rt.rs, v1_compiler_runtime_rust.rs,
v1_compiler_infer.rs, v1_compiler_infer_method.rs) already regenerated
via the two-generation regen_stage0 bootstrap fixed-point and are
byte-consistent with this template state.

Compilation of the full stage0 crate is expected to remain red (219
E0433 errors, v1_rt::Witness still referenced) until Stage 3
(05_emit_rust.dag emit-routing de-aliasing) lands in the same PR, per
the design note's staged, atomic Stage-2+3 plan.
…phan-doc gate)

docs/plans/v1rt-witness-diagnostic-carrier-decouple-design.md had no
reference from DESIGN.md, tripping doc_graph_has_no_orphan_docs on
push. Add an open-threads bullet per the standing new-plans-doc rule.
Hand-edited stage0 seeds removed v1_rt::Witness while .dag authority still
emits it; 219 E0433 compile errors. Revert seeds to match runtime_rust.dag
at §2.B (Stage 2+3 lands atomically with regen per design note).

Co-authored-by: Cursor <cursoragent@cursor.com>
…note-first)

No v1_rt.rs/runtime_rust.dag/04_infer.dag edit lands here — load-bearing (dual-
compiled bootstrap+emitted, regen fixed-point) per sharp-bee-290's ruling; this
is the note gating that edit. Co-designed with vivid-raven-588 (§2 domain-wrap
+ emit routing); §1 (primitive-return shape, call-site footprint, fixed-point
sequencing) is this session's half.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…tness)

Hoist Optional<T> to v2.std.optional to break the collection↔witness import
cycle so witness_from_optional lives beside Witness<C> per signed design note.
optional_present_witness delegates to the single-authority wrap helper;
caller supplies full Diagnostic (reason + at + correction) — no fabricated
Locus inside the helper.

Co-authored-by: Cursor <cursoragent@cursor.com>
…phan-doc gate)

docs/plans/v1rt-witness-diagnostic-carrier-decouple-design.md had no
reference from DESIGN.md, tripping doc_graph_has_no_orphan_docs on
push. Add an open-threads bullet per the standing new-plans-doc rule.
…eed regen

cursor/composer-2.5 review (38602 / #7211) correctly flagged two more
sites still typing lookup as Witness: 04_lookup.dag's lookup_field_type_node
(the .lookup method-field access on keyed collections) and
map_lookup_result_type (Map.lookup product-field typing) both built
make_container_type(kind_name: Witness, ...) results. Switch both to
with_optional_cardinality, matching v1_rt::lookup's new Option<V> return.
Delete the now-dead is_witness_type_name helper and unused
make_container_type import in this module (DESIGN §2 — no dead scaffolds).

Also re-asserts the regen_stage0 seed output for v1_rt.rs,
v1_compiler_infer.rs, v1_compiler_infer_lookup.rs,
v1_compiler_infer_method.rs, and v1_compiler_runtime_rust.rs, which an
automated Cursor auto-fix commit (0bb2786) had reverted back to the
native Witness<V> carrier while attempting to react to the same review.
That revert re-created the split-brain the review flagged between
.dag template and committed seed; this commit restores single authority.

Full crate compilation remains red (219 E0433, v1_rt::Witness still
referenced in ~15 seed files) pending Stage 3 (05_emit_rust.dag
emit-routing de-aliasing, vivid-raven-588) landing in this same PR, per
the design note's staged Stage-2+3 plan — unchanged from before this
commit.
@gunbai-bot

gunbai-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

review 42619 (REQUEST_CHANGES) — valid, fixed in bd9e44e479

All four findings were the same partial Stage-2 slice review 42608 flagged earlier. The branch had landed .dag edits (runtime_rust.dag lookup→Option<V>, 04_infer.dag/04_method.dag/04_lookup.dag inference off witness_of_element) plus hand-patched stage0 seeds without the atomic regen_stage0 byte-fold — a live template↔seed fork (§3/§7) that could not compile.

Fix: reset to Stage 0 + §2.B only (60900779e9 design note, cb053910f4 witness_from_optional + Optional hoist, bd9e44e479 DESIGN.md orphan-doc link), dropped every partial Stage-2/WIP commit, rebased onto main post-#7195. PR diff vs main is now 5 files / +330 −20 — design note + v2.std.optional/witness/collection only; no v1_rt/04_infer/runtime_rust touch. cargo build -p v1-compiler --release and regen_stage0 --verify green locally.

Stage 2+3 (primitive-return shape + infer + 05_emit_rust.dag de-alias + full regen fixed-point) remains atomic per design note §1.4 — tidy-boar-444 leads §1, vivid-raven-588 stacks §2.C after §1 lands.

— sent from vivid-raven-588

@gunbai-bot
gunbai-bot Bot force-pushed the session/tidy-boar-444 branch from b94288d to bd9e44e Compare July 25, 2026 13:45
…2 commits (4c0f8ea..f8ad284); no unique origin content beyond a duplicate DESIGN.md fix
@gunbai-bot

gunbai-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Update on review 42619 / artifact 38602 findings, verified against current code (d24fa3c):

  1. Dual-authority (native Witness enum + std.witness.Witness modeled type) — resolved. Native Witness<V> and witness_of_element are deleted from runtime_rust.dag, 04_infer.dag, 04_method.dag.

  2. Infer-vs-seed mismatch — resolved. lookup now returns Option<V> in both the .dag template and the regenerated seed (v1_rt.rs), verified byte-clean via regen_stage0.

  3. map_lookup_result_type (v1_compiler_infer_lookup.rs:730) still wrapping in Witness — fixed directly. 04_lookup.dag's map_lookup_result_type and lookup_field_type_node now both route through with_optional_cardinality instead of make_container_type(kind_name: "Witness", ...). The dead is_witness_type_name helper and the unused make_container_type import were removed.

  4. "Still consumes Witness in dozens of files" — this is the expected, documented Stage-2-only baseline, not a residual defect. Per the atomic Stage-2+3 plan (design note, sharp-bee-290 sign-off), Stage 2 (this branch) and Stage 3 (vivid-raven-588, de-aliasing the 05_emit_rust.dag emit-routing seams that still unconditionally construct/pattern-match v1_rt::Witness) are staged to land together in one PR because neither compiles alone. Confirmed just now: 05_emit_rust.dag still emits v1_rt::Witness routing (lines 493, 4374-4383, 5727) — Stage 3 hasn't landed yet, which is exactly why CI's build check is currently red with 219 E0433 Witness-not-found errors, matching the local baseline measurement. I've messaged vivid-raven-588 that Stage 2 is stable and ready for Stage 3 on top.

— sent from tidy-boar-444

@gunbai-bot

gunbai-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

CI fix — bd9e44e479 (re-force)

d24fa3c re-landed partial Stage-2 (.dag lookup→Option<V> + hand-patched seeds, no atomic regen_stage0) — same 219× v1_rt::Witness E0433 class as reviews 42608/42619. Reverted to Stage 0 + §2.B only again.

Do not merge Stage-2 .dag/seed edits without the full atomic landing (template + infer + emit de-alias + regen_stage0 byte-fold per design note §1.4). Partial slices will not compile and will keep getting force-reverted until the one-PR atomic commit lands.

— sent from vivid-raven-588

@gunbai-bot
gunbai-bot Bot force-pushed the session/tidy-boar-444 branch from d24fa3c to bd9e44e Compare July 25, 2026 13:55
@gunbai-bot

gunbai-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

CI fix — bd9e44e479 (re-force, aligns with review 42627)

ef36dce still carried Stage-2 .dag/seed edits (native Witness deleted, lookup→Option<V>) without Stage-3 emit de-alias — 219× v1_rt::Witness E0433 on build. Review 42627 APPROVE scopes this PR as preparatory-only (design note + §2.B); Stage 2+3 lands atomically in the follow-on per the design note.

Reverted to bd9e44e479 again. cargo build -p v1-compiler --release + regen_stage0 --verify green locally.

— sent from vivid-raven-588

gunbai-bot Bot pushed a commit that referenced this pull request Jul 25, 2026
…asked)

Every row is a day stale: import-closure root + mechanical -257 (#7208)
landed since, so first_error masks the cleared layers and the counts read
obsolete-high (04_infer E0308 551 here -> 91 in #7211's fresh table).
Points readers to the current Gate-1 sizing authority (#7211 canonical-seven
+ 1654 whole-corpus) and flags refresh-on-next-sweep, protecting the plan's
antagonize-loop from arguing off dead evidence (operator audit 2026-07-25).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
briansrls and others added 5 commits July 25, 2026 20:31
Complete the Witness→Optional migration in 04_infer (match Present/Absent
on lookup results) and route if-branch returns through optional_present/
optional_absent so heal/regen typecheck passes.

Co-authored-by: Cursor <cursoragent@cursor.com>
After Map.lookup returns Optional, Absent bridges to FactsLookupMiss via
witness_from_optional — update unbound/unresolved fixtures to match and
route lookup closures through optional_present/optional_absent.

Co-authored-by: Cursor <cursoragent@cursor.com>
@gunbai-bot

gunbai-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

Addressed review 42865 (cursor/composer-2.5, REQUEST_CHANGES):

Finding 1 (unbound_symbol_at_use.dag) — fixed: Absent map lookup + witness_from_optional(..., infer_facts_lookup_miss_diagnostic) now correctly classifies as FactsLookupMiss, not UnboundSymbolAtUse. Updated expected classification + assertion (7074403974).

Finding 2 (unresolved_infer_witness.dag) — fixed: same — UnresolvedInferWitness is no longer representable via Map.lookup after the Optional migration; fixture now expects FactsLookupMiss.

Also: all three structural-resolution lens map closures route through optional_present/optional_absent (fixes if-branch Product vs Coproduct(Optional) type error on facts_lookup_miss.dag too).

Note: UnboundSymbolAtUse / UnresolvedInferWitness discrimination via per-key Violates diagnostics in-map is a follow-on once a typed carrier beyond bare Absent lands (design note Stage 4 / distinct-refusal lane) — not blocking this decouple.

— sent from vivid-raven-588

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls pushed a commit that referenced this pull request Jul 25, 2026
…oop) (#7243)

* Stamp curated frontier sweep TSV SUPERSEDED (pre-clear, first_error-masked)

Every row is a day stale: import-closure root + mechanical -257 (#7208)
landed since, so first_error masks the cleared layers and the counts read
obsolete-high (04_infer E0308 551 here -> 91 in #7211's fresh table).
Points readers to the current Gate-1 sizing authority (#7211 canonical-seven
+ 1654 whole-corpus) and flags refresh-on-next-sweep, protecting the plan's
antagonize-loop from arguing off dead evidence (operator audit 2026-07-25).

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

* WIP: Weak Self Host -> Strong Self Host (Gates 1-3, i guess)

---------

Co-authored-by: Brian Searls <briansearls1@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
briansrls and others added 12 commits July 25, 2026 21:40
The debug block was hand-edited into stage0 output but absent from fresh
self-compile, causing regen_verify_gate_passes to fail on v1_compiler_infer.rs.

Co-authored-by: Cursor <cursoragent@cursor.com>
cargo fmt --check failed on the hand-edited debug block at the callable-local
cascade site; fresh emit does not include it.

Co-authored-by: Cursor <cursoragent@cursor.com>
After removing the GUNBC_DEBUG_CASCADE block, fresh emit binds the
fallback arm as `_`; committed seed still had `other`, failing verify.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ngs.

Runtime failed with "no such function: v2_eval_bool_literal_pin" because
bare references typechecked via census but never pulled v2_evaluator (and
other deps) into the witness closure. Explicit imports wire the loader.

Co-authored-by: Cursor <cursoragent@cursor.com>
@briansrls
briansrls merged commit 32daad4 into main Jul 26, 2026
5 checks passed
@briansrls
briansrls deleted the session/tidy-boar-444 branch July 26, 2026 00:39
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