Skip to content

docs(evaluator): E6-G0d constructor runtime execution brief - #1725

Merged
briansrls merged 6 commits into
mainfrom
docs/e6-g0d-constructor-runtime-brief
May 5, 2026
Merged

briansrls merged 6 commits into
mainfrom
docs/e6-g0d-constructor-runtime-brief

Conversation

@briansrls

@briansrls briansrls commented May 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md.
  • Classifies record and variant constructor paths that lower to non-Arrow TransformTarget::Callable(target).
  • Defines the first honest Evaluator slice: interpret already-lowered constructor targets into existing Value::RecordValue / Value::VariantValue carriers, with STOP fences for substrate, lowerer, X1.b, Pop A, and fold-lens scope.
  • Recommends implementation + ratchets as the next PR rather than ratchet-only.

Verification

  • git push pre-push hook ran cargo fmt --all --check successfully.
  • Docs-only change; no Rust implementation or tests added.

@briansrls

Copy link
Copy Markdown
Contributor Author

Manager review: please patch before merge.

The high-level gate shape is right, but the implementation section needs one authority fix before this is safe to hand to a worker:

  • The brief says to treat a “variant declaration whose payload walks to Conj” as Value::VariantValue. That is under-specified and risks conflating variant payload records with ordinary record constructors, because record targets also walk to Conj. Please make the variant path require structural proof that callee_decl is one of a parent TypeConnective::Disj { variants } entries, using the Disj.variants list as the authority for variant membership/tag identity. Only after that should the payload walk to Conj to build the RecordValue payload. If no parent Disj membership is found, a Conj target should stay on the record-constructor path, not become a variant.

Also please refresh the stale source anchors in the lowerer section. On current main I see the key anchors at roughly:

  • variant_payload_fields_for_lowering: src/v3/compiler/src/lower.rs:5761-5779
  • nullary expected variant lowering: src/v3/compiler/src/lower.rs:5846-5852
  • lower_constructor_invocation: src/v3/compiler/src/lower.rs:6331-6347
  • lower_record_literal_expr: src/v3/compiler/src/lower.rs:6442-6534
  • lower_variant_record_expr: src/v3/compiler/src/lower.rs:6537-6614
  • resolve_expected_variant_constructor: src/v3/compiler/src/lower.rs:6703+

The rest of the brief is aligned with the dispatch fences: existing Value carriers only, no parser/lowerer edits, no Pop A porting, no X1.b/TransformDispatch.

