Skip to content

T-LBP: cement cost lens via symbolic_cost_of + Band-C registry slice (#1968) - #2298

Merged
cursor[bot] merged 10 commits into
mainfrom
cursor/t-lbp-complexity-cost-wiring-f0e1
May 9, 2026
Merged

cursor[bot] merged 10 commits into
mainfrom
cursor/t-lbp-complexity-cost-wiring-f0e1

Conversation

@briansrls

@briansrls briansrls commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

SG-0 hand-path delta: +0

bright-crab-416 — re: codex review on 3fe59a03 (SizeVariable / cost.dag header)

The claim that live std/Rust only has source_port is false on current HEAD (4c80d6b2f):

  • src/v3/std/algebra.dag — type SizeVariable { source_port: PortId; display_name: String? } and fn size_variable_eq(a, b) -> Bool = a.source_port == b.source_port.
  • src/v3/compiler/src/dag_cost_generated.rs — pub struct SizeVariable { pub source_port: PortId, pub display_name: Option<String> } with PartialEq comparing only source_port.

So the cost.dag header’s references to display_name and identity via size_variable_eq match the substrate; no code change for this item. (Could not post as an issue comment: integration lacks addComment.)

Review follow-up — briansrls inline (Band-C vs cost_lens_symbolic_consumer_test, 2026-05-09)

Commit 4c80d6b: Module + expect_symbolic_cost docs state v3-only scope while cost.dag stays PROXY; Band-C v2-oracle work attaches at COMPLETE + v2 counterpart (TESTING.md).

CI fix — SG-0 census sort (8fffe867b)

Failure: sg0_census_test::sg0_expected_list_is_sorted_and_unique (EXPECTED_HAND_AUTHORED_TEST strict ASCII order).

Fix: List cost_lens_symbolic_consumer_test.rs after integration/common/*, before cross_target_coverage_carrier_test.rs.

Prior CI fixes

  • Slow-test meta-ratchet 41/41: f1434b71f

Ref. #1968

Open in Web Open in Cursor 

cursoragent and others added 2 commits May 9, 2026 03:29
- Rewrite cost_lens_behavioral_completion to assert generated symbolic_cost_of
  on compile_to_dag fixtures (aligned with complexity_of cementing pattern).
- Extend CEMENTING_MODULES_FOR_V2_COMPLETE_CLAIMS with cost_symbolic →
  cost_lens_behavioral_completion after promoting cost.dag to COMPLETE in the
  capability register (T-LBP gate #83 in-scope lens pair).
- Refresh cost.dag status header, register cross-links, and r3-structure #83
  bullet to match.

Co-authored-by: Brian Searls <briansrls@users.noreply.github.com>
Co-authored-by: Brian Searls <briansrls@users.noreply.github.com>

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

BLOCKING (3)

Root Cause

  • src/v3/std/algebra.dag SizeVariable/producer/v2-oracle parity prerequisites from the cost-lens slice have not landed → either land those prerequisites and the same-source oracle cementing before COMPLETE, or keep the row PROXY/narrowed with an explicit trigger.
  • src/v3/compiler/tests/integration/cementing/cost_lens_behavioral_completion.rs The test scope was narrowed from v2 parity to v3 consumer regression → add the v2 oracle/projection comparison or do not use it as the COMPLETE-row Band-C receipt.
  • src/v3/std/algebra.dag SizeVariable.display_name is still only design/roadmap work → land the field and producers atomically or remove the display_name claim.

⚠️ The PR narrows the cost lens to a useful v3 consumer cementing slice, but it marks that slice as full behavioral completion before the documented parity obligations are actually closed.

Comment thread docs/v3-lens-capability-register.md Outdated
|---|---|---|---|---|---|
| `complexity.dag` | TERMINAL | COMPLETE | `src/v2/complexity.dag` (5488L) | `v3.std.lookup::Lookup<ComplexitySummary> = Miss \| Hit(ComplexitySummary)` per port (generated consumer: `src/v3/compiler/src/lens_cost_generated.rs` via `regen_lens` / `emit_rust_module`; Rust surface exports `complexity_of` plus a legacy `cost_of` int-depth adapter for pre-existing test-runner paths). `ComplexitySummary` carries `work`, `span`, `asymptotic_class`, `work_certainty`, and `span_certainty`; the lens consumes live `CallPattern` facts through `per_call_pattern_at`, composes all transform inputs, and preserves loop source/init producer costs before recurrence composition. | N/A — behavioral-completion substrate landed in #2220: symbolic work/span costs, SizeVariable display names, certainty, asymptotic classification, and recurrence consumption are present; frozen-oracle cementing dispatch is wired by `complexity_lens_behavioral_completion`. |
| `cost.dag` | TERMINAL | **PROXY** | v2 `CostExpr` (embedded in `complexity.dag`) | `v3.std.lookup::Lookup<SymbolicCost> = Miss \| Hit(SymbolicCost)` per port (generated consumer: `src/v3/compiler/src/lens_cost_symbolic_generated.rs` via `regen_lens` / `emit_rust_module`; Rust surface re-exports `SymbolicCostLookup` as a type alias for `Lookup<SymbolicCost>`); E-C stages `std.computation::CallPattern` / `LoweringTarget`; E-I stages `std.induction::SubValueRelation` / `CostBound`; E-P adds the first side-table `v3_compiler::dag::per_call_descent_evidence` producer; E-M method carrier parity is closed by structural subsumption. **T-CostLens-Composition α-narrow disposition** (Director-ratified at gunb-ai/gunbc#828 #issuecomment-4400772335 via PR #2171): §1.8 gates **#38** `coercion_cost_equals_complexity_by_construction` + **#39** `no_coercion_cost_dimension` are structurally satisfied at HEAD by construction (`SymbolicCost` algebra at `src/v3/std/algebra.dag:181-188` is the sole cost dimension; `Semiring<SymbolicCost>` `sequential` / `iterate` composition is the only authority — no parallel cost dimension exists). Gates **#37** `cost_lens_reads_target_realization`, **#40** `symbolic_cost_expr_equals_executable`, **#70** `cost_lens_demonstration` close via **ε path** RATIFIED 2026-05-07 (Q-Cost-Composition-Layering canvas at PR #2181; canonical-not-transitional): Rust-side composition reading abstract `SymbolicCost` × per-primitive realization-cost in T-CostLens follow-on slice. Q-Lens-Target-Context (β-extended substrate-wide refactor) DEFERRED to N=2 trigger event (second lens with target-context need; emission_provenance most likely candidate per cross-cutting analysis). #2175 follow-on issue continues tracking cross-cutting scope umbrella. | Named `SizeVar` with value semantics (v3's `SizeVariable` carries only `source_port: PortId`). `Dimension<SymbolicCost>` wiring deferred on grammar gaps. **E-I carriers are present and E-P has a first narrow producer slice;** broader producer coverage, cost/complexity lens consumption, and the same-source v2/v3 cementing test remain pending. |
| `cost.dag` | TERMINAL | COMPLETE | v2 `CostExpr` (embedded in `complexity.dag`) | `v3.std.lookup::Lookup<SymbolicCost> = Miss \| Hit(SymbolicCost)` per port (generated consumer: `src/v3/compiler/src/lens_cost_symbolic_generated.rs` via `regen_lens` / `emit_rust_module`; Rust surface re-exports `SymbolicCostLookup` as a type alias for `Lookup<SymbolicCost>`); E-C stages `std.computation::CallPattern` / `LoweringTarget`; E-I stages `std.induction::SubValueRelation` / `CostBound`; E-P adds the first side-table `v3_compiler::dag::per_call_descent_evidence` producer; E-M method carrier parity is closed by structural subsumption. **T-CostLens-Composition α-narrow disposition** (Director-ratified at gunb-ai/gunbc#828 #issuecomment-4400772335 via PR #2171): §1.8 gates **#38** `coercion_cost_equals_complexity_by_construction` + **#39** `no_coercion_cost_dimension` are structurally satisfied at HEAD by construction (`SymbolicCost` algebra at `src/v3/std/algebra.dag:181-188` is the sole cost dimension; `Semiring<SymbolicCost>` `sequential` / `iterate` composition is the only authority — no parallel cost dimension exists). Gates **#37** `cost_lens_reads_target_realization`, **#40** `symbolic_cost_expr_equals_executable`, **#70** `cost_lens_demonstration` close via **ε path** RATIFIED 2026-05-07 (Q-Cost-Composition-Layering canvas at PR #2181; canonical-not-transitional): Rust-side composition reading abstract `SymbolicCost` × per-primitive realization-cost in T-CostLens follow-on slice. Q-Lens-Target-Context (β-extended substrate-wide refactor) DEFERRED to N=2 trigger event (second lens with target-context need; emission_provenance most likely candidate per cross-cutting analysis). #2175 follow-on issue continues tracking cross-cutting scope umbrella. | N/A — T-LBP narrowed scope: generated `symbolic_cost_of` (`lens_cost_symbolic_generated.rs`) is cemented by `cost_lens_behavioral_completion` on `compile_to_dag` fixtures. Full-corpus frozen v2-oracle parity and broader **E-P** coverage remain roadmap work (see "Common root causes"). |

This comment was marked as resolved.

(composed, witnesses)
fn expect_symbolic_cost(dag: &v3_compiler::dag::Dag, bind_name: &str) -> SymbolicCost {
let port = find_bind_value(dag, bind_name);
match symbolic_cost_of(dag, &port) {

This comment was marked as resolved.

Comment thread src/v3/lenses/cost.dag Outdated
//
// Produces `Lookup<SymbolicCost>` per port using `SymbolicCost` combinators
// (`sequential`, `iterate`, `max_path`) from `std.algebra`. `SizeVariable` carries
// `source_port` and optional `display_name` when producers populate it. Broader **E-P**

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 new header says SizeVariable carries optional display_name, but the actual src/v3/std/algebra.dag declaration still only carries source_port, so the lens documentation overstates the live substrate.

cursoragent and others added 2 commits May 9, 2026 03:54
…ETE contract

Register COMPLETE requires subsuming the v2 counterpart and an N/A 'drops'
column (Discipline §2, status-marker table). Revert the cost.dag row to **PROXY**
and drop cost_symbolic from the Band-C escalation slice accordingly.

- cost_lens_behavioral_completion stays as explicit consumer-wiring receipt only.
- Restore r3-structure gate #83 bullet to 'cost remains... until slice lands.'
- cost.dag header: PROXY + note linking tests to Band-C gating.

Co-authored-by: Brian Searls <briansrls@users.noreply.github.com>
TESTING.md Band-C applies to subsumption / COMPLETE+v2-counterpart claims with
v2-oracle or reviewed projection. cost.dag stays PROXY; keeping this module under
cementing/ with behavioral_completion naming misrepresented the obligation.

- Rename to cost_lens_symbolic_consumer_test.rs under integration/ (not cementing/).
- Drop cements_* / cementing thread names; cite TESTING.md in module docs.
- Update sg0 census, cost.dag header, slow-test exemptions.

Co-authored-by: Brian Searls <briansrls@users.noreply.github.com>
SizeVariable carries source_port + optional display_name (presentation); identity
is source_port-only. The prior header claimed only source_port, which was stale
relative to src/v3/std/algebra.dag and dag_cost_generated.rs.

Co-authored-by: Brian Searls <briansrls@users.noreply.github.com>
@briansrls
briansrls marked this pull request as ready for review May 9, 2026 04:35
@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: codex / codex-default
  • Commit: 3fe59a03 · Trigger: schedule
  • Comparison: origin/main @ 87291782 ... review/pr-2298-3fe59a03 @ 3fe59a03
  • Thinking: 57s wall

Findings

  • scripts/slow-test-exemptions.txt:70 and scripts/slow-test-exemptions.txt:71 add two new >2s ratchet exemptions without the authority the file requires. The header says every exemption “MUST cite either a ROADMAP item or a project memory,” but these comments only say “PROXY cost lens” / “same CI wall class as complexity cementing.” That leaves the debt untracked rather than documented and named, which conflicts with TESTING.md’s cost-of-change discipline and INVARIANTS.md P5’s requirement that scaffolds have a bounded dissolution path.

Verdict: APPROVE_WITH_COMMENTS

The code/test reshaping itself looks clean and the Band-C vs PROXY split is documented consistently in the new test and cost.dag. The only concrete issue I found is the missing structural authority on the two new slow-test exemptions.

cursoragent and others added 2 commits May 9, 2026 04:41
…ions

slow-test-exemptions.txt requires ROADMAP or named program authority per
header; tie cost_lens_symbolic_consumer_test lines to Lane E-P, plan gate #80,
register PROXY row, partner brief, and #1968.

Co-authored-by: Brian Searls <briansrls@users.noreply.github.com>
PR #2298 added two cost_lens_symbolic_consumer_test exemptions; exempt_count
must equal TEST_TIMEOUT_MAX_EXEMPTIONS — default was still 39, failing the v3
per-test ratchet step.

Co-authored-by: Brian Searls <briansrls@users.noreply.github.com>

@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: 3fe59a03 · Trigger: schedule
  • Thinking: 170s wall

⚠️ Prior blocker 3212382252 remains: the added cost.dag header still claims SizeVariable.display_name/size_variable_eq, but the live std/Rust carrier only has source_port.

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: cursor / composer-2
  • Commit: f1434b71 · Trigger: schedule
  • Comparison: origin/main @ 87291782 ... review/pr-2298-f1434b71 @ f1434b71
  • Thinking: 30s wall

Findings: None. The diff keeps Band-C obligations aligned with TESTING.md (PROXY row: consumer/regression pin outside integration/cementing/, documented in cost_lens_symbolic_consumer_test.rs module docs). Slow-test exemptions cite ROADMAP/R3 gate and paydown; the ratchet floor matches the added rows. dimension.rs already routes through symbolic_cost_of, so pinning that generated consumer tests the same lens authority the dimension path uses (P2 shared read, not parallel authority). No substrate DAG/API shape violations in this diff.

Verdict: APPROVE — Scoped doc/test relocation, census path update, and timeout exemptions are consistent with the rubric; nothing here warrants changes on invariant grounds.

Exploratory observations (optional): The new recursive fixture uses n == 0 where the deleted test used n <= 0, which changes behavior for negative n if that input class is accepted; likely harmless for cost-shape assertions but worth a quick sanity check if negative recursion is meaningful in fixtures elsewhere. The previous module also asserted witness hygiene (Violates / UnknownCost absent); the new tests only assert the composed SymbolicCost from symbolic_cost_of, so any regression that surfaces only via dimension witnesses would no longer be caught here—reasonable tradeoff for a PROXY consumer pin, but strictly weaker along that axis.

cursoragent and others added 2 commits May 9, 2026 04:57
sg0_expected_list_is_sorted_and_unique requires strict ascending paths;
cost_lens_symbolic_consumer_test.rs must follow integration/common/*
(integration/cost > integration/common).

Co-authored-by: Brian Searls <briansrls@users.noreply.github.com>
cost_lens_symbolic_consumer_test is v3-only by design while cost.dag stays
PROXY; Band-C v2-oracle obligations attach only to COMPLETE+v2-counterpart
register rows (TESTING.md). No behavior change.

Co-authored-by: Brian Searls <briansrls@users.noreply.github.com>
@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: cursor / composer-2
  • Commit: 4c80d6b2 · Trigger: schedule
  • Comparison: origin/main @ 87291782 ... review/pr-2298-4c80d6b2 @ 4c80d6b2
  • Thinking: 24s wall

Findings: None. The diff correctly scopes cost coverage as consumer wiring for generated symbolic_cost_of while cost.dag stays PROXY, matching TESTING.md Band‑C (tests live outside integration/cementing/ with explicit docs). Switching the pin from analyze_symbolic_cost_dimension to the regen consumer aligns with P2 (“generated consumer proof”) rather than weakening it. Slow-test exemptions cite ROADMAP/R3 paydown; SG‑0 census and exemption ratchet stay consistent. cost.dag header text matches the Rust SizeVariable { source_port, display_name } shape in dag_cost_generated.rs (not part of this diff, but the edited comment is consistent). The countdown fixture uses n == 0 like complexity_lens_behavioral_completion, so the change vs the deleted n <= 0 version is intentional alignment.

Verdict: APPROVE — Narrow, coherent test and doc move with CI knobs updated; no invariant or testing-discipline violations spotted in the diff.

PR description now includes `SG-0 hand-path delta: +0` (swap census rows,
net hand paths unchanged). GitHub does not re-run pull_request CI on body-only
edits under current workflow types.

Co-authored-by: Brian Searls <briansrls@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants