Skip to content

R3 gate #37: cost_lens_reads_target_realization (T-CostLens-Composition) - #3086

Merged
briansrls merged 34 commits into
mainfrom
session/royal-dove-906
May 14, 2026
Merged

briansrls merged 34 commits into
mainfrom
session/royal-dove-906

Conversation

@briansrls

@briansrls briansrls commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements the R3 gate #37 cost-lens target-realization composition path by adding compose_symbolic_cost_with_realization_costs, a small public helper that folds RealizationCostAmount values from RealizationCostTable into the existing SymbolicCost sequential algebra. The gate #37/#70 and R3 free-consequences receipts now exercise the shared helper while keeping realization costs sourced from LanguageSpec rows.

V3 Hand-Rust Gate / P5 Mechanism (b) Receipt

Exactly one Mechanism (b) receipt applies to the expanded hand-written Rust in src/v3/compiler/src/lib.rs:

  • Deferral receipt: lane T-PB-A; concrete ROADMAP row ROADMAP.md § "Lane acceptance — .dag gates" / pb_hand_rust_at_shim_floor. src/v3/compiler/src/lib.rs remains in the SG-0 non-test hand-Rust census until PB-zero / pipeline-emitted Rust dissolves hand-maintained compiler helpers. This PR does not add a new SG-0 census entry or new file; it expands an existing expected hand-authored non-test path.

Supporting single-authority evidence for this deferral: the new helper introduces no new substrate authority; it only wraps the existing sequential(SymbolicCost, ConstantCost(amount.value())) composition and accepts only validated RealizationCostAmount values produced by RealizationCostTable. Checkable consumers are src/v3/compiler/tests/integration/lens_cost_target_realization_test.rs and src/v3/compiler/tests/integration/r3_free_consequences_second_batch_test.rs.

Test plan

  • cargo test -p v3-compiler --test integration lens_cost_target_realization_test -- --nocapture passed remotely via BuildBuddy: 13 passed.
  • cargo test -p v3-compiler --test integration r3_free_consequences_second_batch_test -- --nocapture passed remotely via BuildBuddy after the origin/main merge: 4 passed.
  • GitHub Actions have been re-running after automatic main merges; latest dashboard/GitHub status should be used as the source of truth for the current head.

@briansrls
briansrls marked this pull request as ready for review May 14, 2026 16:52
@briansrls

Copy link
Copy Markdown
Contributor Author

Addressed the P5 hand-Rust receipt finding by updating the PR body with a checkable V3 Hand-Rust Gate / P5 receipt covering the new helper, its single-authority relationship to RealizationCostTable and SymbolicCost::sequential, and the integration consumers that exercise it. — sent from royal-dove-906

@briansrls

Copy link
Copy Markdown
Contributor Author

Tightened the PR body to use exactly one P5 Mechanism (b) receipt: a deferral receipt naming lane T-PB-A and the concrete ROADMAP row § "Lane acceptance — .dag gates" / . This avoids overstating the planning-table narrative as a standalone P5 receipt while keeping the single-authority evidence as supporting context. — sent from royal-dove-906

@briansrls

Copy link
Copy Markdown
Contributor Author

Correction: tightened the PR body to use exactly one P5 Mechanism (b) receipt: a deferral receipt naming lane T-PB-A and the concrete ROADMAP row ROADMAP.md § "Lane acceptance — .dag gates" / pb_hand_rust_at_shim_floor. This avoids overstating the planning-table narrative as a standalone P5 receipt while keeping the single-authority evidence as supporting context. — sent from royal-dove-906

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified against the current PR body: the P5 process note is already satisfied there under “V3 Hand-Rust Gate / P5 Mechanism (b) Receipt.” It names exactly one Mechanism (b) shape: a deferral receipt for lane T-PB-A with concrete ROADMAP row ROADMAP.md § "Lane acceptance — .dag gates" / pb_hand_rust_at_shim_floor. No code or branch change is needed for this approve-with-process-note item. — sent from royal-dove-906

@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: c04cfdc2 · Trigger: schedule
  • Thinking: 115s wall

BLOCKING (1)

Root Cause

  • docs/r3-program-plan.md The planning receipt redefines the P5 gate as "narrow wrapper/no second authority" instead of satisfying the hand-Rust receipt taxonomy → replace it with exactly one allowed P5 receipt: deleted scaffold path, SG-0 before/after shrink, or explicit deferral naming a lane and concrete ROADMAP.md row.

⚠️ The code change itself looks narrowly scoped, but the required P5 hand-Rust receipt is incomplete.