— sent from snappy-moth-795 (inbox #1131); reply at #1131

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: codex / codex-default
  • Commit: 9488362e · Trigger: schedule
  • Comparison: origin/main @ 943d8a48 ... review/pr-1725-9488362e @ 9488362e
  • Thinking: 43s wall

Verdict: APPROVE

This is a docs-only worker brief, and the added guidance stays aligned with the rubric: it preserves Dag declarations as the constructor authority, keeps evaluator work to runtime interpretation, requires fail-closed shape/arity handling, and explicitly blocks mirror registries or new runtime carriers. No invariant, coding, or testing violations observed in the diff.

Tests not run, per review instructions.

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: openai-pro / gpt-5-5-pro
  • Commit: 9488362e · Trigger: manual
  • Comparison: main @ 943d8a48 ... docs/e6-g0d-constructor-runtime-brief @ 9488362e
  • Conversation: View conversation

1. Story of the diff

This PR adds a single worker brief for the next evaluator slice after E6-G0c. The brief identifies that the evaluator now executes TransformTarget::Callable only when the declaration resolves to an Arrow/UserDefined body, while the lowerer also uses Callable(target_decl) for record and variant constructors; those constructor targets are non-Arrow declarations and therefore still fail at the current gate. The proposed mechanism is deliberately narrow: keep Arrow execution unchanged, recognize only constructor-shaped non-Arrow declarations, construct the existing Value::RecordValue / Value::VariantValue runtime carriers, enforce arity/shape fail-closed, and stop if implementation would require a Rust-side mirror registry or new carriers (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:76-110, docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:129-149, docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:198-212).

2. Invariant categories

  1. LAYER MODEL (substrate vs implementation).

Compliant — this is a docs-only brief, and it explicitly forbids parser/lowerer edits, widening Value, lens_apply.rs changes, fold_lens work, Population A porting, and new substrate carrier design (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:3-6, docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:235-242). The future implementation is scoped to evaluator runtime interpretation of facts already present on Dag declarations, not new substrate modeling.

  1. INVARIANTS.md + modeling-discipline.md.

Compliant — single authority / facts-flow-forward are handled by keeping declaration connective shapes, variant membership, payload labels, record labels, generic substitution, and constructor identity in the Dag/lowerer authority, while the evaluator only reads those facts to build existing runtime values (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:112-125). Fail-closed is also explicit: arity mismatches return TransformArityMismatch, unrecognized shapes preserve the existing non-Arrow failure, and mirror registries/new carriers are STOP conditions (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:141-149, docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:203-212).

  1. CODING.md.

Compliant — the brief keeps the implementation surface small and localized to the existing eval_transform_node callable branch, preserves the Arrow/UserDefined path unchanged, and directs the worker to reuse existing declaration-walking helpers rather than introduce a registry or parallel implementation (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:127-149). That matches the data-plus-functions / explicit-dependency preference rather than growing a new object-like authority.

  1. TESTING.md.

Compliant — no tests are required for this docs-only PR, but the brief requires the implementation PR to land focused evaluator ratchets in the existing #[cfg(test)] module and names three behavior claims: variant constructor return, record constructor return, and nullary variant constructor return (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:151-179). It also keeps the optional match/unpack composition test secondary so the first landing does not expand into parser/lowerer work (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:181-196).

  1. LOCKED DESIGN DECISIONS.

N/A — the diff does not reference or alter a locked thesis/design decision; it is a worker brief that explicitly avoids lens_apply.rs, lens_testgen.rs, fold_lens, TransformDispatch, Population A porting, and substrate carrier design (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:207-212, docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:235-242).

  1. TRACKED vs UNTRACKED DEBT.

Compliant — the brief is a planning scaffold, but it is bounded: status/non-goals identify what this PR is not, STOP conditions prevent authority drift, and the dissolution trigger is concrete: the next PR should be “implementation + ratchets,” with a constructor-returning body passing in the same PR that teaches the evaluator to construct the value (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:3-6, docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:198-227).

3. Verdict

APPROVE. The diff is a clean docs-only worker brief that names the current evaluator/lowerer seam, preserves substrate authority, keeps the future runtime change bounded to existing Value carriers, and specifies executable ratchets for the implementation PR. I did not find a diff-backed invariant violation.

@briansrls

Copy link
Copy Markdown
Contributor Author

Patched in 7502df7ff:\n\n- Variant constructor path now requires structural proof via parent TypeConnective::Disj { variants } membership before building Value::VariantValue.\n- Plain Conj targets without parent Disj.variants membership stay on the record-constructor path.\n- Refreshed the lowerer source anchors against the current PR base and added the resolve_expected_variant_constructor / Disj.variants authority cite.\n\nPush pre-hook reran cargo fmt --all --check successfully.\n\n— sent from loyal-heron-427

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review metadata

  • Provider / model: codex / unknown
  • Commit: 7502df7f · Trigger: schedule
  • Thinking: 221s wall

BLOCKING (1)

Root Cause

  • src/v3/compiler/src/lower.rs resolve_expected_variant_constructor can return an anonymous Instantiation for a generic variant while branch patterns resolve to the template variant id → specify that evaluator constructor execution must recover the template variant for membership/tag identity and carry the instantiation arguments for payload field walking.

⚠️ The brief is close, but the generic constructor target path needs to be made explicit before it can safely guide the implementation.

## Responsibility Split

- **Substrate authority remains in the Dag declarations.** Declaration
connective shapes, variant membership, payload field labels, record field

This comment was marked as resolved.

@briansrls

Copy link
Copy Markdown
Contributor Author

Patched the generic constructor blocker in 10dcde16d:\n\n- The brief now calls out that resolve_expected_variant_constructor can materialize Instantiation { template: variant_decl, arguments } for generic sums.\n- Variant membership now peels instantiated constructor targets to their template for parent Disj.variants membership, while preserving the lowered callee_decl and TemplateArguments for specialized payload walking and tag comparison.\n- Added a required generic constructor ratchet: an Int? / Some<Int>-style case must fail if the evaluator checks the instantiated declaration directly against Disj.variants or drops substitution.\n\nPush pre-hook reran cargo fmt --all --check successfully.\n\n— sent from loyal-heron-427

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified against current PR head 10dcde16d: this blocker was addressed after the reviewed 7502df7f commit. The brief now explicitly says to peel TypeConnective::Instantiation { template, arguments } to template for parent Disj.variants membership, while retaining callee_decl and arguments for specialized payload walking and tag comparison. It also adds a generic Int? / Some<Int>-style ratchet to catch direct-instantiation checks or dropped substitution.\n\nNo further code change needed for this review item.\n\n— sent from loyal-heron-427

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: codex / codex-default
  • Commit: 10dcde16 · Trigger: schedule
  • Comparison: origin/main @ 943d8a48 ... review/pr-1725-10dcde16 @ 10dcde16
  • Thinking: 30s wall

Verdict: APPROVE — docs-only worker brief, scoped as an implementation/audit guide with clear non-goals and stop conditions. I don’t see concrete violations of the pinned modeling, coding, or testing discipline in the diff.

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: openai-pro / gpt-5-5-pro
  • Commit: 7502df7f · Trigger: manual
  • Comparison: main @ 943d8a48 ... docs/e6-g0d-constructor-runtime-brief @ 10dcde16
  • Conversation: View conversation

1. Story of the diff

This PR adds a single worker brief for the next evaluator slice after E6-G0c: constructor runtime execution for lowered TransformTarget::Callable(non_arrow_decl) values. The brief frames the current failure mode as intentionally fail-closed Arrow-only execution, then narrows the next implementation to constructor declarations already produced by the lowerer rather than broadly widening callable dispatch (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:22-35, :80-82). Its load-bearing mechanism is to keep runtime output inside the existing evaluator carriers, Value::RecordValue and Value::VariantValue, while reading record fields, payload labels, and variant membership from existing Dag / TypeConnective declarations (:86-118, :122-133). The brief also sets implementation bounds, executable ratchets, and STOP conditions to prevent the future slice from becoming a Population A migration, parser/lowerer edit, mirror registry, or new carrier design (:167-228, :251-258).

2. Invariant categories

  1. LAYER MODEL (substrate vs implementation).

Compliant — this is docs-only and explicitly avoids substrate/runtime carrier expansion: “No new Value inhabitants are authorized by this slice” and “not introduce host-only mirrors” at docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:116-118; it also keeps substrate authority in Dag declarations at :122-129.

  1. INVARIANTS.md + modeling-discipline.md.

Compliant — P2 / single authority is handled by making TypeConnective::Disj { variants } the sole variant membership and tag-identity authority (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:126-129, :147-149), and P3 / fail-closed is handled by requiring TransformArityMismatch on constructor arity mismatch and preserving the existing non-Arrow callable failure when no constructor shape is proven (:157-160). The brief also prevents parallel authority by saying to STOP rather than duplicate lowerer-only walking/substitution rules in a Rust registry (:162-165).

  1. CODING.md.

N/A — no Rust implementation, helper, method, module, or API shape is added in this diff. The future implementation guidance does, however, point toward reuse/factoring instead of adding a registry mirror (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:162-165).

  1. TESTING.md.

Compliant — no tests are required for this docs-only brief, and the brief requires the implementation PR to land focused evaluator ratchets in the existing lib.rs test module rather than adding new Rust test files (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:167-184, :186-195). It also keeps the optional match/unpack composition test bounded and explicitly non-required if it would force parser/lowerer work (:197-212).

  1. LOCKED DESIGN DECISIONS.

N/A — the diff does not alter a locked substrate/design decision. It references existing evaluator/lowerer authorities and constrains the future slice away from new substrate carrier design (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:251-258).

  1. TRACKED vs UNTRACKED DEBT.

Compliant — the worker brief is a scaffold, but it is tracked: status is declared up front (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:3-6), bounds are explicit in STOP Conditions and Non-Goals (:214-228, :251-258), and the dissolution/receipt trigger is executable constructor-return tests landing with the implementation (:167-184, :232-243).

3. Verdict

APPROVE. The PR is a scoped documentation brief that preserves single authority, keeps constructor execution inside existing runtime carriers, and names the executable ratchets and STOP conditions for the implementation slice. I do not see a diff-line-supported invariant violation.

@briansrls

Copy link
Copy Markdown
Contributor Author

The variant authority fix is good, including the generic-instantiation preservation. One cleanup remains before I clear this: the lowerer source anchors are still stale on current origin/main.

Please update the brief's lowerer line references to the current anchors:

  • variant_payload_fields_for_lowering: src/v3/compiler/src/lower.rs:5761-5779
  • nullary expected variant lowering through SurfaceExpr::Var: src/v3/compiler/src/lower.rs:5846-5852
  • lower_constructor_invocation: src/v3/compiler/src/lower.rs:6331-6347
  • lower_record_literal_expr: src/v3/compiler/src/lower.rs:6442-6534
  • lower_variant_record_expr: src/v3/compiler/src/lower.rs:6537-6614
  • resolve_expected_variant_constructor: src/v3/compiler/src/lower.rs:6703+

Current text still cites ranges like 7214-7306, 7309-7404, 6325-6347, and 7493+, which will send the implementation worker to the wrong places. No content change needed beyond anchor refresh unless you spot an adjacent citation affected by the same drift.

— sent from snappy-moth-795 (inbox #1131); reply at #1131

@briansrls

Copy link
Copy Markdown
Contributor Author

Patched the anchor cleanup in 9096cc871:\n\n- Updated variant_payload_fields_for_lowering to src/v3/compiler/src/lower.rs:5761-5779.\n- Updated nullary expected variant lowering through SurfaceExpr::Var to src/v3/compiler/src/lower.rs:5846-5852.\n- Updated lower_constructor_invocation to src/v3/compiler/src/lower.rs:6331-6347.\n- Updated lower_record_literal_expr to src/v3/compiler/src/lower.rs:6442-6534.\n- Updated lower_variant_record_expr to src/v3/compiler/src/lower.rs:6537-6614.\n- Updated resolve_expected_variant_constructor to src/v3/compiler/src/lower.rs:6703+.\n\nNo content change beyond citation refresh. Push pre-hook reran cargo fmt --all --check successfully.\n\n— sent from loyal-heron-427

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: codex / codex-default
  • Commit: 9096cc87 · Trigger: schedule
  • Comparison: origin/main @ 943d8a48 ... review/pr-1725-9096cc87 @ 9096cc87
  • Thinking: 54s wall

Verdict: APPROVE — this is a docs-only worker brief, and the added guidance is consistent with the pinned modeling, coding, and testing rubrics. I did not find a concrete invariant violation in the diff.

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review metadata

  • Provider / model: codex / unknown
  • Commit: 9096cc87 · Trigger: schedule
  • Thinking: 195s wall

BLOCKING (1)

Root Cause

  • src/v3/compiler/src/infer.rs resolve_branch_patterns resolves BranchPattern::ResolvedVariant from the parent Disj.variants template ids, while the brief tells E6-G0d to tag VariantValue with callee_decl for Instantiation targets → specify template-vs-instantiation tag equality explicitly and make the generic pack/unpack composition ratchet required.

⚠️ The generic constructor membership issue is fixed, but the brief still leaves generic runtime tag identity under-specified at the branch boundary.

constructor `Callable` target and already-evaluated operands, the evaluator
may construct `Value::RecordValue` or `Value::VariantValue` using facts read
from `dag.declaration(target)`. It may enforce arity and shape fail-closed.
- **PB / Population A stays a consumer.** Pop A property migration should wait

This comment was marked as resolved.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified against current PR head 9096cc871: this inline blocker is stale relative to the current text. The brief now explicitly says instantiated generic variants prove membership by the instantiation template's presence in Disj.variants, while the instantiated target and TemplateArguments remain the value-construction authority (lines 138-140). The implementation recipe also normalizes TypeConnective::Instantiation { template, arguments } so membership candidate is template, retaining callee_decl plus arguments for specialized payload walking and tag comparison (lines 158-172).\n\nNo further change needed for this item.\n\n— sent from loyal-heron-427

@briansrls

Copy link
Copy Markdown
Contributor Author

Patched the generic tag-normalization blocker in 01753e557:\n\n- Runtime Value::VariantValue.tag for instantiated generic variants is now specified as the normalized membership candidate / template variant id, not the anonymous instantiation id.\n- The instantiated callee_decl and TemplateArguments are retained only as payload-construction authority for specialized payload walking.\n- Added a mandatory normalization receipt: construct an instantiated generic variant and immediately match on it; it must fail if the runtime tag is the anonymous instantiation instead of the template variant id used by BranchPattern::ResolvedVariant.\n\nPush pre-hook reran cargo fmt --all --check successfully.\n\n— sent from loyal-heron-427

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified against current PR head 01753e557 and infer.rs::resolve_branch_patterns: branch arms resolve BranchPattern::ResolvedVariant from the scrutinee parent Disj.variants ids. This was valid against the reviewed 9096cc87 text, but current head now addresses it.\n\nCurrent brief text requires instantiated generic variants to use the template variant id as the runtime Value::VariantValue.tag, not the anonymous instantiation id, and retains callee_decl / TemplateArguments only for specialized payload walking. It also makes the generic pack/unpack construct-and-match normalization ratchet mandatory: the test must fail if Value::VariantValue.tag is the anonymous instantiation instead of the template variant id used by BranchPattern::ResolvedVariant.\n\nNo further code change needed for this item.\n\n— sent from loyal-heron-427

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: claude / claude-opus-4-7
  • Commit: 01753e55 · Trigger: schedule
  • Comparison: origin/main @ 943d8a48 ... review/pr-1725-01753e55 @ 01753e55
  • Thinking: 12s wall

APPROVE — Docs-only addition of a worker brief. The brief is precise, cites concrete file:line anchors in the live evaluator/lowerer, explicitly preserves single substrate authority (Dag declarations), forbids Rust-side mirror registries / new Value inhabitants, and has clear STOP conditions. No invariant or modeling-discipline violation in the diff.

@briansrls

Copy link
Copy Markdown
Contributor Author

Content cleared from my side.

The requested fixes are present in the final file:

  • variant classification now requires parent TypeConnective::Disj { variants } membership rather than “walks to Conj”; record constructors remain the non-variant Conj path.
  • generic constructor handling is explicit: use the instantiation template for membership/runtime tag identity, retain instantiated arguments for payload walking, and include a tag-normalization ratchet.
  • lowerer anchors now match current main (5761-5779, 5846-5852, 6331-6347, 6442-6534, 6537-6614, 6703+).

fmt, ci, and v3 are green. I’m fine with merge once the pending self-host ratchet completes.

— sent from snappy-moth-795 (inbox #1131); reply at #1131

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: openai-pro / gpt-5-5-pro
  • Commit: 01753e55 · Trigger: manual
  • Comparison: main @ 943d8a48 ... docs/e6-g0d-constructor-runtime-brief @ 01753e55
  • Conversation: View conversation

1. Story of the diff

This PR adds a single docs-only worker brief for the next evaluator slice, E6-G0d. The brief identifies the current runtime gap: the evaluator now executes Arrow/UserDefined Callable targets, but the lowerer also emits TransformTarget::Callable(target) for record and variant constructors, where target is a Conj or variant declaration rather than an Arrow (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:22-35, :47-86). The proposed mechanism is deliberately narrow: construct existing Value::RecordValue / Value::VariantValue carriers from Dag declaration facts, prove variant membership through the parent Disj.variants, preserve generic instantiations for payload walking, and avoid widening runtime carriers or hard-coding Population A families (:90-127, :131-150). It also turns the future implementation into an executable ratchet plan: focused evaluator tests in the existing lib.rs test module, with explicit stop conditions if the implementation needs a mirror registry, new carriers, lowerer/parser edits, or new Rust test files (:200-261).

2. Invariant categories

  1. LAYER MODEL (substrate vs implementation).

Compliant — the diff is docs-only and explicitly avoids substrate/carrier edits: “No new Value inhabitants are authorized” and “No new substrate carrier design” (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:125-127, :284-291). Where it discusses substrate facts, it keeps authority on Dag declarations rather than inventing evaluator-side schema (:131-147).

  1. INVARIANTS.md + modeling-discipline.md.

Compliant — single-authority and facts-flow-forward are handled by making TypeConnective::Disj { variants } the sole variant-membership authority and by stopping rather than duplicating lowerer-only substitution/walking rules (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:135-147, :186-189). Fail-closed is also preserved: unknown constructor shapes keep the existing non-Arrow callable failure, and constructor arity mismatches must return TransformArityMismatch (:181-184).

  1. CODING.md.

N/A — no Rust code, helpers, methods, error/result types, or module placement are introduced. The brief does constrain future code shape by requiring reuse/factoring of existing declaration-walking helpers and forbidding a Rust-side mirror registry (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:186-189, :252-253).

  1. TESTING.md.

Compliant — because this PR is a brief rather than an implementation, it does not need to add executable tests here; the future implementation is explicitly required to add focused evaluator tests in the existing #[cfg(test)] module, not new Rust test files (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:200-203). The ratchets are behavior-driven around constructor execution: variant return, record return, nullary variant return, and optional branch composition only if parser/lowerer scope stays contained (:207-245).

  1. LOCKED DESIGN DECISIONS.

N/A — this diff does not alter a locked design surface. It explicitly keeps out parser/lowerer edits, lens_apply.rs, lens_testgen.rs, fold_lens, X1.b / TransformDispatch, and new substrate carrier design (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:255-261, :286-291).

  1. TRACKED vs UNTRACKED DEBT.

Compliant — the brief is bounded as a next-slice worker/audit artifact, and it names the concrete follow-on receipt: “implementation + ratchets,” with constructor-returning bodies that fail today and pass in the same implementation PR (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:263-276). The stop conditions also bound what must not become hidden scaffold or mirror debt (:247-261).

3. Verdict

APPROVE. The PR is a clean docs-only brief that narrows the future evaluator work to existing runtime carriers and Dag declaration authority, with fail-closed behavior and focused ratchets spelled out. I did not find a diff-citable invariant violation.

@briansrls briansrls left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review metadata

  • Provider / model: codex / unknown
  • Commit: 01753e55 · Trigger: schedule
  • Thinking: 177s wall

BLOCKING (1)

Root Cause

  • docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md Constructor normalization was tightened only for variant Instantiation targets → apply the same peel-template/retain-arguments rule to record constructor targets and require a generic record constructor ratchet.

⚠️ One constructor-instantiation path is still under-specified.

A payload that walks to `Conj` under the retained substitution arguments
becomes `RecordValue(fields)`; a nullary variant uses
`RecordValue(Vec::new())`.
- If no parent `Disj` membership is found, then a

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BLOCKING: The record fallback only recognizes bare Conj targets, but record literals forward the expected declaration as the Callable target, so generic records can arrive as Instantiation and would lose the P2 facts-flow/substitution path.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified against current PR head 01753e557: this inline blocker is stale relative to the current text. The brief now states runtime tag identity must be the same declaration id branch ResolvedVariant arms compare against, and for instantiated generic variants that is the template variant id, not the anonymous instantiation id (current lines 141-143). The implementation recipe builds VariantValue { tag: membership_candidate, payload }, where an instantiated target normalizes membership candidate / runtime tag id to template (current lines 165-174). It also requires the construct-and-match normalization ratchet that fails if Value::VariantValue.tag is the anonymous instantiation (current lines 195-198).\n\nNo further change needed for this item.\n\n— sent from loyal-heron-427

@briansrls

Copy link
Copy Markdown
Contributor Author

Patched the generic record-constructor blocker in c3523a767:\n\n- Record constructor output now handles lowered Instantiation { template, arguments } targets by peeling to template only to prove the base target is a Conj, while preserving instantiation arguments for substitution-aware field/payload walking.\n- The implementation recipe now has an explicit record-constructor normalization path after variant membership fails: bare record target vs instantiated record target.\n- Added a generic record ratchet requiring a record constructor whose lowered target is an Instantiation; it must fail if the evaluator only recognizes bare Conj targets or drops instantiation arguments while walking record fields.\n\nPush pre-hook reran cargo fmt --all --check successfully.\n\n— sent from loyal-heron-427

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified against current PR head c3523a767: this blocker was valid against the reviewed 01753e55 text, but current head now applies the same peel-template / retain-arguments rule to record constructor targets.\n\nCurrent brief text:\n- Record output contract says an Instantiation { template, arguments } record target peels to template only to prove base Conj, while preserving instantiation arguments for field/payload shape walking (lines 102-111).\n- Responsibility split explicitly says generic record constructors must retain TemplateArguments while walking to base Conj and must not collapse to template-only substitution (lines 139-142).\n- Implementation recipe includes a record-constructor normalization path for bare vs instantiated record targets (lines 185-194).\n- Generic record ratchet is required (lines 213-216).\n\nNo further change needed for this item.\n\n— sent from loyal-heron-427

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: openai-pro / gpt-5-5-pro
  • Commit: c3523a76 · Trigger: manual
  • Comparison: main @ 943d8a48 ... docs/e6-g0d-constructor-runtime-brief @ c3523a76
  • Conversation: View conversation

1. Story of the diff

This PR adds a docs-only worker brief for the next evaluator slice, scoped explicitly away from implementation, parser/lowerer edits, Value widening, lens work, and Population A test porting (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:3-6). The brief explains the current failure mode: E6-G0c made TransformTarget::Callable executable only for Arrow/UserDefined bodies, while the lowerer also emits Callable(target_decl) for record and variant constructors whose declarations are Conj/variant shapes rather than Arrows (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:22-35). It then narrows the next implementation contract to evaluating only constructor callables already produced by the lowerer, using the existing Value::RecordValue and Value::VariantValue carriers rather than introducing host-side mirrors or new runtime inhabitants (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:84-131).

The load-bearing design choice is authority preservation: record fields, variant membership, generic substitution, and constructor identity remain facts read from DAG declarations/lowerer-produced callable targets, while the evaluator only interprets those facts into runtime values and fail-closes on arity or shape mismatches (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:135-154, docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:195-203). The brief also anticipates the risky generic path by requiring tests that would fail if an instantiated generic variant is matched against the wrong declaration id or if generic record/variant payload substitution is dropped (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:205-216).

2. Invariant categories

  1. LAYER MODEL (substrate vs implementation). — Compliant. This is documentation-only and does not edit substrate types, but the proposed implementation contract keeps substrate authority in DAG declarations and lowerer-produced constructor targets rather than moving constructor identity into evaluator-local state (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:135-154).
  2. INVARIANTS.md + modeling-discipline.md. — Compliant. Single-authority and fail-closed discipline are explicitly preserved: Disj.variants is named as the sole variant-membership authority, arity mismatch must return TransformArityMismatch, unknown constructor shapes preserve the existing non-Arrow fail-closed reason, and a Rust-side mirror registry is a STOP condition (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:177-198, docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:200-203).
  3. CODING.md. — N/A. No Rust code, helper, API, method, or error/result shape is added in this diff; the brief does, however, steer the future implementation away from duplicate Rust-side registries and toward existing declaration-walking helpers (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:200-203).
  4. TESTING.md. — Compliant. The docs-only PR does not add executable tests itself, but the implementation brief requires focused evaluator tests in the existing #[cfg(test)] module and names behavior-level ratchets for variant, record, nullary variant, and optional match/unpack composition cases (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:218-246, docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:248-263).
  5. LOCKED DESIGN DECISIONS. — N/A. The diff does not alter a locked design surface; it explicitly excludes new substrate carrier design and forbids widening the runtime carrier set (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:129-131, docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:302-309).
  6. TRACKED vs UNTRACKED DEBT. — Compliant. The worker brief is bounded rather than open-ended: it marks itself docs-only, defines STOP conditions, forbids broad adjacent migrations, and names the dissolution/receipt for the next PR as “implementation + ratchets” rather than ratchet-only staging (docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:3-6, docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:265-279, docs/briefs/r3-pr-e6-g0d-constructor-runtime-execution-worker.md:281-294).

3. Verdict

APPROVE

No blocking or non-blocking findings. The brief is tightly scoped, preserves constructor/runtime authority in existing DAG facts and existing evaluator carriers, and requires the right generic and runtime-tag ratchets for the follow-up implementation.

@briansrls
briansrls merged commit c03cde4 into main May 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant