Skip to content

Body-producer Stage A: FLAGs D/E/F signed + within-body fact layer (one sugar table, 3-edge seam Loop, definition closure) - #6443

Merged
briansrls merged 9 commits into
mainfrom
claude/body-producer-stage-a-d
Jul 10, 2026
Merged

briansrls merged 9 commits into
mainfrom
claude/body-producer-stage-a-d

Conversation

@briansrls

@briansrls briansrls commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Body-producer Stage A: FLAGs D/E/F signed + the within-body fact layer, by execution

Operator signed all three design flags (2026-07-10) and asked for the A→D arc. This PR lands the flags and Stage A's within-body fact layer — the pieces provable without the namespace lane's containment index — and records the honest gate on the rest. Design doc: docs/plans/general-body-producer-design.md (§9 now carries the signs; the staged plan carries the landed/remaining split).

FLAG D — signed: conform now, re-grounding is REQUIRED pre-close cleanup

The lowering conforms to eval's structural-equality binding-key protocol. Per the operator's condition, the identity re-grounding of EnvironmentBindingKey (which also deletes the silent allocate_literal fall-through, a §5 fail-open) is now a hard conjunct of the feature's dissolution trigger — the doc cannot dissolve over the conform-time protocol.

FLAG E — signed: one rule table (landed)

SugarKey = SurfaceAtomKey | ProductionIdentityKey; the hand-inlined ^dag_surface_type_alias_rhs coproduct fold migrated onto the table as SugarFoldCoproductPipeChain — semantics preserved exactly (Disj-keep quirk + diagnostics threading), normalize has one hook. Key extraction stays compiler-side (the production-identity readers live in extdeps; std must not import upward). Receipts: type-alias emit witnesses 3/3, whole-tree --target dag compile 0 diagnostics.

FLAG F — signed: 3-edge seam Loop (landed)

  • ^loop_carrier_edge is the exactly-one-legal-name (arbitrary extra Named edges stay illegal — both live RED controls still fire: loop_illegal_named, enforcement_consistency_gate_holds), at-most-one occurrence (2-edge Loops stay legal — no constructor cascade).
  • The carrier is excluded from the iteration fold in the same motion — the cost product and 04_infer's τ→τ carrier check follow the single predicate automatically.
  • Canonical hashing needed zero code change (the sorted middle bucket already handles it; pinned by claim_content_hash_loop_bound_edge_order_invariant, still green).
  • The fold seam emits the carrier from the step-fn's first param (lexeme-stamped); an unreadable binder is ^fold_lowering_shape_invalid, never fabricated. New witnesses: lowered_loop_binds_carrier_binder (binds ^acc from real parsed source), duplicate_carrier_edge_is_malformed (RED).

Stage A fact layer (landed)

  1. Carrier read = one authority. The lens's accumulator binding now comes from fold_call_to_loop + loop_carrier_binder_target (the design's "named-edge lookup"); the lens's duplicated surface navigation is deleted. fold_family_head moved to the seam and the lens imports it — the family-membership fork is gone; the seam accepts the whole family. ^fold_accumulator_unread narrows to the named-step residue (f: step — a callee-resolution fact, Stage B's), pinned green by the existing RED control.
  2. Definition closure decides aliasing (^copied_port_name_may_alias bucket). Grammar: the let binder is now stamped by dag_grammar_binding_name_terminal (the single binding-name authority; the name was unreadable before — no consumer existed). Lens: a let-spine arm walks stmt spines lexically; a binder whose RHS closes to a carrier joins the carriers (transitive by construction), pure-literal RHS decides fresh, computed RHS decides computed — port readings are resolved before classification, so classify_call and all 10 unit witnesses are untouched. An unbound RHS records no binding — the refusal stands (the closure decides, never defaults clean).
    • let grown = acc → proven Poly2Suspect (was a may_alias refusal — the shadowing false-alarm class is dead)
    • let g = acc; let h = g → proven suspect (transitive)
    • let seed = 0 → provably clean (zero findings)
    • let grown = mystery → may_alias refusal stands (the residue RED control)

Verification (all by execution, wet)

Whole-tree --target dag compile 0 diagnostics ×3 (after each landing); fold-lowering suite 8/8; loop multiplicity 8/8; loop infer 5/5; lens corpus witnesses 13/13 (incl. the four new let-closure witnesses); lens unit witnesses 10/10 (unchanged); offline roster gate 7/7 with unchanged ceilings (behavior-identical carrier migration); hash-order invariance green; type-alias emit 3/3; DESIGN.md regen + drift gate PASS.

What is deliberately NOT in this PR (the honest gate)

The fn_decl/fn_literal → Arrow producer rows, the resolve scope-scaffold dissolution, and Stage D's MVP subsumption. Reason, verified in-tree: decl names bind via module-root edges / the namespace authority — not decl subtrees — and every wrapper consumer (fn_family, cost_coverage, the MVP producer, the scaffold) reads the wrapper shape. Landing a near-zero-coverage producer slice now would create a dual authority without dissolving anything (the scaffold deletes only at 100% coverage). The design doc's staged plan now records this: the producer rows ride the namespace lane's SymbolIndex, staged behind a typed wrapper-retained frontier (lowered | wrapper-retained{cause}, counted, corpus green) — the same typed-frontier pattern as the self-host seed roster. The let-binder StampLexeme landed here is the Bind-lowering prerequisite already paid.

🤖 Generated with Claude Code

Brian Searls and others added 8 commits July 10, 2026 19:19
…-edge seam Loop with carrier binder

FLAG E: SugarKey = SurfaceAtomKey | ProductionIdentityKey; the hand-inlined
^dag_surface_type_alias_rhs coproduct fold migrates onto the table as
SugarFoldCoproductPipeChain (Disj-keep + diagnostics threading semantics
preserved exactly); normalize has ONE hook (key extraction stays compiler-side
- the extdeps production-identity reader must not invert into std). Receipts:
type_alias emit witnesses 3/3, whole-tree --target dag compile 0 diagnostics.

FLAG F: exactly-one-legal-name (^loop_carrier_edge), at-most-one occurrence
(2-edge Loops stay legal - no constructor cascade); carrier EXCLUDED from the
iteration fold in the same motion (cost product + infer tau->tau carrier check
follow the single predicate); loop_carrier_binder_target reader; fold seam
emits the carrier from the step-fn's first param (lexeme-stamped ident,
navigation follows the fn_literal grammar expression; unreadable binder =
^fold_lowering_shape_invalid, never fabricated). Hashing needs no change
(3-edge Loop bucketing pinned by claim_content_hash_loop_bound_edge_order).
Receipts: fold_lowering 6/6 + 2 new witnesses (carrier binds ^acc; duplicate
carrier edge malformed RED), loop_multiplicity 8/8, loop_infer 5/5, both
extra-named-edge RED controls still fire (loop_illegal_named,
enforcement_consistency_gate_holds), hash-order invariance green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gunbai-bot gunbai-bot Bot changed the title complexity Body-producer Stage A: FLAGs D/E/F signed + within-body fact layer (one sugar table, 3-edge seam Loop, definition closure) Jul 10, 2026
…SIGN.md open-thread regen

The staged plan now carries the landed/remaining split (within-body fact layer
landed; fn_decl->Arrow producer rows + scaffold dissolution gated on the
namespace lane's containment SymbolIndex behind a typed wrapper-retained
frontier), the FLAG signs, the FLAG D pre-close cleanup conjunct in the
dissolution trigger, and the fold_family_head single-authority correction
(the doc's stale 'omits fold_list_right' claim). DESIGN.md regenerated from
design_document.dag; drift gate PASS.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 10, 2026 20:49
@gunbai-bot

gunbai-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

The "CI FAILING (2 failing)" dashboard reading is the known superseded-run artifact: the draft-to-ready flip re-triggered CI under the concurrency group, cancelling the prior runs (29122451110 on this head, 29121977844/29121035026 on WIP heads). The live run is 29122711335 — all three checks in progress on head a962994. No fix needed; my watcher is on it. — sent from eager-ram-612

@briansrls
briansrls merged commit e899f7e into main Jul 10, 2026
4 of 6 checks passed
@briansrls
briansrls deleted the claude/body-producer-stage-a-d branch July 10, 2026 21:24
briansrls added a commit that referenced this pull request Jul 10, 2026
body_lower_after_children now routes all production identities through
body_lower_production_emitted (not fn_decl-only). body_lowering_fold_note
documents complementarity with #6443 fold_lowering — delegation via
fold_call_to_loop, no parallel fold→Loop path.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jul 11, 2026
body_lower_after_children now routes all production identities through
body_lower_production_emitted (not fn_decl-only). body_lowering_fold_note
documents complementarity with #6443 fold_lowering — delegation via
fold_call_to_loop, no parallel fold→Loop path.

Co-authored-by: Cursor <cursoragent@cursor.com>
briansrls added a commit that referenced this pull request Jul 11, 2026
…pt. Build on MERGED Stage A (#6443, within-body fact layer + 3-edge Loop carrier + sugar table) — do NOT restart it. Complete fn-body emit: Stage B cross-decl, Stage C per-op derivation, Stage D MVP subsumption (fn_decl→Arrow now U (#6459)

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* Slice 0: document fold_lowering seam + wire full production dispatch.

body_lower_after_children now routes all production identities through
body_lower_production_emitted (not fn_decl-only). body_lowering_fold_note
documents complementarity with #6443 fold_lowering — delegation via
fold_call_to_loop, no parallel fold→Loop path.

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

* Slice 1 (Stage B): projection-call lowering to canonical Transform.

Postfix expr helper.step(a,b) now lowers to Transform with method as
operator head and receiver as first arg — dissolves lens-invisible
projection calls. Witness: body_lowering_projection_call.dag.

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

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* fix: re-anchor baked absolute pool roots for module-graph closure.

pool_roots_for_module_graph_closure used process_workspace_root strip only,
panicking when sccache passed compile-time runner absolute paths (srv2-04)
into a checkout on another runner (srv2-05). Route absolute spellings through
repo_relative_path_normalized so baked-prefix re-anchoring matches the rest
of the runtime-root pipeline.

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

* fix: add ROADMAP-linked HAND-RUST receipt for runtime-root scaffold.

cli_run_runtime_workspace_root_plumbing marker cites ROADMAP
5-dissolve-patches / cli_run.rs HAND_MAINTAINED drain lane, unblock
#6106 orchestration emission, named delete set (~130 LOC), and grep receipt.
Addresses HAND-RUST gate review feedback without widening scope.

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

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* fix(ci): raise floor step timeout to 90m for body_lowering discovery cost.

Run 29148735992 timed out at 60m mid discovery corpus after the normalize
hook pulled body_lowering_fold into resolve closures; pairs with the
NormalizedTree import split and receipts the #6459 inflation in ci_workflow.

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

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* fix(ci): lazy-resolve skipped entries only when a witness actually runs.

Skip-before-resolve elides cold entry resolve for import-closure-unaffected
rows under SelectionApplied, but predict-only/falsifier and host-scaffold
paths still execute — defer resolve until after the skip decision so Applied
mode pays zero resolve for skipped entries (run 29151192892 @ 194b630 timed
out at 90m mid-discovery after lens_verdict).

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

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* WIP: Wave 2 - body-producer Stages B/C/D + behavioral weak-self-host receipt.

* fix(ci): add §7 HAND-RUST scaffold for discovery skip-before-resolve.

Mirror cli_run_runtime_workspace_root_plumbing: named marker, ROADMAP
2-provenance-ingest lane, DELETE WHEN receipt, and unit test for
entry_eligible_for_discovery_skip_before_resolve / lazy-resolve loop.

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

* fix(compiler): drop stale NormalizedTree import from normalize in name_resolve.

03_normalize no longer defines NormalizedTree after the normalized_tree
module split; the duplicate import from v2.compiler.normalize was a
fail-open unresolved binding alongside the correct normalized_tree import.

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

---------

Co-authored-by: Brian Searls <briansrls@gunb.ai>
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