Comment thread docs/r3-program-plan.md Outdated
| 35 | `bridge_exact_string_patching_residual_retired` | state-check | T-Bridge-Retirement | **PASSING** | PB lower-helper slice retired in `bridge_ledger.dag`; residual Row-4 classes → `bridge_exact_string_semantic_patching_residual` (Open) |
| 36 | `bridge_retirement_ledger_zero` | ledger-count | T-Bridge-Retirement | DECLARED | unified ledger reports 0 |
| 37 | `cost_lens_reads_target_realization` | structural-fold | T-CostLens-Composition | **INTEGRATION_RECEIPT (partial — ε-slice)** — `src/v3/compiler/tests/integration/lens_cost_target_realization_test.rs` pins `cost_lens_composes_symbolic_cost_with_rust_type_realization_row` (Rust-side `symbolic_cost_of` × `Semiring<SymbolicCost>::sequential` × bootstrap `rust_int.TypeRealization.cost`) and `cost_lens_reads_cost_field_on_rust_callable_realization_row` (`rust_is_empty_callable.CallableRealization.cost`). ε ratification (Q-Cost-Composition-Layering / PR #2181): lens output stays abstract `SymbolicCost`; per-primitive realization rows remain emit-time facts — **gates #40 + #70** now carry separate integration receipts in `m1_5_verification_test.rs` + the same `lens_cost_target_realization_test.rs` module (2026-05-12 bundle); row #37 remains the partial ε-slice for composition-row wiring alone. | Rust-side composition consumer + cited integration tests |
| 37 | `cost_lens_reads_target_realization` | structural-fold | T-CostLens-Composition | **INTEGRATION_RECEIPT (partial — ε-slice)** — `src/v3/compiler/tests/integration/lens_cost_target_realization_test.rs` pins `cost_lens_composes_symbolic_cost_with_rust_type_realization_row` (Rust-side `symbolic_cost_of` × `Semiring<SymbolicCost>::sequential` × bootstrap `rust_int.TypeRealization.cost`) and `cost_lens_reads_cost_field_on_rust_callable_realization_row` (`rust_is_empty_callable.CallableRealization.cost`). ε ratification (Q-Cost-Composition-Layering / PR #2181): lens output stays abstract `SymbolicCost`; per-primitive realization rows remain emit-time facts — **gates #40 + #70** now carry separate integration receipts in `m1_5_verification_test.rs` + the same `lens_cost_target_realization_test.rs` module (2026-05-12 bundle); row #37 remains the partial ε-slice for composition-row wiring alone. **P5 hand-Rust receipt (PR #3086):** `v3_compiler::realization_cost::compose_symbolic_cost_with_realization_costs` is a narrow Rust-side consumer wrapper over the existing `Semiring<SymbolicCost>::sequential` + `ConstantCost` composition, takes only validated `RealizationCostAmount` values from `RealizationCostTable`, and is exercised by `lens_cost_target_realization_test.rs` plus `r3_free_consequences_second_batch_test.rs`; it introduces no second realization-cost authority. | Rust-side composition consumer + cited integration tests |

This comment was marked as resolved.

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.

Verified against current HEAD: fixed in commit 397ffbc (docs: make gate 37 P5 receipt checkable). The gate #37 row now uses exactly one INVARIANTS.md P5 Mechanism (b) receipt shape: explicit deferral for expanded non-test hand-Rust in src/v3/compiler/src/lib.rs, naming lane T-PB-A and concrete ROADMAP row ROADMAP.md § "Lane acceptance — .dag gates" / pb_hand_rust_at_shim_floor. The single-authority wrapper details are now supporting evidence, not the P5 receipt itself. — sent from royal-dove-906

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the optional rustdoc observation against current HEAD. The comment is fair as a wording nit: the helper accepts RealizationCostAmount values, while callers perform the RealizationCostTable / LanguageSpec row lookup before calling it. I am not pushing a doc-only fix-forward because the manager has explicitly requested no further branch churn while the current-head review/merge race is being handled, and this was non-blocking under an APPROVE review. The existing tests and PR body still pin the table-derived single-authority path. — sent from royal-dove-906

@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: 4766d467 · Trigger: schedule
  • Thinking: 158s wall

Non-blocking — Strengths

  • src/v3/compiler/src/lib.rs compose_symbolic_cost_with_realization_costs is implementation-layer code and delegates to the existing sequential authority over SymbolicCost, so it does not create a second cost algebra.

ROADMAP — Verified

  • pb_hand_rust_at_shim_floor: ROADMAP.md Lane acceptance — .dag gates contains the T-PB-A row and names pb_hand_rust_at_shim_floor as the non-test SG-0 hand-Rust gate.

✅ No blocking concerns.

@briansrls
briansrls merged commit 8c4b53f into main May 14, 2026
4 checks passed
@briansrls
briansrls deleted the session/royal-dove-906 branch May 14, 2026 21:59
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