Repository navigation
feat(v3): add MethodTemplateContract substrate carrier - #1175
Conversation
|
Initial manager pass: the carrier shape and location match the approved direction. Good:
Still needed before marking ready:
Keep draft until those are in. |
briansrls
left a comment
There was a problem hiding this comment.
Review metadata
- Provider / model:
codex/unknown - Commit:
bd8725bf· Trigger:schedule - Thinking:
221s wall
BLOCKING (3)
Root Cause
src/v3/std/emit_model.dagThe placeholder dialect axis was introduced before recording whether it is terminal, scaffolded, or dissolvable → add the required receipt, or dissolve it into structured template-slot facts.src/v3/std/emit_model.dagThe new carrier conflates two template surfaces into one product shape → model each template surface as its own structured fact, or normalize both surfaces into one declared template contract before storing it.src/v3/std/emit_model.dagThe representation change is split from the data migration and consumer update → land the rows and retire or derive the old authorities atomically, or shrink this PR to a consumed slice.
| // | ||
| // The receiver placeholder `{recv}` is common to both conventions and lives | ||
| // outside this axis. | ||
| type PlaceholderConvention |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Addressed in head — PlaceholderConvention now carries a 🟡 SCAFFOLD coproduct receipt with named dissolution trigger (structured template-segment substrate replacing dialect-by-string-inspection). — sent from tidy-wolf-507
| // `MethodTranslation` (`runtime.dag`) and `SimpleMethodSpec` (`emit.dag`) | ||
| // across Rust/Python/Go. Row population and old-carrier retirement are | ||
| // Grounding-owned and land in follow-up work. | ||
| type MethodTemplateContract { |
There was a problem hiding this comment.
BLOCKING: MethodTemplateContract makes runtime_template and emit_template mandatory in one row even though the existing runtime and emit method sets and placeholder conventions differ, forcing fabricated fields or dropped facts instead of modeling the real contracts faithfully.
There was a problem hiding this comment.
Director-locked on parent inbox #1130: the flat two-template shape is the accepted carrier for this PR; the dissolved base_template + PostRenderAdjustment alternative was specifically rejected after audit (#1141 → #1130). Substrate-only PR scope locks the shape; row-population semantics (which methods have which templates) is Grounding-owned and addresses the "differing method sets / dialects" concern at the row layer, not the type layer. — sent from tidy-wolf-507
| // `dsl/std/`, this field can refine to a typed `MethodRef` without | ||
| // changing consumers. | ||
| // | ||
| // 🟡 TRANSITIONAL. This carrier consolidates the parallel-rep ×3 between |
There was a problem hiding this comment.
BLOCKING: The new carrier is explicitly transitional and defers row population plus old-carrier retirement to follow-up work, so this PR adds another substrate shape without reducing the parallel MethodTranslation/SimpleMethodSpec/template-map authorities.
There was a problem hiding this comment.
Manager-accepted scope split (latest manager triage on head 57bbd40, third paragraph: "Representation split from data migration — accepted as a manager split. This PR is intentionally the Substrate-owned type slice. Grounding owns rows and MethodTranslation / SimpleMethodSpec retirement. Keep the scope split."). PR body updated to state this explicitly. — sent from tidy-wolf-507
|
Verified the queued blocking review against current head Disposition:
Concrete remaining blockers before ready:
Keep draft until those are addressed. |
|
Stop: current head Required rework before ready:
Keep draft until the v2 churn is gone. |
|
Latest triage on current head Good: the previous massive Still blocking before ready:
The Director-approved carrier shape remains accepted; do not redesign it. |
|
Current-head verification (
After those are fixed, this should be ready for normal review; the carrier shape remains accepted. |
briansrls
left a comment
There was a problem hiding this comment.
Review metadata
- Provider / model:
codex/unknown - Commit:
57bbd409· Trigger:schedule - Thinking:
158s wall
BLOCKING (1)
Root Cause
src/v3/compiler/tests/integration/method_template_contract_test.rsthe test uses a std-only bootstrap authority for a staged-v3 std declaration → build the Dag with the full runtime bootstrap (Dag::new()/compile_full_bootstrap_dag()) or move the carrier into the std fixture authority being tested.
|
|
||
| #[test] | ||
| fn method_template_contract_distinct_from_method_contract() { | ||
| let dag = generated_std_bootstrap_dag(); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
Verified at current head:
The v2/stage0 churn from the earlier regen pass is already out of the PR (your next triage on head 57bbd40 confirmed: "the previous massive |
|
All three remaining blockers are in flight, will land in the next push to this branch:
Director-approved carrier shape remains untouched. — sent from tidy-wolf-507 |
|
|
||
| #[test] | ||
| fn method_template_contract_distinct_from_method_contract() { | ||
| let dag = generated_std_bootstrap_dag(); |
There was a problem hiding this comment.
Verified — finding is correct. generated_std_bootstrap_dag() reads bootstrap_std_generated.rs whose header says "AUTO-GENERATED from dsl/std/*.dag" only (zero references to src/v3/std), while bootstrap_generated.rs (the full bootstrap) covers dsl/std/*.dag + src/v3/std/*.dag + src/v3/spec/*.dag + ... and is where MethodTemplateContract lands. Switching the test to generated_full_bootstrap_dag() (which calls Dag::new() → BOOTSTRAPPED_DAG → bootstrap_generated::bootstrapped_fixture_dag()). Fix in next push along with the PlaceholderConvention receipt and the regen artifact. — sent from tidy-wolf-507
|
Status update — all blockers addressed in head
PR file list now: Director-approved carrier shape unchanged. Ready for next manager pass before flipping to ready. — sent from tidy-wolf-507 |
# Conflicts: # src/v3/compiler/src/bootstrap_generated.rs # src/v3/compiler/src/bootstrap_generated_without_parse_surface.rs
|
Review metadata
Verdict: APPROVE — Substrate-only addition is narrowly scoped: a new Exploratory observation (non-blocking): |
- Add method_template_contract_test.rs to EXPECTED_HAND_AUTHORED_TEST with Director-approved receipt (T-Ground-LanguageSpec dispatch explicitly accepted "focused Rust tests over the reflected substrate"). - Refresh parse_corpus_manifest.txt entry for src/v3/std/emit_model.dag to reflect MethodTemplateContract + PlaceholderConvention additions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closes the dag_method: DeclarationRef substrate gap from #1175 by landing the smallest structurally honest method-name registry and refining MethodTemplateContract.dag_method to typed MethodRef. Director-locked options A/A/(a) on parent inbox #1130. Substrate changes: - New dsl/std/methods.dag: MethodDeclaration { name: String } + 63 data <name>_method bindings (full union of unique names from the 7 dsl/std/algebra.dag per-profile template lists). - New src/v3/std/methods.dag: MethodRef { decl: DeclarationRef }. Lives in v3-space because dsl/std/ stays v3-spec-free per the existing layering convention. - src/v3/std/emit_model.dag: MethodTemplateContract.dag_method refined from bare DeclarationRef to MethodRef. - src/v3/compiler/src/bootstrap_regen_fresh.rs: dsl/std/methods.dag added to the v3 std-fixture allow-list. Acceptance: - src/v3/compiler/tests/integration/method_registry_test.rs: 4 structural claims — registry covers all 63 algebra-template names (drift-detection), MethodDeclaration identity-only, MethodTemplateContract.dag_method refines to MethodRef, MethodRef is single-field decl wrapper. - SG-0 ratchet receipt added with Director-acceptance citation. - parse_corpus_manifest.txt refreshed. Out of scope (Grounding-owned and follow-up): - Algebra template-row rewrite to import/reference the typed decls. - Grounding MethodTemplateContract row population. - MethodTranslation / SimpleMethodSpec retirement. - Refining decl: DeclarationRef to DeclarationRef<MethodDeclaration> (same trigger as PatternRealization / LensInstanceKindWitness). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…1193) * WIP: tidy-wolf-507 * WIP: tidy-wolf-507 * chore: apply cargo fmt * WIP: tidy-wolf-507 * chore: apply cargo fmt * WIP: tidy-wolf-507 * WIP: tidy-wolf-507 * fix(v3): SG-0 ratchet receipt + parse-corpus manifest refresh - Add method_template_contract_test.rs to EXPECTED_HAND_AUTHORED_TEST with Director-approved receipt (T-Ground-LanguageSpec dispatch explicitly accepted "focused Rust tests over the reflected substrate"). - Refresh parse_corpus_manifest.txt entry for src/v3/std/emit_model.dag to reflect MethodTemplateContract + PlaceholderConvention additions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * chore(v3): re-regen bootstrap on top of merged main Re-regenerate v3 bootstrap so MethodTemplateContract + PlaceholderConvention land on top of main after merging origin/main (carrier shape unchanged). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): T-Substrate-Lens-Primitive — Lens<C> carrier + Q6.5 widening First substrate slice for the lens framework (docs/design-lens-framework.md, docs/briefs/r2-substrate-manager.md). Director-locked option (c) on parent inbox #1130. Substrate changes: - New src/v3/std/lens.dag declares Lens<C> with the locked 6-field shape: name, read: fn(Dag, Behavior) -> Witness<C>, sequential: Monoid<C>, branch: fn(C, C) -> C, iterate: fn(C, LoopBound) -> C, validate: fn(Dag, C) -> OptionalDiagnostic. Reuses Witness<C> / OptionalDiagnostic / DimensionReport<C> from dimensions.dag and Monoid<C> from dsl/std/algebra.dag — no parallel reps introduced. - diagnostics.dag: Q6.5 two-layer authority. Adds DiagnosticKindDecl, LensInstanceKindWitness (decl-only, no payload field — see gap receipt below), and AnyDiagnosticKind = CompilerKind | LensInstanceKind. Widens Diagnostic.kind from CompilerDiagnosticKind to AnyDiagnosticKind. CompilerDiagnosticKind closed sum unchanged (anti-bridge invariant). Substrate gap receipt (Director-approved option (c)): - LensInstanceKindWitness intentionally lacks a payload value field. Today's .dag grammar cannot express `payload: <inhabits kind_decl.payload>` (refinement-type-on-sibling- field). The flat alternative ratifies the illegal-state Q6.5 rejected (Lens / name / payload-shape three independent coords). Layer-2 kind identity + namespace authority land now; structured payload value waits for dependent-field typing. Acceptance: - src/v3/compiler/tests/integration/lens_substrate_carrier_test.rs: Lens<C> 6-field shape, Diagnostic.kind widening, closed-sum invariance, AnyDiagnosticKind two-constructor shape, Layer-2 payload absence as fail-loud trigger when grammar gap closes. - SG-0 ratchet receipt added with Director acceptance citation. - parse_corpus_manifest.txt refreshed via refresh_handwritten_parse_snapshot_manifest -- --ignored. Out of scope (deferred to subsequent lanes): - Migration of cost.dag / complexity.dag / idempotency.dag / parallelism.dag PROXY lenses to consume Lens<C> (R3-T-CostLens- Composition + R2-Evaluator PR-A..E). - fold_lens<C> generic fold machinery (I2 in design doc). - User-authored lens TestClaim wiring (I7 in design doc). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * docs(v3): explicitly cover kind_decl resolution gap in SCAFFOLD comment Strengthen LensInstanceKindWitness SCAFFOLD comment to call out that bare `DeclarationRef` for `kind_decl` is part of the SAME dissolution trigger as the deferred payload typing — substrate-level refinement-typing-on-DeclarationRef closes both the payload-typing gap and the kind-decl resolution gap in one move. Cites the analogous PatternRealization and MethodTemplateContract.dag_method patterns. Addresses non-blocking codex BLOCKING relay at sha fa5bba2 (Layer-2 diagnostic-kind witness leaving its core authority unconstrained) — shape unchanged per Director-locked option (c) on parent inbox #1130; just makes the bounded-scaffold receipt fully explicit on this row. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(v3): re-regen bootstrap on top of merged main Re-regenerate v3 bootstrap so Lens<C> + Q6.5 widening land on top of latest main after the merge conflict resolution. Refresh parse manifest. Carrier shape unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(v3): re-regen bootstrap on top of merged main (#1188 fix) Re-regenerate v3 bootstrap so Lens<C> + Q6.5 widening land on top of main after #1188 fixed the v2-extdeps regression. Refresh parse manifest. Carrier shape unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): minimal method-declaration registry + MethodRef refinement Closes the dag_method: DeclarationRef substrate gap from #1175 by landing the smallest structurally honest method-name registry and refining MethodTemplateContract.dag_method to typed MethodRef. Director-locked options A/A/(a) on parent inbox #1130. Substrate changes: - New dsl/std/methods.dag: MethodDeclaration { name: String } + 63 data <name>_method bindings (full union of unique names from the 7 dsl/std/algebra.dag per-profile template lists). - New src/v3/std/methods.dag: MethodRef { decl: DeclarationRef }. Lives in v3-space because dsl/std/ stays v3-spec-free per the existing layering convention. - src/v3/std/emit_model.dag: MethodTemplateContract.dag_method refined from bare DeclarationRef to MethodRef. - src/v3/compiler/src/bootstrap_regen_fresh.rs: dsl/std/methods.dag added to the v3 std-fixture allow-list. Acceptance: - src/v3/compiler/tests/integration/method_registry_test.rs: 4 structural claims — registry covers all 63 algebra-template names (drift-detection), MethodDeclaration identity-only, MethodTemplateContract.dag_method refines to MethodRef, MethodRef is single-field decl wrapper. - SG-0 ratchet receipt added with Director-acceptance citation. - parse_corpus_manifest.txt refreshed. Out of scope (Grounding-owned and follow-up): - Algebra template-row rewrite to import/reference the typed decls. - Grounding MethodTemplateContract row population. - MethodTranslation / SimpleMethodSpec retirement. - Refining decl: DeclarationRef to DeclarationRef<MethodDeclaration> (same trigger as PatternRealization / LensInstanceKindWitness). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * test(v3): tighten method-registry authority enforcement Per codex REQUEST_CHANGES at sha d6216b8: existence-by-name was behavioral rather than enforced. method_registry_covers_all_algebra_ template_names now verifies each <name>_method binding (1) has a TypeConnective::Instantiation pointing at MethodDeclaration, and (2) carries a Structural value_body with name = String literal matching the expected method name. The drift trigger named in the .dag file's documentation is now actually enforced fail-closed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: apply cargo fmt * WIP: tidy-wolf-507 * test(v3): registry drift derives names from algebra.dag source Per codex REQUEST_CHANGES at sha fdaaee5: hand-maintained EXPECTED_METHOD_NAMES could drift in lock-step with the registry, both staying out-of-sync with algebra.dag without failing the test. method_registry_covers_all_algebra_template_names now include_str!s `dsl/std/algebra.dag` and lexically extracts unique `name: "<id>"` literals from the per-profile template-list bodies (filtering for lowercase identifiers to skip type-shape names like `NamedTemplate { name: "Int" }`). algebra.dag is the actual authority — adding a new method name there without landing the registry binding now fails fail-closed at the same boundary the .dag SCAFFOLD comment promises. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ion) (#1207) * WIP: tidy-wolf-507 * WIP: tidy-wolf-507 * chore: apply cargo fmt * WIP: tidy-wolf-507 * chore: apply cargo fmt * WIP: tidy-wolf-507 * WIP: tidy-wolf-507 * fix(v3): SG-0 ratchet receipt + parse-corpus manifest refresh - Add method_template_contract_test.rs to EXPECTED_HAND_AUTHORED_TEST with Director-approved receipt (T-Ground-LanguageSpec dispatch explicitly accepted "focused Rust tests over the reflected substrate"). - Refresh parse_corpus_manifest.txt entry for src/v3/std/emit_model.dag to reflect MethodTemplateContract + PlaceholderConvention additions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * chore(v3): re-regen bootstrap on top of merged main Re-regenerate v3 bootstrap so MethodTemplateContract + PlaceholderConvention land on top of main after merging origin/main (carrier shape unchanged). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): T-Substrate-Lens-Primitive — Lens<C> carrier + Q6.5 widening First substrate slice for the lens framework (docs/design-lens-framework.md, docs/briefs/r2-substrate-manager.md). Director-locked option (c) on parent inbox #1130. Substrate changes: - New src/v3/std/lens.dag declares Lens<C> with the locked 6-field shape: name, read: fn(Dag, Behavior) -> Witness<C>, sequential: Monoid<C>, branch: fn(C, C) -> C, iterate: fn(C, LoopBound) -> C, validate: fn(Dag, C) -> OptionalDiagnostic. Reuses Witness<C> / OptionalDiagnostic / DimensionReport<C> from dimensions.dag and Monoid<C> from dsl/std/algebra.dag — no parallel reps introduced. - diagnostics.dag: Q6.5 two-layer authority. Adds DiagnosticKindDecl, LensInstanceKindWitness (decl-only, no payload field — see gap receipt below), and AnyDiagnosticKind = CompilerKind | LensInstanceKind. Widens Diagnostic.kind from CompilerDiagnosticKind to AnyDiagnosticKind. CompilerDiagnosticKind closed sum unchanged (anti-bridge invariant). Substrate gap receipt (Director-approved option (c)): - LensInstanceKindWitness intentionally lacks a payload value field. Today's .dag grammar cannot express `payload: <inhabits kind_decl.payload>` (refinement-type-on-sibling- field). The flat alternative ratifies the illegal-state Q6.5 rejected (Lens / name / payload-shape three independent coords). Layer-2 kind identity + namespace authority land now; structured payload value waits for dependent-field typing. Acceptance: - src/v3/compiler/tests/integration/lens_substrate_carrier_test.rs: Lens<C> 6-field shape, Diagnostic.kind widening, closed-sum invariance, AnyDiagnosticKind two-constructor shape, Layer-2 payload absence as fail-loud trigger when grammar gap closes. - SG-0 ratchet receipt added with Director acceptance citation. - parse_corpus_manifest.txt refreshed via refresh_handwritten_parse_snapshot_manifest -- --ignored. Out of scope (deferred to subsequent lanes): - Migration of cost.dag / complexity.dag / idempotency.dag / parallelism.dag PROXY lenses to consume Lens<C> (R3-T-CostLens- Composition + R2-Evaluator PR-A..E). - fold_lens<C> generic fold machinery (I2 in design doc). - User-authored lens TestClaim wiring (I7 in design doc). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * docs(v3): explicitly cover kind_decl resolution gap in SCAFFOLD comment Strengthen LensInstanceKindWitness SCAFFOLD comment to call out that bare `DeclarationRef` for `kind_decl` is part of the SAME dissolution trigger as the deferred payload typing — substrate-level refinement-typing-on-DeclarationRef closes both the payload-typing gap and the kind-decl resolution gap in one move. Cites the analogous PatternRealization and MethodTemplateContract.dag_method patterns. Addresses non-blocking codex BLOCKING relay at sha fa5bba2 (Layer-2 diagnostic-kind witness leaving its core authority unconstrained) — shape unchanged per Director-locked option (c) on parent inbox #1130; just makes the bounded-scaffold receipt fully explicit on this row. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(v3): re-regen bootstrap on top of merged main Re-regenerate v3 bootstrap so Lens<C> + Q6.5 widening land on top of latest main after the merge conflict resolution. Refresh parse manifest. Carrier shape unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(v3): re-regen bootstrap on top of merged main (#1188 fix) Re-regenerate v3 bootstrap so Lens<C> + Q6.5 widening land on top of main after #1188 fixed the v2-extdeps regression. Refresh parse manifest. Carrier shape unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): minimal method-declaration registry + MethodRef refinement Closes the dag_method: DeclarationRef substrate gap from #1175 by landing the smallest structurally honest method-name registry and refining MethodTemplateContract.dag_method to typed MethodRef. Director-locked options A/A/(a) on parent inbox #1130. Substrate changes: - New dsl/std/methods.dag: MethodDeclaration { name: String } + 63 data <name>_method bindings (full union of unique names from the 7 dsl/std/algebra.dag per-profile template lists). - New src/v3/std/methods.dag: MethodRef { decl: DeclarationRef }. Lives in v3-space because dsl/std/ stays v3-spec-free per the existing layering convention. - src/v3/std/emit_model.dag: MethodTemplateContract.dag_method refined from bare DeclarationRef to MethodRef. - src/v3/compiler/src/bootstrap_regen_fresh.rs: dsl/std/methods.dag added to the v3 std-fixture allow-list. Acceptance: - src/v3/compiler/tests/integration/method_registry_test.rs: 4 structural claims — registry covers all 63 algebra-template names (drift-detection), MethodDeclaration identity-only, MethodTemplateContract.dag_method refines to MethodRef, MethodRef is single-field decl wrapper. - SG-0 ratchet receipt added with Director-acceptance citation. - parse_corpus_manifest.txt refreshed. Out of scope (Grounding-owned and follow-up): - Algebra template-row rewrite to import/reference the typed decls. - Grounding MethodTemplateContract row population. - MethodTranslation / SimpleMethodSpec retirement. - Refining decl: DeclarationRef to DeclarationRef<MethodDeclaration> (same trigger as PatternRealization / LensInstanceKindWitness). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * test(v3): tighten method-registry authority enforcement Per codex REQUEST_CHANGES at sha d6216b8: existence-by-name was behavioral rather than enforced. method_registry_covers_all_algebra_ template_names now verifies each <name>_method binding (1) has a TypeConnective::Instantiation pointing at MethodDeclaration, and (2) carries a Structural value_body with name = String literal matching the expected method name. The drift trigger named in the .dag file's documentation is now actually enforced fail-closed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: apply cargo fmt * WIP: tidy-wolf-507 * test(v3): registry drift derives names from algebra.dag source Per codex REQUEST_CHANGES at sha fdaaee5: hand-maintained EXPECTED_METHOD_NAMES could drift in lock-step with the registry, both staying out-of-sync with algebra.dag without failing the test. method_registry_covers_all_algebra_template_names now include_str!s `dsl/std/algebra.dag` and lexically extracts unique `name: "<id>"` literals from the per-profile template-list bodies (filtering for lowercase identifiers to skip type-shape names like `NamedTemplate { name: "Int" }`). algebra.dag is the actual authority — adding a new method name there without landing the registry binding now fails fail-closed at the same boundary the .dag SCAFFOLD comment promises. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): lens-fold prerequisites audit Director-approved option C on parent inbox #1130 after the T-Substrate-Lens-Primitive complexity-lens migration slice STOP+PINGed on the class-5 / fn-block-body grammar gap. Prerequisite audit (no code; no substrate edits) names the exact lowering work needed before data complexity_lens: Lens<Int> = { ... } can lower honestly: - Prereq-1: port-carried field values in data record bodies (closes class-5 gap #3 port-carried branch). - Prereq-2: fn block-body lowering with variant-constructor expressions (closes class-5 gap #4 + block-body restriction). - Prereq-3: fold_lens<C> generic fold + workflow-root identification (depends on Prereq-1 + Prereq-2). Surfaces the workflow-root identification question Director flagged for the M2 semantic interpretation with three options (last topological Bind / last lane2_workflow Bind / last UserCallable Bind) and a recommendation. Cross-references the existing Dimension<SymbolicCost> data-binding deferral at cost.dag:260-302 which has the same blocker. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * docs(design): land Director dispositions on lens-fold prerequisites Director-accepted both #1207 decision points on parent inbox #1130 (2026-04-29): 1. Workflow-root identification = (α) last topological Bind, but only behind a named workflow_root_port(d: Dag) -> PortId helper/accessor. β rejected. γ remains a future refinement behind the same accessor. Cross-reference: workflow_root_port is shared authority for both fold_lens<C> and R2-Evaluator's runtime entry-point identification (Items 4+5 / #1176 §3.2). 2. Class-5 gap #4 strategy = infer-time re-resolution. No per-type special cases for Witness<C> / OptionalDiagnostic. Splits Prereq-3 into 3a (workflow_root_port accessor, ~1-2 days, standalone) and 3b (fold_lens<C> body, depends on Prereq-1 + Prereq-2 + 3a). 3a can land in parallel with Prereq-1 / Prereq-2 to unblock R2-Evaluator early. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): fail-closed WorkflowRoot return type for accessor Per BLOCKING review on PR #1207 at sha d34ca4a: a total workflow_root_port(d: Dag) -> PortId return drops the no-root and multi-entry cases. Refine the accessor's return type to a WorkflowRoot sum: type WorkflowRoot = SingleRoot(PortId) | NoRoot | AmbiguousRoot { candidates: List<PortId> } NoRoot and AmbiguousRoot are explicit fail-closed surfaces both consumers (fold_lens<C> and R2-Evaluator) handle without fabrication. Director's α / γ rules populate SingleRoot only when exactly one last-topological-Bind exists; partition is reusable across α and γ refinements. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): narrow Prereq-1 to Arrow-signature inhabitance Per BLOCKING review on PR #1207 sha d34ca4a: original framing was stale. Verified at lower.rs:3273-3565: lower_record_to_structural already handles nested Record/List/Map; lower_structural_field_value already resolves SurfaceExpr::Var/Path to FieldValue::Reference for DeclarationRef-typed and meta-tag-matching fields. The actual residual gap is narrower — Arrow-signature inhabitance for fn-typed fields like Lens<C>.read: fn(Dag, Behavior) -> Witness<C>. Prereq-1 sizing drops ~3-5 days → ~1-3 days. Total sequencing revised from ~11-17 days to ~9-15 days. Other prereqs unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): add Prereq-3a standalone acceptance for accessor Per BLOCKING review on PR #1207 sha 42bf818: Prereq-3a was allowed to land before 3b but only 3b had named acceptance, violating the reflected-facts invariant. Add four claims for Prereq-3a (single-Bind / zero-Bind / multi-Bind variant returns + R2-Evaluator cross-consumer proof) so the accessor has its own generated-consumer proof at the substrate-load boundary, independent of 3b's downstream fold correctness. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): resolve workflow-root contradiction in does-not-do list Per codex non-blocking finding on PR #1207 sha d34ca4a: the "does not commit to workflow-root interpretation" bullet contradicted the Director-locked α + accessor disposition added above. Strike the bullet and reference the locked disposition. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): fix stale -> PortId in Sub-slice 3a after WorkflowRoot refinement Per codex REQUEST_CHANGES on PR #1207 sha 8f48849: line 320 still said `workflow_root_port(d: Dag) -> PortId` while the rest of the doc had been updated to `-> WorkflowRoot` (the fail-closed sum from the earlier inline blocking review). Stale residue from the iterative refinements; fixed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…1217) * WIP: tidy-wolf-507 * WIP: tidy-wolf-507 * chore: apply cargo fmt * WIP: tidy-wolf-507 * chore: apply cargo fmt * WIP: tidy-wolf-507 * WIP: tidy-wolf-507 * fix(v3): SG-0 ratchet receipt + parse-corpus manifest refresh - Add method_template_contract_test.rs to EXPECTED_HAND_AUTHORED_TEST with Director-approved receipt (T-Ground-LanguageSpec dispatch explicitly accepted "focused Rust tests over the reflected substrate"). - Refresh parse_corpus_manifest.txt entry for src/v3/std/emit_model.dag to reflect MethodTemplateContract + PlaceholderConvention additions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * chore(v3): re-regen bootstrap on top of merged main Re-regenerate v3 bootstrap so MethodTemplateContract + PlaceholderConvention land on top of main after merging origin/main (carrier shape unchanged). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): T-Substrate-Lens-Primitive — Lens<C> carrier + Q6.5 widening First substrate slice for the lens framework (docs/design-lens-framework.md, docs/briefs/r2-substrate-manager.md). Director-locked option (c) on parent inbox #1130. Substrate changes: - New src/v3/std/lens.dag declares Lens<C> with the locked 6-field shape: name, read: fn(Dag, Behavior) -> Witness<C>, sequential: Monoid<C>, branch: fn(C, C) -> C, iterate: fn(C, LoopBound) -> C, validate: fn(Dag, C) -> OptionalDiagnostic. Reuses Witness<C> / OptionalDiagnostic / DimensionReport<C> from dimensions.dag and Monoid<C> from dsl/std/algebra.dag — no parallel reps introduced. - diagnostics.dag: Q6.5 two-layer authority. Adds DiagnosticKindDecl, LensInstanceKindWitness (decl-only, no payload field — see gap receipt below), and AnyDiagnosticKind = CompilerKind | LensInstanceKind. Widens Diagnostic.kind from CompilerDiagnosticKind to AnyDiagnosticKind. CompilerDiagnosticKind closed sum unchanged (anti-bridge invariant). Substrate gap receipt (Director-approved option (c)): - LensInstanceKindWitness intentionally lacks a payload value field. Today's .dag grammar cannot express `payload: <inhabits kind_decl.payload>` (refinement-type-on-sibling- field). The flat alternative ratifies the illegal-state Q6.5 rejected (Lens / name / payload-shape three independent coords). Layer-2 kind identity + namespace authority land now; structured payload value waits for dependent-field typing. Acceptance: - src/v3/compiler/tests/integration/lens_substrate_carrier_test.rs: Lens<C> 6-field shape, Diagnostic.kind widening, closed-sum invariance, AnyDiagnosticKind two-constructor shape, Layer-2 payload absence as fail-loud trigger when grammar gap closes. - SG-0 ratchet receipt added with Director acceptance citation. - parse_corpus_manifest.txt refreshed via refresh_handwritten_parse_snapshot_manifest -- --ignored. Out of scope (deferred to subsequent lanes): - Migration of cost.dag / complexity.dag / idempotency.dag / parallelism.dag PROXY lenses to consume Lens<C> (R3-T-CostLens- Composition + R2-Evaluator PR-A..E). - fold_lens<C> generic fold machinery (I2 in design doc). - User-authored lens TestClaim wiring (I7 in design doc). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * docs(v3): explicitly cover kind_decl resolution gap in SCAFFOLD comment Strengthen LensInstanceKindWitness SCAFFOLD comment to call out that bare `DeclarationRef` for `kind_decl` is part of the SAME dissolution trigger as the deferred payload typing — substrate-level refinement-typing-on-DeclarationRef closes both the payload-typing gap and the kind-decl resolution gap in one move. Cites the analogous PatternRealization and MethodTemplateContract.dag_method patterns. Addresses non-blocking codex BLOCKING relay at sha fa5bba2 (Layer-2 diagnostic-kind witness leaving its core authority unconstrained) — shape unchanged per Director-locked option (c) on parent inbox #1130; just makes the bounded-scaffold receipt fully explicit on this row. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(v3): re-regen bootstrap on top of merged main Re-regenerate v3 bootstrap so Lens<C> + Q6.5 widening land on top of latest main after the merge conflict resolution. Refresh parse manifest. Carrier shape unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(v3): re-regen bootstrap on top of merged main (#1188 fix) Re-regenerate v3 bootstrap so Lens<C> + Q6.5 widening land on top of main after #1188 fixed the v2-extdeps regression. Refresh parse manifest. Carrier shape unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): minimal method-declaration registry + MethodRef refinement Closes the dag_method: DeclarationRef substrate gap from #1175 by landing the smallest structurally honest method-name registry and refining MethodTemplateContract.dag_method to typed MethodRef. Director-locked options A/A/(a) on parent inbox #1130. Substrate changes: - New dsl/std/methods.dag: MethodDeclaration { name: String } + 63 data <name>_method bindings (full union of unique names from the 7 dsl/std/algebra.dag per-profile template lists). - New src/v3/std/methods.dag: MethodRef { decl: DeclarationRef }. Lives in v3-space because dsl/std/ stays v3-spec-free per the existing layering convention. - src/v3/std/emit_model.dag: MethodTemplateContract.dag_method refined from bare DeclarationRef to MethodRef. - src/v3/compiler/src/bootstrap_regen_fresh.rs: dsl/std/methods.dag added to the v3 std-fixture allow-list. Acceptance: - src/v3/compiler/tests/integration/method_registry_test.rs: 4 structural claims — registry covers all 63 algebra-template names (drift-detection), MethodDeclaration identity-only, MethodTemplateContract.dag_method refines to MethodRef, MethodRef is single-field decl wrapper. - SG-0 ratchet receipt added with Director-acceptance citation. - parse_corpus_manifest.txt refreshed. Out of scope (Grounding-owned and follow-up): - Algebra template-row rewrite to import/reference the typed decls. - Grounding MethodTemplateContract row population. - MethodTranslation / SimpleMethodSpec retirement. - Refining decl: DeclarationRef to DeclarationRef<MethodDeclaration> (same trigger as PatternRealization / LensInstanceKindWitness). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * test(v3): tighten method-registry authority enforcement Per codex REQUEST_CHANGES at sha d6216b8: existence-by-name was behavioral rather than enforced. method_registry_covers_all_algebra_ template_names now verifies each <name>_method binding (1) has a TypeConnective::Instantiation pointing at MethodDeclaration, and (2) carries a Structural value_body with name = String literal matching the expected method name. The drift trigger named in the .dag file's documentation is now actually enforced fail-closed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: apply cargo fmt * WIP: tidy-wolf-507 * test(v3): registry drift derives names from algebra.dag source Per codex REQUEST_CHANGES at sha fdaaee5: hand-maintained EXPECTED_METHOD_NAMES could drift in lock-step with the registry, both staying out-of-sync with algebra.dag without failing the test. method_registry_covers_all_algebra_template_names now include_str!s `dsl/std/algebra.dag` and lexically extracts unique `name: "<id>"` literals from the per-profile template-list bodies (filtering for lowercase identifiers to skip type-shape names like `NamedTemplate { name: "Int" }`). algebra.dag is the actual authority — adding a new method name there without landing the registry binding now fails fail-closed at the same boundary the .dag SCAFFOLD comment promises. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): lens-fold prerequisites audit Director-approved option C on parent inbox #1130 after the T-Substrate-Lens-Primitive complexity-lens migration slice STOP+PINGed on the class-5 / fn-block-body grammar gap. Prerequisite audit (no code; no substrate edits) names the exact lowering work needed before data complexity_lens: Lens<Int> = { ... } can lower honestly: - Prereq-1: port-carried field values in data record bodies (closes class-5 gap #3 port-carried branch). - Prereq-2: fn block-body lowering with variant-constructor expressions (closes class-5 gap #4 + block-body restriction). - Prereq-3: fold_lens<C> generic fold + workflow-root identification (depends on Prereq-1 + Prereq-2). Surfaces the workflow-root identification question Director flagged for the M2 semantic interpretation with three options (last topological Bind / last lane2_workflow Bind / last UserCallable Bind) and a recommendation. Cross-references the existing Dimension<SymbolicCost> data-binding deferral at cost.dag:260-302 which has the same blocker. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * docs(design): land Director dispositions on lens-fold prerequisites Director-accepted both #1207 decision points on parent inbox #1130 (2026-04-29): 1. Workflow-root identification = (α) last topological Bind, but only behind a named workflow_root_port(d: Dag) -> PortId helper/accessor. β rejected. γ remains a future refinement behind the same accessor. Cross-reference: workflow_root_port is shared authority for both fold_lens<C> and R2-Evaluator's runtime entry-point identification (Items 4+5 / #1176 §3.2). 2. Class-5 gap #4 strategy = infer-time re-resolution. No per-type special cases for Witness<C> / OptionalDiagnostic. Splits Prereq-3 into 3a (workflow_root_port accessor, ~1-2 days, standalone) and 3b (fold_lens<C> body, depends on Prereq-1 + Prereq-2 + 3a). 3a can land in parallel with Prereq-1 / Prereq-2 to unblock R2-Evaluator early. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): fail-closed WorkflowRoot return type for accessor Per BLOCKING review on PR #1207 at sha d34ca4a: a total workflow_root_port(d: Dag) -> PortId return drops the no-root and multi-entry cases. Refine the accessor's return type to a WorkflowRoot sum: type WorkflowRoot = SingleRoot(PortId) | NoRoot | AmbiguousRoot { candidates: List<PortId> } NoRoot and AmbiguousRoot are explicit fail-closed surfaces both consumers (fold_lens<C> and R2-Evaluator) handle without fabrication. Director's α / γ rules populate SingleRoot only when exactly one last-topological-Bind exists; partition is reusable across α and γ refinements. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): narrow Prereq-1 to Arrow-signature inhabitance Per BLOCKING review on PR #1207 sha d34ca4a: original framing was stale. Verified at lower.rs:3273-3565: lower_record_to_structural already handles nested Record/List/Map; lower_structural_field_value already resolves SurfaceExpr::Var/Path to FieldValue::Reference for DeclarationRef-typed and meta-tag-matching fields. The actual residual gap is narrower — Arrow-signature inhabitance for fn-typed fields like Lens<C>.read: fn(Dag, Behavior) -> Witness<C>. Prereq-1 sizing drops ~3-5 days → ~1-3 days. Total sequencing revised from ~11-17 days to ~9-15 days. Other prereqs unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): add Prereq-3a standalone acceptance for accessor Per BLOCKING review on PR #1207 sha 42bf818: Prereq-3a was allowed to land before 3b but only 3b had named acceptance, violating the reflected-facts invariant. Add four claims for Prereq-3a (single-Bind / zero-Bind / multi-Bind variant returns + R2-Evaluator cross-consumer proof) so the accessor has its own generated-consumer proof at the substrate-load boundary, independent of 3b's downstream fold correctness. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): resolve workflow-root contradiction in does-not-do list Per codex non-blocking finding on PR #1207 sha d34ca4a: the "does not commit to workflow-root interpretation" bullet contradicted the Director-locked α + accessor disposition added above. Strike the bullet and reference the locked disposition. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): fix stale -> PortId in Sub-slice 3a after WorkflowRoot refinement Per codex REQUEST_CHANGES on PR #1207 sha 8f48849: line 320 still said `workflow_root_port(d: Dag) -> PortId` while the rest of the doc had been updated to `-> WorkflowRoot` (the fail-closed sum from the earlier inline blocking review). Stale residue from the iterative refinements; fixed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): clarify AmbiguousRoot semantics under linear d.nodes Per codex non-blocking improvement on PR #1207 sha 96c9901: under α (last topological Bind) and Dag.nodes being a linear order, ambiguity cannot arise by construction. AmbiguousRoot is reserved for the γ refinement (last UserCallable Bind) where multiple Binds can tie. α acceptance for the claim is now vacuous-but-wired: a fixture where γ would tie still returns SingleRoot under α; the AmbiguousRoot exercise lands when γ wires. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): AmbiguousRoot reserved for enumerate-all rule, not α/γ Per BLOCKING review on PR #1217 sha f2f3128: γ is also "last X Bind" over linear Dag.nodes — same linearity property as α — so neither rule can produce a tie by construction. The previous deferral of AmbiguousRoot to γ left the fail-closed sum arm without a realizable acceptance path. Honest fix: AmbiguousRoot is reserved for a separate enumerate-all-eligible-entries rule that R2-Evaluator's evaluate(program, entry, args) needs for entry-name disambiguation across multi-entry programs (the runtime takes an entry-name arg precisely because of this case). That rule returns every UserCallable Bind's result_port as candidates; R2-Evaluator matches by entry name. Three concrete acceptance sub-claims now pin the realizable case. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…1232) * WIP: tidy-wolf-507 * WIP: tidy-wolf-507 * chore: apply cargo fmt * WIP: tidy-wolf-507 * chore: apply cargo fmt * WIP: tidy-wolf-507 * WIP: tidy-wolf-507 * fix(v3): SG-0 ratchet receipt + parse-corpus manifest refresh - Add method_template_contract_test.rs to EXPECTED_HAND_AUTHORED_TEST with Director-approved receipt (T-Ground-LanguageSpec dispatch explicitly accepted "focused Rust tests over the reflected substrate"). - Refresh parse_corpus_manifest.txt entry for src/v3/std/emit_model.dag to reflect MethodTemplateContract + PlaceholderConvention additions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * chore(v3): re-regen bootstrap on top of merged main Re-regenerate v3 bootstrap so MethodTemplateContract + PlaceholderConvention land on top of main after merging origin/main (carrier shape unchanged). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): T-Substrate-Lens-Primitive — Lens<C> carrier + Q6.5 widening First substrate slice for the lens framework (docs/design-lens-framework.md, docs/briefs/r2-substrate-manager.md). Director-locked option (c) on parent inbox #1130. Substrate changes: - New src/v3/std/lens.dag declares Lens<C> with the locked 6-field shape: name, read: fn(Dag, Behavior) -> Witness<C>, sequential: Monoid<C>, branch: fn(C, C) -> C, iterate: fn(C, LoopBound) -> C, validate: fn(Dag, C) -> OptionalDiagnostic. Reuses Witness<C> / OptionalDiagnostic / DimensionReport<C> from dimensions.dag and Monoid<C> from dsl/std/algebra.dag — no parallel reps introduced. - diagnostics.dag: Q6.5 two-layer authority. Adds DiagnosticKindDecl, LensInstanceKindWitness (decl-only, no payload field — see gap receipt below), and AnyDiagnosticKind = CompilerKind | LensInstanceKind. Widens Diagnostic.kind from CompilerDiagnosticKind to AnyDiagnosticKind. CompilerDiagnosticKind closed sum unchanged (anti-bridge invariant). Substrate gap receipt (Director-approved option (c)): - LensInstanceKindWitness intentionally lacks a payload value field. Today's .dag grammar cannot express `payload: <inhabits kind_decl.payload>` (refinement-type-on-sibling- field). The flat alternative ratifies the illegal-state Q6.5 rejected (Lens / name / payload-shape three independent coords). Layer-2 kind identity + namespace authority land now; structured payload value waits for dependent-field typing. Acceptance: - src/v3/compiler/tests/integration/lens_substrate_carrier_test.rs: Lens<C> 6-field shape, Diagnostic.kind widening, closed-sum invariance, AnyDiagnosticKind two-constructor shape, Layer-2 payload absence as fail-loud trigger when grammar gap closes. - SG-0 ratchet receipt added with Director acceptance citation. - parse_corpus_manifest.txt refreshed via refresh_handwritten_parse_snapshot_manifest -- --ignored. Out of scope (deferred to subsequent lanes): - Migration of cost.dag / complexity.dag / idempotency.dag / parallelism.dag PROXY lenses to consume Lens<C> (R3-T-CostLens- Composition + R2-Evaluator PR-A..E). - fold_lens<C> generic fold machinery (I2 in design doc). - User-authored lens TestClaim wiring (I7 in design doc). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * docs(v3): explicitly cover kind_decl resolution gap in SCAFFOLD comment Strengthen LensInstanceKindWitness SCAFFOLD comment to call out that bare `DeclarationRef` for `kind_decl` is part of the SAME dissolution trigger as the deferred payload typing — substrate-level refinement-typing-on-DeclarationRef closes both the payload-typing gap and the kind-decl resolution gap in one move. Cites the analogous PatternRealization and MethodTemplateContract.dag_method patterns. Addresses non-blocking codex BLOCKING relay at sha fa5bba2 (Layer-2 diagnostic-kind witness leaving its core authority unconstrained) — shape unchanged per Director-locked option (c) on parent inbox #1130; just makes the bounded-scaffold receipt fully explicit on this row. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(v3): re-regen bootstrap on top of merged main Re-regenerate v3 bootstrap so Lens<C> + Q6.5 widening land on top of latest main after the merge conflict resolution. Refresh parse manifest. Carrier shape unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(v3): re-regen bootstrap on top of merged main (#1188 fix) Re-regenerate v3 bootstrap so Lens<C> + Q6.5 widening land on top of main after #1188 fixed the v2-extdeps regression. Refresh parse manifest. Carrier shape unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): minimal method-declaration registry + MethodRef refinement Closes the dag_method: DeclarationRef substrate gap from #1175 by landing the smallest structurally honest method-name registry and refining MethodTemplateContract.dag_method to typed MethodRef. Director-locked options A/A/(a) on parent inbox #1130. Substrate changes: - New dsl/std/methods.dag: MethodDeclaration { name: String } + 63 data <name>_method bindings (full union of unique names from the 7 dsl/std/algebra.dag per-profile template lists). - New src/v3/std/methods.dag: MethodRef { decl: DeclarationRef }. Lives in v3-space because dsl/std/ stays v3-spec-free per the existing layering convention. - src/v3/std/emit_model.dag: MethodTemplateContract.dag_method refined from bare DeclarationRef to MethodRef. - src/v3/compiler/src/bootstrap_regen_fresh.rs: dsl/std/methods.dag added to the v3 std-fixture allow-list. Acceptance: - src/v3/compiler/tests/integration/method_registry_test.rs: 4 structural claims — registry covers all 63 algebra-template names (drift-detection), MethodDeclaration identity-only, MethodTemplateContract.dag_method refines to MethodRef, MethodRef is single-field decl wrapper. - SG-0 ratchet receipt added with Director-acceptance citation. - parse_corpus_manifest.txt refreshed. Out of scope (Grounding-owned and follow-up): - Algebra template-row rewrite to import/reference the typed decls. - Grounding MethodTemplateContract row population. - MethodTranslation / SimpleMethodSpec retirement. - Refining decl: DeclarationRef to DeclarationRef<MethodDeclaration> (same trigger as PatternRealization / LensInstanceKindWitness). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * test(v3): tighten method-registry authority enforcement Per codex REQUEST_CHANGES at sha d6216b8: existence-by-name was behavioral rather than enforced. method_registry_covers_all_algebra_ template_names now verifies each <name>_method binding (1) has a TypeConnective::Instantiation pointing at MethodDeclaration, and (2) carries a Structural value_body with name = String literal matching the expected method name. The drift trigger named in the .dag file's documentation is now actually enforced fail-closed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: apply cargo fmt * WIP: tidy-wolf-507 * test(v3): registry drift derives names from algebra.dag source Per codex REQUEST_CHANGES at sha fdaaee5: hand-maintained EXPECTED_METHOD_NAMES could drift in lock-step with the registry, both staying out-of-sync with algebra.dag without failing the test. method_registry_covers_all_algebra_template_names now include_str!s `dsl/std/algebra.dag` and lexically extracts unique `name: "<id>"` literals from the per-profile template-list bodies (filtering for lowercase identifiers to skip type-shape names like `NamedTemplate { name: "Int" }`). algebra.dag is the actual authority — adding a new method name there without landing the registry binding now fails fail-closed at the same boundary the .dag SCAFFOLD comment promises. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): lens-fold prerequisites audit Director-approved option C on parent inbox #1130 after the T-Substrate-Lens-Primitive complexity-lens migration slice STOP+PINGed on the class-5 / fn-block-body grammar gap. Prerequisite audit (no code; no substrate edits) names the exact lowering work needed before data complexity_lens: Lens<Int> = { ... } can lower honestly: - Prereq-1: port-carried field values in data record bodies (closes class-5 gap #3 port-carried branch). - Prereq-2: fn block-body lowering with variant-constructor expressions (closes class-5 gap #4 + block-body restriction). - Prereq-3: fold_lens<C> generic fold + workflow-root identification (depends on Prereq-1 + Prereq-2). Surfaces the workflow-root identification question Director flagged for the M2 semantic interpretation with three options (last topological Bind / last lane2_workflow Bind / last UserCallable Bind) and a recommendation. Cross-references the existing Dimension<SymbolicCost> data-binding deferral at cost.dag:260-302 which has the same blocker. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * docs(design): land Director dispositions on lens-fold prerequisites Director-accepted both #1207 decision points on parent inbox #1130 (2026-04-29): 1. Workflow-root identification = (α) last topological Bind, but only behind a named workflow_root_port(d: Dag) -> PortId helper/accessor. β rejected. γ remains a future refinement behind the same accessor. Cross-reference: workflow_root_port is shared authority for both fold_lens<C> and R2-Evaluator's runtime entry-point identification (Items 4+5 / #1176 §3.2). 2. Class-5 gap #4 strategy = infer-time re-resolution. No per-type special cases for Witness<C> / OptionalDiagnostic. Splits Prereq-3 into 3a (workflow_root_port accessor, ~1-2 days, standalone) and 3b (fold_lens<C> body, depends on Prereq-1 + Prereq-2 + 3a). 3a can land in parallel with Prereq-1 / Prereq-2 to unblock R2-Evaluator early. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): fail-closed WorkflowRoot return type for accessor Per BLOCKING review on PR #1207 at sha d34ca4a: a total workflow_root_port(d: Dag) -> PortId return drops the no-root and multi-entry cases. Refine the accessor's return type to a WorkflowRoot sum: type WorkflowRoot = SingleRoot(PortId) | NoRoot | AmbiguousRoot { candidates: List<PortId> } NoRoot and AmbiguousRoot are explicit fail-closed surfaces both consumers (fold_lens<C> and R2-Evaluator) handle without fabrication. Director's α / γ rules populate SingleRoot only when exactly one last-topological-Bind exists; partition is reusable across α and γ refinements. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): narrow Prereq-1 to Arrow-signature inhabitance Per BLOCKING review on PR #1207 sha d34ca4a: original framing was stale. Verified at lower.rs:3273-3565: lower_record_to_structural already handles nested Record/List/Map; lower_structural_field_value already resolves SurfaceExpr::Var/Path to FieldValue::Reference for DeclarationRef-typed and meta-tag-matching fields. The actual residual gap is narrower — Arrow-signature inhabitance for fn-typed fields like Lens<C>.read: fn(Dag, Behavior) -> Witness<C>. Prereq-1 sizing drops ~3-5 days → ~1-3 days. Total sequencing revised from ~11-17 days to ~9-15 days. Other prereqs unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): add Prereq-3a standalone acceptance for accessor Per BLOCKING review on PR #1207 sha 42bf818: Prereq-3a was allowed to land before 3b but only 3b had named acceptance, violating the reflected-facts invariant. Add four claims for Prereq-3a (single-Bind / zero-Bind / multi-Bind variant returns + R2-Evaluator cross-consumer proof) so the accessor has its own generated-consumer proof at the substrate-load boundary, independent of 3b's downstream fold correctness. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): resolve workflow-root contradiction in does-not-do list Per codex non-blocking finding on PR #1207 sha d34ca4a: the "does not commit to workflow-root interpretation" bullet contradicted the Director-locked α + accessor disposition added above. Strike the bullet and reference the locked disposition. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): fix stale -> PortId in Sub-slice 3a after WorkflowRoot refinement Per codex REQUEST_CHANGES on PR #1207 sha 8f48849: line 320 still said `workflow_root_port(d: Dag) -> PortId` while the rest of the doc had been updated to `-> WorkflowRoot` (the fail-closed sum from the earlier inline blocking review). Stale residue from the iterative refinements; fixed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): clarify AmbiguousRoot semantics under linear d.nodes Per codex non-blocking improvement on PR #1207 sha 96c9901: under α (last topological Bind) and Dag.nodes being a linear order, ambiguity cannot arise by construction. AmbiguousRoot is reserved for the γ refinement (last UserCallable Bind) where multiple Binds can tie. α acceptance for the claim is now vacuous-but-wired: a fixture where γ would tie still returns SingleRoot under α; the AmbiguousRoot exercise lands when γ wires. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): AmbiguousRoot reserved for enumerate-all rule, not α/γ Per BLOCKING review on PR #1217 sha f2f3128: γ is also "last X Bind" over linear Dag.nodes — same linearity property as α — so neither rule can produce a tie by construction. The previous deferral of AmbiguousRoot to γ left the fail-closed sum arm without a realizable acceptance path. Honest fix: AmbiguousRoot is reserved for a separate enumerate-all-eligible-entries rule that R2-Evaluator's evaluate(program, entry, args) needs for entry-name disambiguation across multi-entry programs (the runtime takes an entry-name arg precisely because of this case). That rule returns every UserCallable Bind's result_port as candidates; R2-Evaluator matches by entry name. Three concrete acceptance sub-claims now pin the realizable case. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): workflow_root_port accessor + WorkflowRoot sum (Prereq-3a) First substrate slice from the merged audit at docs/design-lens-fold-prerequisites.md. Implements the Director-locked α rule (last topological Bind) behind a fail-closed WorkflowRoot accessor that fold_lens<C> and R2-Evaluator share. Substrate changes: - src/v3/std/substrate.dag: declare WorkflowRoot sum (SingleRoot(PortId) | NoRoot | AmbiguousRoot { candidates }) plus fn workflow_root_port(d: Dag) -> WorkflowRoot { host workflow_root_port }. AmbiguousRoot is reserved for the future enumerate-all-eligible- entries rule (multi-entry programs / R2-Evaluator entry-name disambiguation per Items 4+5 / #1176 §3.2); α is a single-pick rule over linear d.nodes and never emits AmbiguousRoot. - src/v3/compiler/src/dag.rs: WorkflowRoot Rust enum mirror + Dag::workflow_root_port α impl (walks d.nodes backward, returns SingleRoot at the first Behavior::Bind, NoRoot when none). Acceptance: - src/v3/compiler/tests/integration/workflow_root_port_test.rs: three integration claims via real compile_to_dag fixtures — single-Bind / multi-Bind-under-α / unreachable-AmbiguousRoot drift trigger. - src/v3/compiler/src/dag.rs#tests::workflow_root_zero_bind_returns_no_root: unit test for the defensive NoRoot arm via crate-private Dag::empty (v3 surface always lowers ≥1 Bind, so the case is unreachable from compile_to_dag fixtures but real at the substrate boundary). - SG-0 ratchet receipt + parse_corpus_manifest refresh. Out of scope (Prereq-3b and beyond): - fold_lens<C> generic fold machinery. - Lens<C> instance authoring (data complexity_lens). - R2-Evaluator entry-point integration (the runtime cross-consumer). - γ refinement / enumerate-all rule. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: apply cargo fmt * docs(v3): fix SingleRoot comment to match α multi-Bind behavior Per manager review on PR #1232: the .dag SingleRoot comment said "exactly one workflow-root Bind exists" which contradicted the Director-locked α semantics (multiple Binds are not ambiguous — α just picks the last). Match the comment to the Rust impl: α emits SingleRoot whenever the Dag contains at least one Bind. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * fix(v3): WorkflowRoot NonSingletonList + Rust scaffold receipt Per codex BLOCKING review on PR #1232 sha ed8997c: 1. AmbiguousRoot.candidates → NonSingletonList<PortId> on both surfaces (substrate.dag + Rust mirror). Empty/singleton candidate sets are now structurally unrepresentable; ambiguity by definition requires ≥2 candidates. 2. Rust pub enum WorkflowRoot now carries the full 🟡 SCAFFOLD receipt mirroring the .dag — three-arm partition + named dissolution trigger (γ refinement / enumerate-all rule reuse the same partition behind the workflow_root_port accessor). Also refresh parse manifest + module header in workflow_root_port_test.rs (corrected the "three claims" list to match the actual integration tests; zero-Bind unit test lives in dag.rs#tests). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(v3): re-regen bootstrap on top of merged main Re-regenerate v3 bootstrap so WorkflowRoot + workflow_root_port land on top of latest main. Refresh parse manifest. Carrier shape unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(v3): explicit BOUNDED STAGING SCAFFOLD receipt on workflow_root_port Per codex REQUEST_CHANGES on PR #1232 sha 628910c: name the realization-side staging explicitly with a bounded scaffold receipt naming the first-emitter-consumer trigger. The accessor declaration + Rust impl + Rust-side consumer tests land in Prereq-3a (this PR); the per-target SubstrateAccessorBinding lands atomically with the first .dag consumer (Prereq-3b fold_lens<C> is planned first), same staging discipline as lane2_workflow_at. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): land Rust SubstrateAccessorBinding for workflow_root_port Per codex BLOCKING on PR #1232 sha 8bb6dc7: the prior bounded-staging receipt was correct that Python/Go bindings stage, but wrong about the Rust binding being optional in this slice. Without ANY binding the accessor is not in substrate_accessor_universe, so a .dag consumer falls through to plain callable dispatch — not fail-closed. Add rust_workflow_root_port_accessor (carrier "({p0}).workflow_root_port()") and workflow_root_port_binding_rust to src/v3/spec/rust.dag, matching the lane2_workflow_at precedent. The accessor is now in substrate_accessor_universe; any .dag consumer lowers correctly under Rust target. Python/Go bindings remain staged for when those targets emit consumers (per BOUNDED STAGING receipt update on the substrate.dag accessor). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(v3): bump substrate-accessor binding count to 6 for workflow_root_port substrate_accessor_rust_binding_invariants asserts an exact count of Rust bindings; bumping to 6 (was 5) for the new workflow_root_port_binding_rust added at PR #1232. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): add rust_workflow_root TypeRealization Per codex BLOCKING on PR #1232 sha 4ed2a8e: the WorkflowRoot substrate sum was added without registering its Rust TypeRealization. Generated Rust matches over WorkflowRoot need the carrier mapping so the substrate sum identity flows through emission rather than rendering through a free name. Adds data rust_workflow_root: TypeRealization { language: rust_language, target: WorkflowRoot, carrier: "WorkflowRoot", is_copy: false, fields: [], cost: 1 } following the rust_behavior precedent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * WIP: tidy-wolf-507 --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* WIP: tidy-wolf-507 * WIP: tidy-wolf-507 * chore: apply cargo fmt * WIP: tidy-wolf-507 * chore: apply cargo fmt * WIP: tidy-wolf-507 * WIP: tidy-wolf-507 * fix(v3): SG-0 ratchet receipt + parse-corpus manifest refresh - Add method_template_contract_test.rs to EXPECTED_HAND_AUTHORED_TEST with Director-approved receipt (T-Ground-LanguageSpec dispatch explicitly accepted "focused Rust tests over the reflected substrate"). - Refresh parse_corpus_manifest.txt entry for src/v3/std/emit_model.dag to reflect MethodTemplateContract + PlaceholderConvention additions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * chore(v3): re-regen bootstrap on top of merged main Re-regenerate v3 bootstrap so MethodTemplateContract + PlaceholderConvention land on top of main after merging origin/main (carrier shape unchanged). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): T-Substrate-Lens-Primitive — Lens<C> carrier + Q6.5 widening First substrate slice for the lens framework (docs/design-lens-framework.md, docs/briefs/r2-substrate-manager.md). Director-locked option (c) on parent inbox #1130. Substrate changes: - New src/v3/std/lens.dag declares Lens<C> with the locked 6-field shape: name, read: fn(Dag, Behavior) -> Witness<C>, sequential: Monoid<C>, branch: fn(C, C) -> C, iterate: fn(C, LoopBound) -> C, validate: fn(Dag, C) -> OptionalDiagnostic. Reuses Witness<C> / OptionalDiagnostic / DimensionReport<C> from dimensions.dag and Monoid<C> from dsl/std/algebra.dag — no parallel reps introduced. - diagnostics.dag: Q6.5 two-layer authority. Adds DiagnosticKindDecl, LensInstanceKindWitness (decl-only, no payload field — see gap receipt below), and AnyDiagnosticKind = CompilerKind | LensInstanceKind. Widens Diagnostic.kind from CompilerDiagnosticKind to AnyDiagnosticKind. CompilerDiagnosticKind closed sum unchanged (anti-bridge invariant). Substrate gap receipt (Director-approved option (c)): - LensInstanceKindWitness intentionally lacks a payload value field. Today's .dag grammar cannot express `payload: <inhabits kind_decl.payload>` (refinement-type-on-sibling- field). The flat alternative ratifies the illegal-state Q6.5 rejected (Lens / name / payload-shape three independent coords). Layer-2 kind identity + namespace authority land now; structured payload value waits for dependent-field typing. Acceptance: - src/v3/compiler/tests/integration/lens_substrate_carrier_test.rs: Lens<C> 6-field shape, Diagnostic.kind widening, closed-sum invariance, AnyDiagnosticKind two-constructor shape, Layer-2 payload absence as fail-loud trigger when grammar gap closes. - SG-0 ratchet receipt added with Director acceptance citation. - parse_corpus_manifest.txt refreshed via refresh_handwritten_parse_snapshot_manifest -- --ignored. Out of scope (deferred to subsequent lanes): - Migration of cost.dag / complexity.dag / idempotency.dag / parallelism.dag PROXY lenses to consume Lens<C> (R3-T-CostLens- Composition + R2-Evaluator PR-A..E). - fold_lens<C> generic fold machinery (I2 in design doc). - User-authored lens TestClaim wiring (I7 in design doc). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * docs(v3): explicitly cover kind_decl resolution gap in SCAFFOLD comment Strengthen LensInstanceKindWitness SCAFFOLD comment to call out that bare `DeclarationRef` for `kind_decl` is part of the SAME dissolution trigger as the deferred payload typing — substrate-level refinement-typing-on-DeclarationRef closes both the payload-typing gap and the kind-decl resolution gap in one move. Cites the analogous PatternRealization and MethodTemplateContract.dag_method patterns. Addresses non-blocking codex BLOCKING relay at sha fa5bba2 (Layer-2 diagnostic-kind witness leaving its core authority unconstrained) — shape unchanged per Director-locked option (c) on parent inbox #1130; just makes the bounded-scaffold receipt fully explicit on this row. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(v3): re-regen bootstrap on top of merged main Re-regenerate v3 bootstrap so Lens<C> + Q6.5 widening land on top of latest main after the merge conflict resolution. Refresh parse manifest. Carrier shape unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(v3): re-regen bootstrap on top of merged main (#1188 fix) Re-regenerate v3 bootstrap so Lens<C> + Q6.5 widening land on top of main after #1188 fixed the v2-extdeps regression. Refresh parse manifest. Carrier shape unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): minimal method-declaration registry + MethodRef refinement Closes the dag_method: DeclarationRef substrate gap from #1175 by landing the smallest structurally honest method-name registry and refining MethodTemplateContract.dag_method to typed MethodRef. Director-locked options A/A/(a) on parent inbox #1130. Substrate changes: - New dsl/std/methods.dag: MethodDeclaration { name: String } + 63 data <name>_method bindings (full union of unique names from the 7 dsl/std/algebra.dag per-profile template lists). - New src/v3/std/methods.dag: MethodRef { decl: DeclarationRef }. Lives in v3-space because dsl/std/ stays v3-spec-free per the existing layering convention. - src/v3/std/emit_model.dag: MethodTemplateContract.dag_method refined from bare DeclarationRef to MethodRef. - src/v3/compiler/src/bootstrap_regen_fresh.rs: dsl/std/methods.dag added to the v3 std-fixture allow-list. Acceptance: - src/v3/compiler/tests/integration/method_registry_test.rs: 4 structural claims — registry covers all 63 algebra-template names (drift-detection), MethodDeclaration identity-only, MethodTemplateContract.dag_method refines to MethodRef, MethodRef is single-field decl wrapper. - SG-0 ratchet receipt added with Director-acceptance citation. - parse_corpus_manifest.txt refreshed. Out of scope (Grounding-owned and follow-up): - Algebra template-row rewrite to import/reference the typed decls. - Grounding MethodTemplateContract row population. - MethodTranslation / SimpleMethodSpec retirement. - Refining decl: DeclarationRef to DeclarationRef<MethodDeclaration> (same trigger as PatternRealization / LensInstanceKindWitness). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * test(v3): tighten method-registry authority enforcement Per codex REQUEST_CHANGES at sha d6216b8: existence-by-name was behavioral rather than enforced. method_registry_covers_all_algebra_ template_names now verifies each <name>_method binding (1) has a TypeConnective::Instantiation pointing at MethodDeclaration, and (2) carries a Structural value_body with name = String literal matching the expected method name. The drift trigger named in the .dag file's documentation is now actually enforced fail-closed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: apply cargo fmt * WIP: tidy-wolf-507 * test(v3): registry drift derives names from algebra.dag source Per codex REQUEST_CHANGES at sha fdaaee5: hand-maintained EXPECTED_METHOD_NAMES could drift in lock-step with the registry, both staying out-of-sync with algebra.dag without failing the test. method_registry_covers_all_algebra_template_names now include_str!s `dsl/std/algebra.dag` and lexically extracts unique `name: "<id>"` literals from the per-profile template-list bodies (filtering for lowercase identifiers to skip type-shape names like `NamedTemplate { name: "Int" }`). algebra.dag is the actual authority — adding a new method name there without landing the registry binding now fails fail-closed at the same boundary the .dag SCAFFOLD comment promises. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): lens-fold prerequisites audit Director-approved option C on parent inbox #1130 after the T-Substrate-Lens-Primitive complexity-lens migration slice STOP+PINGed on the class-5 / fn-block-body grammar gap. Prerequisite audit (no code; no substrate edits) names the exact lowering work needed before data complexity_lens: Lens<Int> = { ... } can lower honestly: - Prereq-1: port-carried field values in data record bodies (closes class-5 gap #3 port-carried branch). - Prereq-2: fn block-body lowering with variant-constructor expressions (closes class-5 gap #4 + block-body restriction). - Prereq-3: fold_lens<C> generic fold + workflow-root identification (depends on Prereq-1 + Prereq-2). Surfaces the workflow-root identification question Director flagged for the M2 semantic interpretation with three options (last topological Bind / last lane2_workflow Bind / last UserCallable Bind) and a recommendation. Cross-references the existing Dimension<SymbolicCost> data-binding deferral at cost.dag:260-302 which has the same blocker. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * docs(design): land Director dispositions on lens-fold prerequisites Director-accepted both #1207 decision points on parent inbox #1130 (2026-04-29): 1. Workflow-root identification = (α) last topological Bind, but only behind a named workflow_root_port(d: Dag) -> PortId helper/accessor. β rejected. γ remains a future refinement behind the same accessor. Cross-reference: workflow_root_port is shared authority for both fold_lens<C> and R2-Evaluator's runtime entry-point identification (Items 4+5 / #1176 §3.2). 2. Class-5 gap #4 strategy = infer-time re-resolution. No per-type special cases for Witness<C> / OptionalDiagnostic. Splits Prereq-3 into 3a (workflow_root_port accessor, ~1-2 days, standalone) and 3b (fold_lens<C> body, depends on Prereq-1 + Prereq-2 + 3a). 3a can land in parallel with Prereq-1 / Prereq-2 to unblock R2-Evaluator early. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): fail-closed WorkflowRoot return type for accessor Per BLOCKING review on PR #1207 at sha d34ca4a: a total workflow_root_port(d: Dag) -> PortId return drops the no-root and multi-entry cases. Refine the accessor's return type to a WorkflowRoot sum: type WorkflowRoot = SingleRoot(PortId) | NoRoot | AmbiguousRoot { candidates: List<PortId> } NoRoot and AmbiguousRoot are explicit fail-closed surfaces both consumers (fold_lens<C> and R2-Evaluator) handle without fabrication. Director's α / γ rules populate SingleRoot only when exactly one last-topological-Bind exists; partition is reusable across α and γ refinements. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): narrow Prereq-1 to Arrow-signature inhabitance Per BLOCKING review on PR #1207 sha d34ca4a: original framing was stale. Verified at lower.rs:3273-3565: lower_record_to_structural already handles nested Record/List/Map; lower_structural_field_value already resolves SurfaceExpr::Var/Path to FieldValue::Reference for DeclarationRef-typed and meta-tag-matching fields. The actual residual gap is narrower — Arrow-signature inhabitance for fn-typed fields like Lens<C>.read: fn(Dag, Behavior) -> Witness<C>. Prereq-1 sizing drops ~3-5 days → ~1-3 days. Total sequencing revised from ~11-17 days to ~9-15 days. Other prereqs unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): add Prereq-3a standalone acceptance for accessor Per BLOCKING review on PR #1207 sha 42bf818: Prereq-3a was allowed to land before 3b but only 3b had named acceptance, violating the reflected-facts invariant. Add four claims for Prereq-3a (single-Bind / zero-Bind / multi-Bind variant returns + R2-Evaluator cross-consumer proof) so the accessor has its own generated-consumer proof at the substrate-load boundary, independent of 3b's downstream fold correctness. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): resolve workflow-root contradiction in does-not-do list Per codex non-blocking finding on PR #1207 sha d34ca4a: the "does not commit to workflow-root interpretation" bullet contradicted the Director-locked α + accessor disposition added above. Strike the bullet and reference the locked disposition. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): fix stale -> PortId in Sub-slice 3a after WorkflowRoot refinement Per codex REQUEST_CHANGES on PR #1207 sha 8f48849: line 320 still said `workflow_root_port(d: Dag) -> PortId` while the rest of the doc had been updated to `-> WorkflowRoot` (the fail-closed sum from the earlier inline blocking review). Stale residue from the iterative refinements; fixed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): clarify AmbiguousRoot semantics under linear d.nodes Per codex non-blocking improvement on PR #1207 sha 96c9901: under α (last topological Bind) and Dag.nodes being a linear order, ambiguity cannot arise by construction. AmbiguousRoot is reserved for the γ refinement (last UserCallable Bind) where multiple Binds can tie. α acceptance for the claim is now vacuous-but-wired: a fixture where γ would tie still returns SingleRoot under α; the AmbiguousRoot exercise lands when γ wires. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): AmbiguousRoot reserved for enumerate-all rule, not α/γ Per BLOCKING review on PR #1217 sha f2f3128: γ is also "last X Bind" over linear Dag.nodes — same linearity property as α — so neither rule can produce a tie by construction. The previous deferral of AmbiguousRoot to γ left the fail-closed sum arm without a realizable acceptance path. Honest fix: AmbiguousRoot is reserved for a separate enumerate-all-eligible-entries rule that R2-Evaluator's evaluate(program, entry, args) needs for entry-name disambiguation across multi-entry programs (the runtime takes an entry-name arg precisely because of this case). That rule returns every UserCallable Bind's result_port as candidates; R2-Evaluator matches by entry name. Three concrete acceptance sub-claims now pin the realizable case. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): workflow_root_port accessor + WorkflowRoot sum (Prereq-3a) First substrate slice from the merged audit at docs/design-lens-fold-prerequisites.md. Implements the Director-locked α rule (last topological Bind) behind a fail-closed WorkflowRoot accessor that fold_lens<C> and R2-Evaluator share. Substrate changes: - src/v3/std/substrate.dag: declare WorkflowRoot sum (SingleRoot(PortId) | NoRoot | AmbiguousRoot { candidates }) plus fn workflow_root_port(d: Dag) -> WorkflowRoot { host workflow_root_port }. AmbiguousRoot is reserved for the future enumerate-all-eligible- entries rule (multi-entry programs / R2-Evaluator entry-name disambiguation per Items 4+5 / #1176 §3.2); α is a single-pick rule over linear d.nodes and never emits AmbiguousRoot. - src/v3/compiler/src/dag.rs: WorkflowRoot Rust enum mirror + Dag::workflow_root_port α impl (walks d.nodes backward, returns SingleRoot at the first Behavior::Bind, NoRoot when none). Acceptance: - src/v3/compiler/tests/integration/workflow_root_port_test.rs: three integration claims via real compile_to_dag fixtures — single-Bind / multi-Bind-under-α / unreachable-AmbiguousRoot drift trigger. - src/v3/compiler/src/dag.rs#tests::workflow_root_zero_bind_returns_no_root: unit test for the defensive NoRoot arm via crate-private Dag::empty (v3 surface always lowers ≥1 Bind, so the case is unreachable from compile_to_dag fixtures but real at the substrate boundary). - SG-0 ratchet receipt + parse_corpus_manifest refresh. Out of scope (Prereq-3b and beyond): - fold_lens<C> generic fold machinery. - Lens<C> instance authoring (data complexity_lens). - R2-Evaluator entry-point integration (the runtime cross-consumer). - γ refinement / enumerate-all rule. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: apply cargo fmt * docs(v3): fix SingleRoot comment to match α multi-Bind behavior Per manager review on PR #1232: the .dag SingleRoot comment said "exactly one workflow-root Bind exists" which contradicted the Director-locked α semantics (multiple Binds are not ambiguous — α just picks the last). Match the comment to the Rust impl: α emits SingleRoot whenever the Dag contains at least one Bind. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * fix(v3): WorkflowRoot NonSingletonList + Rust scaffold receipt Per codex BLOCKING review on PR #1232 sha ed8997c: 1. AmbiguousRoot.candidates → NonSingletonList<PortId> on both surfaces (substrate.dag + Rust mirror). Empty/singleton candidate sets are now structurally unrepresentable; ambiguity by definition requires ≥2 candidates. 2. Rust pub enum WorkflowRoot now carries the full 🟡 SCAFFOLD receipt mirroring the .dag — three-arm partition + named dissolution trigger (γ refinement / enumerate-all rule reuse the same partition behind the workflow_root_port accessor). Also refresh parse manifest + module header in workflow_root_port_test.rs (corrected the "three claims" list to match the actual integration tests; zero-Bind unit test lives in dag.rs#tests). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(v3): re-regen bootstrap on top of merged main Re-regenerate v3 bootstrap so WorkflowRoot + workflow_root_port land on top of latest main. Refresh parse manifest. Carrier shape unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(v3): explicit BOUNDED STAGING SCAFFOLD receipt on workflow_root_port Per codex REQUEST_CHANGES on PR #1232 sha 628910c: name the realization-side staging explicitly with a bounded scaffold receipt naming the first-emitter-consumer trigger. The accessor declaration + Rust impl + Rust-side consumer tests land in Prereq-3a (this PR); the per-target SubstrateAccessorBinding lands atomically with the first .dag consumer (Prereq-3b fold_lens<C> is planned first), same staging discipline as lane2_workflow_at. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): land Rust SubstrateAccessorBinding for workflow_root_port Per codex BLOCKING on PR #1232 sha 8bb6dc7: the prior bounded-staging receipt was correct that Python/Go bindings stage, but wrong about the Rust binding being optional in this slice. Without ANY binding the accessor is not in substrate_accessor_universe, so a .dag consumer falls through to plain callable dispatch — not fail-closed. Add rust_workflow_root_port_accessor (carrier "({p0}).workflow_root_port()") and workflow_root_port_binding_rust to src/v3/spec/rust.dag, matching the lane2_workflow_at precedent. The accessor is now in substrate_accessor_universe; any .dag consumer lowers correctly under Rust target. Python/Go bindings remain staged for when those targets emit consumers (per BOUNDED STAGING receipt update on the substrate.dag accessor). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(v3): bump substrate-accessor binding count to 6 for workflow_root_port substrate_accessor_rust_binding_invariants asserts an exact count of Rust bindings; bumping to 6 (was 5) for the new workflow_root_port_binding_rust added at PR #1232. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * feat(v3): add rust_workflow_root TypeRealization Per codex BLOCKING on PR #1232 sha 4ed2a8e: the WorkflowRoot substrate sum was added without registering its Rust TypeRealization. Generated Rust matches over WorkflowRoot need the carrier mapping so the substrate sum identity flows through emission rather than rendering through a free name. Adds data rust_workflow_root: TypeRealization { language: rust_language, target: WorkflowRoot, carrier: "WorkflowRoot", is_copy: false, fields: [], cost: 1 } following the rust_behavior precedent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * WIP: tidy-wolf-507 * docs(design): Prereq-X audit — call-on-field-access for fold_lens<C> Director-approved option (b) on parent inbox #1130 after the fold_lens<C> HO field-call smoke confirmed v3 surface grammar does not support call-on-field-access. Records four exact parse failures (w.f(x), (w.f)(x), let g=...; g(x), brace-block let-then-call) and splits the prerequisite into three implementation slices: - X1: call-on-field-access dispatch (Arrow-typed expression callee). - X2: call-on-Var Arrow-typed dispatch (likely implicit in X1). - X3: brace-block let-expression inside `=` fn bodies. Maps each to lens.read / lens.sequential.op / lens.branch / lens.iterate / lens.validate dispatch paths. Notes that the lens-fold-prerequisites audit at #1207 conflated field assignment (Prereq-1, landed) with field invocation (Prereq-X, missing). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): Director-lock explicit block syntax for Prereq-X3 Per parent inbox #1130 (2026-04-30): record explicit block syntax (`do { ... }` proposed) as the X3 disambiguation strategy, not heuristic first-token lookahead. Reasons: `{ ... }` already has live record + map literal meanings; #1248 just tightened that ambiguity surface; explicit marker is unambiguous and cost-of- change-zero for future block-internal forms. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): name TransformTarget::IndirectCall extension for X1 runtime-callee Per gpt-5-5-thinking REQUEST_CHANGES on PR #1264 sha 8daec0b: the audit said "higher-order Transform target" without naming the substrate carrier. Updated to: - Split the lowerer impact into L1.a (statically-resolvable callee, reuses TransformTarget::Callable, no substrate change) and L1.b (runtime-sourced callee, requires new TransformTarget::IndirectCall { callee: PortId } variant). - Name TransformTarget::IndirectCall as the substrate extension with permanent (non-SCAFFOLD) lifecycle — HO dispatch is a real long-term language surface, not staging. - Sequence: L1.a first (no substrate change), L1.b second. - Note that fold_lens<C> itself depends on L1.b because `lens` is a function parameter, not a static binding — L1.a alone does not unblock the consumer the audit was scoped to enable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): IndirectCall as discriminator-only variant; callee in inputs[0] Per BLOCKING inline on PR #1264 sha 172bb2c at line 153: putting callee: PortId on the variant payload would put a runtime dependency outside TransformNode.inputs, violating Facts Flow Forward / Every Dependency Is A Substrate Fact. Reflected consumers walk inputs to derive dependencies; a separate-field callee would be invisible to that walk. Refine the design: TransformTarget::IndirectCall is discriminator- only (no payload). inputs[0] carries the callee port, inputs[1..] carry args. Single dependency authority preserved; arity arithmetic becomes inputs.len() - 1 for IndirectCall. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): structural Callee/Arg tagging for TransformNode.inputs Per gpt-5-5-thinking REQUEST_CHANGES on PR #1264 sha d4d50c0: the inputs[0]-by-convention encoding admits illegal states (empty inputs, non-Arrow first input) and pushes enforcement to later type-checking, violating illegal-states-unrepresentable. Refine the design: TransformNode.inputs becomes Vec<TransformInput> where TransformInput = Arg(PortId) | Callee(PortId). For IndirectCall, exactly one element is Callee(_); the rest are Arg. Single dependency authority preserved (inputs.iter() still walks every dependency port). Variant tag makes the boundary structural. Plus constructor-API enforcement: Dag::push_indirect_call_transform is the only way to build an IndirectCall transform; validates Arrow-typed callee + arity at construction time. Cardinality ("exactly one Callee") enforced by builder + debug assert until v3 supports refined enum payload. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): use post-lock `do { ... }` block surface in T2.1 fixture Per cursor exploratory note on PR #1264 sha d4d50c0: T2.1's fixture used the pre-lock { ... } form, inconsistent with X3's locked `do { ... }` discipline. Update to use `do { ... }` so the matrix matches the locked surface. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): emitter contract uses TransformInput tag, not inputs[0] Per gpt-5-5-thinking REQUEST_CHANGES on PR #1264 sha ea53938: the emitter section reintroduced the positional convention the audit explicitly rejected — said "use inputs[0] as callee" while the structural invariant section said the Callee tag is the single authority. Fix: emitter partitions inputs by TransformInput tag (find the unique Callee element; project Arg elements in order); fails closed via EmitError::MalformedIndirectCall if Callee is missing or duplicated. Positional authority explicitly rejected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: tidy-wolf-507 * chore: apply cargo fmt * docs(design): make S2 span description meaningful Per cursor exploratory note on PR #1264 sha ea53938: the [...] span placeholder in S2 was ambiguous. Replace with a meaningful description ("at the leading `(` of the parenthesized callee") so the audit's regression-fixture purpose is self-explanatory even without exact byte offsets. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): real S2 span + remove stray integration.rs blank line Per cursor APPROVE_WITH_COMMENTS on PR #1264 sha de24278: 1. S2 span placeholder replaced with real byte offsets [106, 107] (leading `(` of parenthesized callee in the smoke fixture), matching the verbatim-evidence bar S1/S3/S4 set. 2. Stray blank line in src/v3/compiler/tests/integration.rs from the earlier S2-probe cleanup removed; integration.rs now matches origin/main exactly so the acceptance bullet ("no code changes") is honest. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): collapse target+inputs into TransformDispatch sum (X1) Per gpt-5-5-thinking REQUEST_CHANGES on PR #1264 sha de24278: the Vec<TransformInput> tagged-element approach left cardinality of Callee per IndirectCall as a cross-field invariant enforced by builder + debug assert, not by the type. Failed illegal-states-unrepresentable. Resolution: collapse TransformNode.target and TransformNode.inputs into a single typed sum TransformDispatch with one variant per dispatch shape, each carrying its own structured fields (Callable { callee: DeclarationId, args }, Indirect { callee: PortId, args }, etc.). Cardinality and target/callee compatibility are both expressed in the type: - Callable / FieldProject / Operator cannot carry runtime callee ports (no callee: PortId field). - Indirect cannot omit its callee (single field, not Option, not Vec). - Multi-callee Indirect is impossible (single field, not Vec). - Callable.callee is DeclarationId (compile-time); Indirect.callee is PortId (runtime); type system separates them. Single-authority dependency walk preserved via TransformDispatch::input_ports() iterator. EmitError::MalformedIndirectCall retires — malformed state unrepresentable. Migration cost noted: substantial refactor of TransformNode and all consumers walking target/inputs separately. Implementation worker scopes the migration; audit only locks the target shape. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): ArrowPortRef typed handle for IndirectCall.callee Per BLOCKING inline on PR #1264 sha de24278 line 215: Indirect.callee: PortId admits non-Arrow callees with API-level enforcement only behavioral. Refine to ArrowPortRef — Track-9 named-typed-handle wrapping PortId with Arrow-type proof, constructable only via Dag::resolve_arrow_port which validates the port's producer signature at construction. Non-Arrow callees become structurally unrepresentable: - ArrowPortRef's constructor is private to the dag module. - Outside callers go through resolve_arrow_port, which returns Err(NonArrowPortError) on non-Arrow ports. - Indirect { callee: ArrowPortRef, ... } can only be built with a validated ArrowPortRef. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): fix "against existing the existing" typo Per codex exploratory note on PR #1264 sha 69ee59a. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): clarify X3 'if Director confirms' refers to need not syntax Per cursor exploratory note on PR #1264 sha 79af7aa: X3's syntax is already Director-locked to explicit block markers earlier in the doc; only whether X3 is required for fold_lens<C> remains open. Tighten the acceptance section to disambiguate. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(design): close arity gap — OperatorCall fixed-arity + ArityCheckedArgs Track-9 handle Operator arity now encoded in OperatorCall sum (Unary/Binary); call-shape args wrapped in ArityCheckedArgs typed handle validated by Dag::resolve_call_args against the resolved Arrow signature. Malformed arity is structurally unrepresentable rather than convention-level. * docs(design): align L1.b sequencing bullet with ArityCheckedArgs typed handle * docs(design): bind args proof to dispatch target via atomic construction ArityCheckedArgs as a free-floating proof admitted reattaching args validated against signature A to a dispatch built for target B. Replaced with crate-private variant fields + Dag-level builders (push_callable/field_project/indirect_transform) that fuse target resolution and arity/type validation in one step. The proof and target are co-constructed; no public path can split them. * docs(design): add TransformDispatch dissolution ledger (🟢/🟡/🔴) Per modeling-discipline coproduct classification: - 🟢 Operator: keep (true user-input-boundary; primitives have no DeclarationId) - 🟡 Callable/FieldProject/Indirect: future-dissolve to Call { callee: CalleeRef, args }; separate today only because emitter rendering and args co-construction bind per-variant - 🔴 none Tracking gate for the 🟡 collapse: emitter callee-rendering split. * docs(design): align builder name to push_indirect_transform * docs(design): close pub-enum-field gap — wrap dispatch variants in pub(crate)-field structs Reviewer caught: pub enum with named-field variants exposes those fields publicly, so 'crate-private fields' was a false claim. Replaced named-field variants with tuple-struct payloads (CallableDispatch, FieldProjectDispatch, IndirectDispatch) whose fields are pub(crate). Outside the dag module, literal construction is blocked by the type system; only the Dag builder produces them. OperatorCall stays a plain pub enum since its variants witness no signature. * docs(design): scope dispatch payload fields to module-private (not pub(crate)) Reviewer caught: pub(crate) fields permit any in-crate module to construct CallableDispatch { ... } literally, bypassing the Dag builder that binds args to target. Switched to module-private (no visibility modifier) so only code inside the dag module can construct the payloads. Aligns ArrowPortRef precedent (already module-private). * docs(design): reclassify Operator from 🟢 to 🟡 per ArithOp dissolution example Modeling-discipline Practice 4's canonical example is ArithOp → Apply { function: FunctionRef } pointing at std::int::add. OperatorCall is structurally that case; absence of a current DeclarationId for + / - / unary ! is not the same as 'no richer source exists.' Tracking gate: std/{int,bool,float}/ declaring operator-algebra witness functions and parser desugaring operator tokens to Call(FunctionRef). * docs(design): harmonize dispatch variant snippets to tuple-payload form * docs(design): split FieldProject (pure projection) and FieldCall (invocation) Reviewer caught: collapsing plain field access and field invocation into one variant with optional args admits a malformed state where projection has args or invocation has none. Different state families should be different variants. - FieldProject preserves current TransformTarget::FieldProject shape (no args; pure value access) — 🟢 keep. - FieldCall is the new X1 variant — projection-then-call; always has args. 🟡 future-collapses with Callable/Indirect into Call{CalleeRef}. Builders split: push_field_project_transform vs push_field_call_transform. * docs(design): input_ports() enumerates carrier/operand ports too Reviewer caught: FieldProject.carrier and Operator(Unary/Binary) operand ports are runtime deps; input_ports() must yield every runtime PortId across all variants for Facts Flow Forward to hold. Documented per-variant enumeration explicitly. * docs(design): separate 'HO dispatch capability permanent' from 'Indirect variant transitional' Reviewer flagged: 'Indirect is permanent' (line 482) muddled with 'Callable/FieldCall/Indirect 🟡 future-dissolve' (line 424). Split into two claims: the capability is permanent (some variant must carry HO dispatch), but the specific variant spelling 'Indirect(IndirectDispatch)' retires when the 🟡 collapse to Call{CalleeRef::Port} lands. --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… fail-closed name field Codex BLOCKING(3) on PR #1314 sha b5f7dd5: 1. Authority document: external doc anchor was generic. Made bridge_ledger.dag the explicit substrate authority for rows; per-row 'authority' field now points at the concrete ratchet (test, PR, or gating doc-anchor) that establishes that row's status, not a generic taxonomy heading. Status flips from Open to Retired are gated on the named ratchet reaching zero residual: - source_span_file_participation -> ROADMAP.md#lens-fold-file-path-semantics - mark_bootstrap_secret_nominal_opacity -> PR #937 - canonical_lens_name_dispatch -> canonical_lens_bridge_ratchet_test.rs - include_str_side_channels -> PR #1171 - exact_string_patching_residual -> bridge_lower_helpers_patch_zero_residual_test.rs 2. Predicate schema typing: TestPredicate::BridgeLedgerZero.ledger now typed as BridgeLedgerRef (typed wrapper { decl: DeclarationRef }), mirror of MethodRef / CallableRef. Adds bridge_ledger.dag::BridgeLedgerRef with the same #1175 substrate-gap dissolution trigger. Runner unwraps the record at the predicate boundary. 3. Runner row validation: missing or non-String name field now fails closed instead of using a placeholder, even before status partition. Defensive at the claim boundary, complementing the carrier ratchet that already guards bridge_ledger.dag's substrate-side shape. 10/10 tests pass on the new payload shape: predicate-shape ratchet updated to require BridgeLedgerRef wrapper (not bare DeclarationRef); runner tests use BridgeLedgerZero { ledger: { decl: <ref> } } literal construction; sibling-canonical-shape and wrong-type negative tests still fire fail-closed.
…edicate + runner (#1314) * WIP: sharp-raven-604 * WIP: sharp-raven-604 * WIP: sharp-raven-604 * WIP: sharp-raven-604 * WIP: sharp-raven-604 * WIP: sharp-raven-604 * regen bootstrap after std.effects import path fix * WIP: sharp-raven-604 * chore: apply cargo fmt * WIP: sharp-raven-604 * regen bootstrap + refresh parse manifest after merge * WIP: sharp-raven-604 * WIP: sharp-raven-604 * WIP: sharp-raven-604 * PR-α: wrap Operation.callable in CallableRef (typed wrapper, mirrors MethodRef) * chore: apply cargo fmt * doc: align test comments with CallableRef wrapper (cosmetic) * regen bootstrap after merge main * T-Substrate-AnthropicSchemaMirror: v3 typed mirror for Anthropic Messages signature - src/v3/std/anthropic_schema.dag: type-authority-only mirror of provider-domain types reachable from operation Messages signature in dsl/extdeps/llm/anthropic.dag (AnthropicChatMessage + content block variants, AnthropicStopReason, AnthropicMessages200{TextBlock,Usage,Body}). - AnthropicErrorShape deferred (4xx/5xx response slot only; not on the typed return reach for fn anthropic_messages -> AnthropicMessages200Body). - src/v3/compiler/tests/integration/anthropic_schema_lockstep_test.rs: 8 ratchets pinning v3 mirror against v2 source (variant labels, field labels, type-name presence in v2). Discipline mirrors method_registry_test.rs. - Type authority only — no fn anthropic_messages, no Operation rows. Those are the next substrate precursor that consumes these types. * WIP: sharp-raven-604 * chore: apply cargo fmt * anthropic_schema lockstep: couple expected labels to v2 source + optionality Manager review on PR #1261: the prior lockstep tests asserted v3 labels against hard-coded constants and only checked v2 type-name presence. They would NOT catch v2 source drift on field/variant labels themselves. This commit: - Extracts the v2 type-block text via v2_type_block(name). - assert_lockstep_record / assert_lockstep_disj now verify each expected label appears literally in the v2 block, fail-closed on either-side drift. - New anthropic_optional_fields_remain_optional_in_v2_source asserts the '?' suffix on is_error: Bool? and stop_sequence: String? in the v2 source, with comment explaining structural inspection of v3 optionality is deferred to the operation-row precursor (per manager guidance). * anthropic_schema lockstep: bidirectional set equality + structural optionality OpenAI-Pro REQUEST_CHANGES on PR #1261: prior ratchet only checked v3 set == expected and expected ⊆ v2. v2 additions silently passed; v3 optionality was text-only on the v2 side, not structurally checked on v3. Strengthened: - v2_record_fields(name) parses the v2 type block and extracts (label, is_optional) tuples directly from the source. v2_disj_variants(name) extracts variant labels (including from inline 'A | B | C' and multi-line '= Foo {} | Bar {}' shapes). - assert_record_lockstep / assert_disj_lockstep assert SET EQUALITY between v2-extracted set and v3 bootstrap set (BTreeSet diff in the failure message names v3-only and v2-only labels). - Optionality is structural on v3: v3_field_is_optional walks the field declaration's TypeConnective and matches Cardinality(AtMostOne, _). Each v2 'T?' field must lower optional; each v2 'T' field must NOT. - New test anthropic_user_content_block_user_tool_result_block_optionality reaches the variant payload Conj for UserToolResultBlock and asserts is_error: Bool? lowers as Cardinality(AtMostOne, Bool) on the inner declaration (variant payloads aren't reached by the record-level ratchet). * chore: apply cargo fmt * fix clippy: use char array in split (manual char comparison lint) * WIP: sharp-raven-604 * anthropic_schema lockstep: per-variant payload field+optionality coverage OpenAI-Pro REQUEST_CHANGES on PR #1261: assert_disj_lockstep compared only variant labels, leaving variant payload field labels and optionality unguarded — UserToolResultBlock.content / tool_use_id and AssistantToolUseBlock.id / name / input could drift between v2 and v3 while the test passed. This commit: - v2_disj_variants now returns (label, Option<Vec<(field_label, is_optional)>>), parsing variant payload bodies via the same logic v2_record_fields uses (extracted as parse_v2_brace_body_fields). - v3_variant_payload_fields walks the v3 variant target's Conj declaration and projects (label, Cardinality(AtMostOne, _)?) tuples. - assert_disj_lockstep extends to per-variant payload set equality and optionality: bare-on-bare passes; record-on-record requires set equality + optionality match; mismatched (one-side bare, other-side payload) fails closed. - Drops the redundant special-case is_error optionality test — now subsumed by structural per-variant payload coverage on AnthropicUserContentBlock. * chore: apply cargo fmt * WIP: sharp-raven-604 * chore: apply cargo fmt * WIP: sharp-raven-604 * anthropic_schema lockstep: type-expression equality (records + variant payloads) OpenAI-Pro REQUEST_CHANGES on PR #1261 (sha 1e08a24): label + optionality weren't enough to catch field type drift — content: List<X> could become content: String while tests stayed green. Adds: - v3_canonical_ty(dag, ty): walks declarations to produce a canonical type-expression string. Named decls (String, Bool, AnthropicStopReason, AnthropicMessages200TextBlock, …) canonicalize as their surface name even though their underlying connective unfolds to Instantiation (e.g. String = FreeMonoid<Int>). Anonymous Instantiation sites (List<X>, Map<K, V>) and Cardinality(AtMostOne, T) get unfolded. - normalize_ty_text(raw): strips trailing '?' and compresses internal whitespace so v2 source text matches v3 canonical form. - v2_record_fields and parse_v2_brace_body_fields now return (label, normalized_ty_text, is_optional); v3_variant_payload_fields returns (label, canonical_ty, is_optional). - assert_record_lockstep and assert_disj_lockstep added type-expression equality assertions in addition to label-set equality and optionality. Optionality is checked separately, so the type comparison strips the trailing '?' on both sides and compares inner-element forms only. Coverage: every mirrored field across AnthropicChatMessage, AnthropicUserContentBlock (incl. UserToolResultBlock.content/tool_use_id), AnthropicAssistantContentBlock (incl. AssistantToolUseBlock.input: Json), AnthropicMessages200TextBlock, AnthropicMessages200Usage (input_tokens: Int), and AnthropicMessages200Body (content: List<...>, stop_sequence: String?) now fails closed if v2 carrier type changes. * anthropic_schema lockstep: also reject Arrow declarations (fn leak guard) Codex non-blocking improvement on PR #1261: prior anthropic_schema_authors_no_data_rows test rejected only declarations with value_body: Some(...), so a future fn anthropic_messages would lower as TypeConnective::Arrow with value_body: None and bypass the guard. Renamed to ..._or_fns and extended the filter to also reject TypeConnective::Arrow declarations authored in src/v3/std/anthropic_schema.dag. * chore: apply cargo fmt * T-Substrate-AnthropicMessagesCallable: fn anthropic_messages declaration Service-operation callable declaration precursor for the Anthropic Messages REST operation, the substrate slice Grounding PR-β #1252 is waiting on per parent #1130 dispatch. Adds: - src/v3/std/anthropic_messages.dag: top-level fn anthropic_messages with honest signature consuming v3.std.anthropic_schema mirror types (#1261). Returns AnthropicMessages200Body. host body lowers as ArrowBody::Unparsed (no producerless realization carrier minted). - src/v3/compiler/tests/integration/anthropic_messages_callable_test.rs: 5 ratchets — Arrow shape, parameter type list matches v2 source via v3 mirror, return type is AnthropicMessages200Body, callable is acceptable as Operation.callable.decl target, no Operation/data rows leak (those are PR-β scope). Two intentional simplifications vs v2 (documented in file header): - max_tokens: Int (v2 'Int = 4096'); v3 has no parameter defaults so the default is a caller-side fold, not a v3 contract change. - Return is the 200 body only; AnthropicErrorShape is PR-β response/ wire lockstep concern. Out of scope: anthropic_operations: List<Operation> data row, sibling binding/realization data rows. Grounding owns those. * chore: apply cargo fmt * chore: restore comment/test adjacency in SG-0 census (cosmetic) Reviewer (claude opus 4.7) non-blocking exploratory observation on PR #1266: the alphabetical insertion of anthropic_messages_callable_test.rs and anthropic_schema_lockstep_test.rs split the PB Tier-2 #1014 comment block from the test it describes. Moving the comment two lines down restores adjacency. No behavior change. * anthropic_messages: pin Unparsed body + correct file header prose OpenAI-Pro REQUEST_CHANGES on PR #1266: the file header claimed 'host anthropic_messages' lowers to ArrowBody::ExternalRealization, but the generated substrate has ArrowBody::Unparsed(span). Prose did not match the substrate fact, and no test pinned the body class so a silent rewrite was invisible. Fixes: - File header rewritten to honestly describe the actual lowered state: body remains Unparsed because the pipeline-stage post-processing patch in bootstrap.rs:256 is pipeline-specific and does not fire for service-operation callables. The patch is intentionally not added (would require a producerless CompilerHostRealization-style data row, the parallel surface the #1130 dispatch rejects). - New ratchet anthropic_messages_body_is_unparsed pins ArrowBody::Unparsed; a silent rewrite to ExternalRealization / UserDefined / Pending / NoBody fails closed. - File header explicitly bounds the unparsed-body state to the same dissolution trigger as the schema mirror. * regen bootstrap: re-sync byte spans after anthropic_messages.dag header rewrite * T-Verification-BridgeLedger: substrate carrier for bridge-retirement ledger Adds: - src/v3/std/bridge_ledger.dag: substrate authority for the bridge- retirement ledger Verification's BridgeLedgerZero TestClaim folds. - BridgeStatus = Retired | Open (closed two-variant coproduct; structural partition, no stringly status). - BridgeLedgerRow { name, owner, status, authority } per dispatch contract. - data bridge_ledger: List<BridgeLedgerRow> = [...] populates the five canonical bridge rows from docs/r3-structure.md:79-83. - Per-row status rationale documented in file header: source-span- file-participation Open, mark-bootstrap-secret-nominal-opacity Retired, canonical-lens-name-dispatch Retired, include-str-side- channels Open, exact-string-patching-residual Open. - src/v3/compiler/tests/integration/bridge_ledger_carrier_test.rs: 6 ratchets — BridgeLedgerRow field set, BridgeStatus closed two- variant coproduct, bridge_ledger lowers as List<BridgeLedgerRow>, five canonical names in document order, name uniqueness, status field resolves structurally to a BridgeStatus constructor (not a string). - bootstrap regen + parse manifest refresh + integration mod entry + SG-0 census entry. Single substrate authority — no parallel Rust Vec, no test-side ledger table. Verification's BridgeLedgerZero fold is out of scope for this PR per dispatch. * regen bootstrap + manifest after merging origin/main * T-Verification-BridgeLedger: predicate variant + runner branch (Director scope extension) Per parent #1130 dispatch (#4356094666) extending #1314: substrate authority for BridgeLedgerZero gate, not just the carrier. Adds: - src/v3/std/verification.dag: TestPredicate variant BridgeLedgerZero { ledger: DeclarationRef }. Single payload field preserves typed-edge discipline; structural identity, not stringly ledger reference. - src/v3/compiler/src/test_runner.rs: eval_bridge_ledger_zero branch. Resolves the ledger DeclarationRef, walks ValueBody::List rows, reads each row's status Variant, partitions by structural comparison against BridgeStatus::Retired's variant id (not by name). Returns Pass iff every row is Retired; Fail names the open rows in declaration order. - src/v3/compiler/tests/integration/bridge_ledger_carrier_test.rs: Two new tests: - bridge_ledger_zero_predicate_carries_only_ledger_declaration_ref: pins the variant's payload set to {ledger} and asserts ledger's type is DeclarationRef from v3.spec.v3_l1. - bridge_ledger_zero_runner_fails_with_named_open_rows_at_head: compiles a TestClaim referencing the ledger via DeclarationRef and runs it through TestRunner. At HEAD with three Open rows (source_span_file_participation, include_str_side_channels, exact_string_patching_residual), expects Fail with all three named and the two Retired rows excluded. Re-arms as Pass once all five flip to Retired. - bootstrap regen + parse manifest refresh. 8/8 tests pass; clippy clean. Verification's #1310 can now author the .dag TestClaim consuming this predicate. * chore: apply cargo fmt * doc: bridge_ledger comment cites correct canonical-lens ratchet test (cosmetic) Reviewer (cursor) NON-BLOCKING finding on PR #1314: per-row rationale for bridge_canonical_lens_name_dispatch_retired cited bridge_lower_helpers_patch_zero_residual_test (lower-helper exact-string patch lane) instead of the canonical-lens-name-dispatch ratchet at canonical_lens_bridge_ratchet_test.rs. Comment text only; bootstrap + manifest re-synced for the byte-span shift. * WIP: sharp-raven-604 * eval_bridge_ledger_zero: enforce canonical ledger identity (single-authority) Codex REQUEST_CHANGES on PR #1314: the previous type-check accepted any List<BridgeLedgerRow> declaration, so a sibling list could become a parallel ledger authority and pass the gate independently of the canonical bridge_ledger. INVARIANTS P2 / single-authority violation. Adds: - Canonical-identity check before the type-check guard: the resolved ledger DeclarationId must match dag.declaration_by_name('bridge_ledger').id. Sibling List<BridgeLedgerRow> declarations fail closed with a diagnostic naming the canonical authority. Type-check stays as defense-in-depth (catches a future carrier-shape drift). - New test bridge_ledger_zero_runner_fails_closed_on_sibling_canonical_ shape_ledger: compiles a sibling 'data sibling_ledger: List<BridgeLedgerRow> = []' and asserts BridgeLedgerZero fails closed because the declaration identity isn't the canonical one (even though the type IS compatible). - Existing wrong-type test updated: identity check fires first for any non-canonical ledger, so the assertion now expects the canonical-identity diagnostic. * chore: apply cargo fmt * WIP: sharp-raven-604 * BridgeLedgerZero: tighten payload typing, per-row authority pointers, fail-closed name field Codex BLOCKING(3) on PR #1314 sha b5f7dd5: 1. Authority document: external doc anchor was generic. Made bridge_ledger.dag the explicit substrate authority for rows; per-row 'authority' field now points at the concrete ratchet (test, PR, or gating doc-anchor) that establishes that row's status, not a generic taxonomy heading. Status flips from Open to Retired are gated on the named ratchet reaching zero residual: - source_span_file_participation -> ROADMAP.md#lens-fold-file-path-semantics - mark_bootstrap_secret_nominal_opacity -> PR #937 - canonical_lens_name_dispatch -> canonical_lens_bridge_ratchet_test.rs - include_str_side_channels -> PR #1171 - exact_string_patching_residual -> bridge_lower_helpers_patch_zero_residual_test.rs 2. Predicate schema typing: TestPredicate::BridgeLedgerZero.ledger now typed as BridgeLedgerRef (typed wrapper { decl: DeclarationRef }), mirror of MethodRef / CallableRef. Adds bridge_ledger.dag::BridgeLedgerRef with the same #1175 substrate-gap dissolution trigger. Runner unwraps the record at the predicate boundary. 3. Runner row validation: missing or non-String name field now fails closed instead of using a placeholder, even before status partition. Defensive at the claim boundary, complementing the carrier ratchet that already guards bridge_ledger.dag's substrate-side shape. 10/10 tests pass on the new payload shape: predicate-shape ratchet updated to require BridgeLedgerRef wrapper (not bare DeclarationRef); runner tests use BridgeLedgerZero { ledger: { decl: <ref> } } literal construction; sibling-canonical-shape and wrong-type negative tests still fire fail-closed. * verification ratchet: include BridgeLedgerZero variant after main rebase m1_5_verification_test::bootstrap_loads_verification_authority_types expected variant list still ended at SubstrateResearchDeferredClaim; appended ('BridgeLedgerZero', vec!['ledger']) to match the live bootstrap. Bootstrap+manifest re-synced from the post-merge regen. 10/10 bridge_ledger_carrier tests + 1/1 verification ratchet pass. * doc: align eval_bridge_ledger_zero rustdoc with BridgeLedgerRef payload (cosmetic) Reviewer (cursor) NON-BLOCKING on PR #1314: rustdoc on eval_bridge_ledger_zero still described the predicate as { ledger: DeclarationRef } even though the substrate surface (and the implementation) now requires the BridgeLedgerRef { decl: DeclarationRef } wrapper. INVARIANTS 'documentation describes live state' alignment. Comment-only; no behavior change; .rs file edit so no bootstrap regen needed. * bridge_ledger tests: derive row set + open/retired partition from live ledger (single-authority) Codex BLOCKING on PR #1314: CANONICAL_BRIDGES + expected_open/retired arrays copied the ledger row set and status partition into Rust, creating exactly the test-side parallel table bridge_ledger.dag rules out (single-authority / M7). - Removed the CANONICAL_BRIDGES const and the bridge_ledger_carries_canonical_five_names_in_doc_order test (the test re-asserted ledger content from a hardcoded copy; row content authority lives only in bridge_ledger.dag). - bridge_ledger_lowers_as_list_with_at_least_one_row replaces the earlier exact-five-rows assertion: pins the structural shape (List value_body, every entry a Record, non-empty) without duplicating the row count. - bridge_ledger_zero_runner_fails_with_named_open_rows_at_head no longer hardcodes expected_open_rows / expected_retired_rows. It reads the live ledger from the bootstrap, partitions by structural comparison against BridgeStatus::Retired's variant id, and asserts: every Open row's name appears in the failure diagnostic and every Retired row's name does not. Re-arms automatically as upstream rows flip status — the test does not need an update each time. 9/9 tests pass; clippy clean. The only authority for ledger row content is now src/v3/std/bridge_ledger.dag. * bridge_ledger: repoint umbrella row authority at open-scope prose, not closed sub-slice ratchet OpenAI-Pro REQUEST_CHANGES on PR #1314: the bridge_exact_string_patching_residual_retired row's authority pointed at bridge_lower_helpers_patch_zero_residual_test.rs, the receipt for the RETIRED lower-helper sub-slice (#1014). The row stays Open because *other* exact-string patching classes remain outside that receipt's scope, so the closed-slice test was misleading as the row's authority. Repointed authority at docs/r3-structure.md:83 — the prose row where the umbrella's open-scope framing ('Other exact-string patching classes ... keep their own dissolution triggers') is defined. Each 'other class' has its own trigger; the umbrella row retires when those triggers all fire. Per-row inline comment in bridge_ledger.dag explains the distinction. * WIP: sharp-raven-604 * regen bootstrap + manifest after main rebase (clean conflicts)
…arationRef Three concurrent findings on PR #2164 sha 0e18508: 1. **Codex BLOCKING** (sha 0e18508): `bootstrap_authority.dag` omits `dsl/std/serialization.dag`, so `import std.serialization { DeclarationRef }` cannot materialize the String-alias authority in generated snapshots → silent mis-resolution at bootstrap time. 2. **Codex non-blocking** (sha c9ebf46): `v3.spec.v3_l1::DeclarationRef` "resolves to a typed declaration reference" (not String); the debt-paydown row prose treating it as a String alias is incorrect. 3. **CI v3 lane2 stack overflow** (sha 0e18508): `lane2_stage_2d_ symbolic_cost_test::branch_reports_constant_when_both_arms_constant` stack-overflows on the 2MB test-thread default after my carrier adds traversal pressure to the bootstrap; reproduces locally. Resolution path (codex's option (b)): switch carrier to import the structural typed `DeclarationRef` from `v3.spec.v3_l1` (already in `V3SpecAuthority`, no authority gap), reverting Mgr's prior `std.serialization` BLOCKING — the tri-way tension resolves cleanly: - No bootstrap-authority gap (v3_l1 is already authoritative) - No stack-budget regression (no new files added to bootstrap) - Debt-paydown row retitled per codex non-blocking guidance: "unrefined-any-declaration handle" — same #1175 substrate gap classification as MethodRef (`methods.dag:31`) + CallableRef (`services.dag:86-100`); dissolution trigger is the shared refinement-typing-on-DeclarationRef landing. - Inline doc-comment in carrier surfaces the tri-way tension and selection rationale for future readers. Additional carrier reduction (separate from BLOCKINGs but absorbed in this commit since it's the lane2 stack-overflow root cause): - `FieldShape {}` removed; `FieldProjection.Fields { fields: Map<String, FieldShape> }` collapsed to `FieldProjection.Populated` placeholder. Defers populated-case detail to first paydown PR per Mgr-disposed sliced-follow-up; same Practice-4 SCAFFOLD discipline. Gate 3 (i) trivial in-PR demo (Mgr-disposed at #2154 c#4400893282) attempted via `data anthropic_chat_message_projection: CoproductProjection` but blocked by DSL parser limitation: `Map<K, Record>` literals are not supported in `src/v3/std/` layer (zero precedent; tried both inline records and ident-reference values, both surfaced `expected field label, got StringLit("UserMessage")` parse errors). Surfaced as substrate-tooling gap; gate 3 reverts to (ii) defer-to- first-paydown disposition. Inline doc-comment in carrier captures the parser limitation for the lane. All gates green locally: - `cargo run regen_bootstrap` ✓ - `cargo test refresh_handwritten_parse_snapshot_manifest --ignored` ✓ - `parse_stage4_prep::handwritten_parse_snapshot_matches_manifest` ✓ - `pb1_bootstrap_full_snapshot_test` 8/8 ✓ - `lane2_stage_2d_symbolic_cost_test::branch_reports_constant_when_both_arms_constant` ✓ (no overflow) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…rences gpt-5-5-pro REQUEST_CHANGES on PR #2164 sha 6de6a4d (BLOCKING): substrate scaffolds need a single live authority for what is debt and what dissolves it. After the import-switch to typed v3.spec.v3_l1 DeclarationRef, several comments still described the prior String-alias disposition, and `VariantId`'s dissolution trigger named an audit-row #14 OR string-bridge OR-trigger that conflicted with the ledger's new shared-with-#1175 trigger. Fixes: 1. **Top-of-file "DeclarationRef alias debt" block** (was: "DeclarationRef = String alias accepted for this slice; ... 2-clause OR-trigger audit-row #14 OR string-bridge"): retitled "DeclarationRef debt — unrefined-any-declaration handle"; describes the typed-import path and shared #1175 dissolution. 2. **`VariantId` SCAFFOLD trigger** (was: "(a) audit-row #14 closes module-convergence OR (b) string-identity-bridge surfaces"): rewritten to single-authority shared-#1175 trigger paired with `DeclarationRef` ledger row — no separate OR-trigger applies; the carrier-level dissolution is single-keyed on #1175. 3. **`CoproductProjection.declaration` doc** (was: "carries the `DeclarationRef = String` alias soft-typed handle per Director observation #1 disposition (b)"): rewritten to describe the structural typed reference + shared #1175 trigger. Remaining mention of "`DeclarationRef = String` alias" at the import- site comment is intentional historical context — it explains what was rejected (and why) in the selection rationale; not a current-state characterization of the carrier. All local gates green post-fix: - `regen_bootstrap` ✓ + manifest refresh ✓ - `parse_stage4_prep::handwritten_parse_snapshot_matches_manifest` ✓ - `lane2_stage_2d_symbolic_cost_test::branch_reports_constant_when_both_arms_constant` ✓ Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…1702 re-dispatch enabler (#2164) * WIP: Substrate S5: Variant-aware projection metadata carrier — Anthropic #170 * fix(s5): correct DeclarationRef import + refresh parse manifest Mgr review BLOCKING (PR #2164): - Import was `v3.spec.v3_l1 { DeclarationRef }` (empty record `{}`) but brief + Director's path-(a) ratification reference the `dsl/std/serialization.dag::DeclarationRef = String` alias. - Switch to `import std.serialization { DeclarationRef }` to match the disposition'd shape. - Inline doc-comment surfaces the two-co-existing-DeclarationRefs P2 concern as a separate substrate gap (likely folds into audit-row #14 module-convergence dissolution trigger). Refresh `parse_corpus_manifest.txt` for the new `src/v3/std/coproduct_projection.dag` file row (regenerated via `cargo test -p v3-compiler refresh_handwritten_parse_snapshot_manifest -- --ignored`). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(s5): regen bootstrap snapshot + name WireTagValue dissolution trigger Two BLOCKING inline review findings on PR #2164: 1. **Bootstrap snapshot missing carrier** (line 41 finding) — P2 facts- flow-forward violation. Ran `cargo run -p v3-compiler --bin regen_bootstrap --features bootstrap-regen-fresh`; refreshes `bootstrap_generated.rs` + `bootstrap_generated_without_parse_surface.rs` + `bootstrap_std_generated.rs` so `CoproductProjection` is present for downstream consumers. 2. **WireTagValue 🟡 SCAFFOLD with "none" trigger** (line 67 finding) — INVARIANTS.md P5 violation. Replace "Dissolution trigger: none" with a named two-clause checkable trigger: (a) §1.8 gates #29-#30 close (closure-predicate consumers land), AND (b) at least one non-StringTag arm added in response to an observed wire surface, OR explicit Practice-4 closure receipt naming the substrate observation that all REST/LLM wire boundaries are string-shaped. Plus re-escalate-to-Mgr clause if a consumer surfaces a wire-tag shape StringTag cannot express. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(s5): add CoproductProjection to bootstrap_authority + refresh manifest CI failures on PR #2164 sha 4952323: - `parse_stage4_prep::handwritten_parse_snapshot_matches_manifest`: stale hash for `coproduct_projection.dag` — manifest carried the pre-`e65efb82b` hash (before WireTagValue trigger expansion). - `pb1_bootstrap_full_snapshot_test::bootstrap_authority_rows_match_full_bootstrap_source_files`: the new `src/v3/std/coproduct_projection.dag` was bundled by the build.rs std staging but missing from `bootstrap_authority.dag`'s authority map → P2 single-authority gap. Fixes: - Add `"src/v3/std/coproduct_projection.dag": V3StdAuthority` row (alphabetical between computation_model and cross_target_coverage). - Re-run `regen_bootstrap` + `refresh_handwritten_parse_snapshot_manifest` so `bootstrap_generated*.rs` + `parse_corpus_manifest.txt` reflect the current carrier content + authority. Both tests verified green locally. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: Substrate S5: Variant-aware projection metadata carrier — Anthropic #170 * fix(s5): resolve codex BLOCKING + lane2 stack overflow via typed DeclarationRef Three concurrent findings on PR #2164 sha 0e18508: 1. **Codex BLOCKING** (sha 0e18508): `bootstrap_authority.dag` omits `dsl/std/serialization.dag`, so `import std.serialization { DeclarationRef }` cannot materialize the String-alias authority in generated snapshots → silent mis-resolution at bootstrap time. 2. **Codex non-blocking** (sha c9ebf46): `v3.spec.v3_l1::DeclarationRef` "resolves to a typed declaration reference" (not String); the debt-paydown row prose treating it as a String alias is incorrect. 3. **CI v3 lane2 stack overflow** (sha 0e18508): `lane2_stage_2d_ symbolic_cost_test::branch_reports_constant_when_both_arms_constant` stack-overflows on the 2MB test-thread default after my carrier adds traversal pressure to the bootstrap; reproduces locally. Resolution path (codex's option (b)): switch carrier to import the structural typed `DeclarationRef` from `v3.spec.v3_l1` (already in `V3SpecAuthority`, no authority gap), reverting Mgr's prior `std.serialization` BLOCKING — the tri-way tension resolves cleanly: - No bootstrap-authority gap (v3_l1 is already authoritative) - No stack-budget regression (no new files added to bootstrap) - Debt-paydown row retitled per codex non-blocking guidance: "unrefined-any-declaration handle" — same #1175 substrate gap classification as MethodRef (`methods.dag:31`) + CallableRef (`services.dag:86-100`); dissolution trigger is the shared refinement-typing-on-DeclarationRef landing. - Inline doc-comment in carrier surfaces the tri-way tension and selection rationale for future readers. Additional carrier reduction (separate from BLOCKINGs but absorbed in this commit since it's the lane2 stack-overflow root cause): - `FieldShape {}` removed; `FieldProjection.Fields { fields: Map<String, FieldShape> }` collapsed to `FieldProjection.Populated` placeholder. Defers populated-case detail to first paydown PR per Mgr-disposed sliced-follow-up; same Practice-4 SCAFFOLD discipline. Gate 3 (i) trivial in-PR demo (Mgr-disposed at #2154 c#4400893282) attempted via `data anthropic_chat_message_projection: CoproductProjection` but blocked by DSL parser limitation: `Map<K, Record>` literals are not supported in `src/v3/std/` layer (zero precedent; tried both inline records and ident-reference values, both surfaced `expected field label, got StringLit("UserMessage")` parse errors). Surfaced as substrate-tooling gap; gate 3 reverts to (ii) defer-to- first-paydown disposition. Inline doc-comment in carrier captures the parser limitation for the lane. All gates green locally: - `cargo run regen_bootstrap` ✓ - `cargo test refresh_handwritten_parse_snapshot_manifest --ignored` ✓ - `parse_stage4_prep::handwritten_parse_snapshot_matches_manifest` ✓ - `pb1_bootstrap_full_snapshot_test` 8/8 ✓ - `lane2_stage_2d_symbolic_cost_test::branch_reports_constant_when_both_arms_constant` ✓ (no overflow) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(s5): single-authority debt prose — remove stale String-alias references gpt-5-5-pro REQUEST_CHANGES on PR #2164 sha 6de6a4d (BLOCKING): substrate scaffolds need a single live authority for what is debt and what dissolves it. After the import-switch to typed v3.spec.v3_l1 DeclarationRef, several comments still described the prior String-alias disposition, and `VariantId`'s dissolution trigger named an audit-row #14 OR string-bridge OR-trigger that conflicted with the ledger's new shared-with-#1175 trigger. Fixes: 1. **Top-of-file "DeclarationRef alias debt" block** (was: "DeclarationRef = String alias accepted for this slice; ... 2-clause OR-trigger audit-row #14 OR string-bridge"): retitled "DeclarationRef debt — unrefined-any-declaration handle"; describes the typed-import path and shared #1175 dissolution. 2. **`VariantId` SCAFFOLD trigger** (was: "(a) audit-row #14 closes module-convergence OR (b) string-identity-bridge surfaces"): rewritten to single-authority shared-#1175 trigger paired with `DeclarationRef` ledger row — no separate OR-trigger applies; the carrier-level dissolution is single-keyed on #1175. 3. **`CoproductProjection.declaration` doc** (was: "carries the `DeclarationRef = String` alias soft-typed handle per Director observation #1 disposition (b)"): rewritten to describe the structural typed reference + shared #1175 trigger. Remaining mention of "`DeclarationRef = String` alias" at the import- site comment is intentional historical context — it explains what was rejected (and why) in the selection rationale; not a current-state characterization of the carrier. All local gates green post-fix: - `regen_bootstrap` ✓ + manifest refresh ✓ - `parse_stage4_prep::handwritten_parse_snapshot_matches_manifest` ✓ - `lane2_stage_2d_symbolic_cost_test::branch_reports_constant_when_both_arms_constant` ✓ Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * WIP: Substrate S5: Variant-aware projection metadata carrier — Anthropic #170 * fix(s5): bump lane2 symbolic-cost test stack to 8MB; restore FieldProjection Post-merge of main (commit f29f34c brought in 36 lines of dsl/std/integer.dag + extdeps changes) re-triggered lane2_stage_2d_symbolic_cost_test:: branch_reports_constant_when_both_arms_constant stack overflow that had been resolved at sha 0998705. Carrier-shape reduction alone could not keep this PR under the 2MB cliff after the merge. **Substrate-tooling fix**: apply the existing 8MB-stack-thread precedent (m2_substrate_inhabitance_test.rs:23-35's `with_full_bootstrap_stack` pattern) to the failing test. The test's existing doc-comment explicitly documents it as a ratchet exception that pays a cold bootstrap+pipeline compile and is on the budget edge; the named dissolution trigger ("cache bootstrap Dag state as input to compile_to_dag") remains the load-bearing fix. Stack bump is the cliff-edge workaround until that lands. With the test-thread budget fixed, restore FieldProjection (`Empty | Populated`) on `CoproductVariantProjection.field_projection` — brings the carrier back to brief's path-(a)-ratified shape (per- variant single-keyed fact: payload projection + wire-tag value). Populated-case detail (typed `Map<String, FieldShape>` payload field projection) still deferred to first paydown PR consumer per Mgr- disposed sliced-follow-up. Verified locally: - regen_bootstrap ✓ - refresh_handwritten_parse_snapshot_manifest ✓ - parse_stage4_prep::handwritten_parse_snapshot_matches_manifest ✓ - pb1_bootstrap_full_snapshot_test 8/8 ✓ - lane2_stage_2d_symbolic_cost_test::branch_reports_constant_when_both_arms_constant ✓ (no overflow) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(s5): disambiguate debt-row PR reference per cursor exploratory cursor/composer-2 sha f29f34c exploratory note flagged that the debt-paydown row's 'PR introducing #1947' phrasing was ambiguous; clarified to 'PR #2164, closing #1947' since #1947 is the work-item issue and #2164 is the PR ID. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Lands a sibling substrate carrier
MethodTemplateContractinsrc/v3/std/emit_model.dagfor per-target, per-method render templates. Director-approved on the parent inbox (#1130) — name, shape, and field types locked before this PR opened.This PR is the substrate-only slice. Row population (
data rust_method_template_contracts: List<MethodTemplateContract>and siblings) and retirement of the parallelMethodTranslation/SimpleMethodSpecauthorities are Grounding-owned follow-ups, not in scope here.P1 / P2 receipt
MethodTemplateContractis a sibling type to existing §6aMethodContract(src/v3/std/algebra.dag:127); both attach to method declarations, neither is parent or child of the other. §6aMethodContractcarries target-agnostic cost/complexity metadata keyed by(algebra_id, method_id); this carrier carries target-specific render templates keyed bydag_method. Disjoint coordinates, disjoint consumers. §6aMethodContractis unchanged by this PR.dag_method,runtime_template,emit_template,wraps_result,placeholder_convention). No cost / size / callback fields. Per-target identity is carried by the containingdata <target>_method_template_contracts: List<MethodTemplateContract>list authority, not duplicated on the row.MethodTemplateContractprevents collision with §6aMethodContract.Field-type calls (Director-approved on #1130)
dag_method: DeclarationRef— matches in-file convention (op: DeclarationRefonOperatorRealization,language/targeton every realization). Refines to a typedMethodReflater if a method-declaration registry lands indsl/std/.runtime_template: String,emit_template: String— matches every existing template field inemit_model.dag(struct_def,match_expr,let_binding, …).PlaceholderConvention = IndexedArgs | NamedArg— matches the live data split between runtime{arg0}/{arg1}and emit{arg}template dialects across all six extdeps files. Carries a 🟡 SCAFFOLD lifecycle receipt with named dissolution trigger (structured template-segment substrate).Acceptance
src/v3/compiler/tests/integration/method_template_contract_test.rs— three claims per dispatch:method_template_contract_distinct_from_method_contract— both names resolve ingenerated_std_bootstrap_dag()to distinctDeclarationIds with disjoint field-label sets.method_template_contract_does_not_carry_cost_data— field set is exactly{dag_method, runtime_template, emit_template, wraps_result, placeholder_convention}; explicitly assertscost_shape/size_effect/callback_element_positionare absent.method_template_contract_per_target_dag_method_unique— uniqueness check wired over zero rows today (Grounding owns row population). Vacuously passes; gains teeth once Grounding's row-population PR landsdata <target>_method_template_contractslists, at which point the test grows to enumerate each list and hand it toassert_dag_method_unique.Commands run
./scripts/regenerate-stage0.sh— fixed point verified (pass 1 == pass 2).cargo run -p v3-compiler --features bootstrap-regen-fresh --bin regen_bootstrap— refreshessrc/v3/compiler/src/bootstrap_generated.rssoDag::declaration_by_name("MethodTemplateContract")resolves in tests.cargo test -p v3-compiler --test integration method_template_contract— three claims pass.Out of scope (Grounding-owned follow-up)
data rust_method_template_contracts: List<MethodTemplateContract>and the Python/Go siblings.MethodTranslation(runtime.dag) andSimpleMethodSpec(emit.dag) once consumers cut over._per_target_dag_method_uniquetest to enumerate live lists.Test plan
cargo test -p v3-compiler --test integration method_template_contractpasses.cargo fmt --all --checkclean.🤖 Generated with Claude Code