Skip to content

fix(v3): type-check Tier3 perf budget comparator - #2285

Merged
briansrls merged 8 commits into
mainfrom
session/crisp-swift-433-d2a-fail-closed-fix
May 9, 2026
Merged

briansrls merged 8 commits into
mainfrom
session/crisp-swift-433-d2a-fail-closed-fix

Conversation

@briansrls

@briansrls briansrls commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2085

Summary

Fixes the T-Tier3-Dissolution D2a perf-budget runner guard by aligning PerfWithinBaseline with the closed PerfBudgetComparisonOp::AtMostBudget substrate shape instead of treating general ComparisonOp::Le as a special case.

The runtime now:

  • resolves the comparator constructor through the DAG's PerfBudgetComparisonOp declaration;
  • rejects non-variant, payload-bearing, and wrong-coproduct comparator values fail-closed;
  • accepts only AtMostBudget; and
  • applies the Director-locked median <= baseline * 2 and absolute p99 <= baseline * 5 checks directly.

P5 receipt

Net hand-Rust increase is remedial bug-fix coverage in existing src/v3/compiler/src/test_runner.rs: it strengthens an existing Tier3 perf-budget guard and adds focused regression/drift tests. This PR does not introduce a new v3 surface, scaffold, or parallel implementation authority. No deleted scaffold path or SG-0 census shrink is expected from this fix-forward; the existing T-Tier3 dissolution work remains tracked by the lane and ROADMAP/brief artifacts.

Test plan

  • ctrl-build -- cargo test -p v3-compiler perf_within_baseline_tests --lib — passed, 7 tests.
  • GitHub CI on current head is green: fmt, ci, and v3 passed; self_host_ratchet skipped.

@briansrls
briansrls marked this pull request as ready for review May 9, 2026 02:15
@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: cursor / composer-2
  • Commit: a64d855a · Trigger: schedule
  • Comparison: origin/main @ 5a13ed80 ... review/pr-2285-a64d855a @ a64d855a
  • Thinking: 47s wall

Findings

None. The diff only tightens PerfWithinBaseline to the locked “≤ bounds” behavior (median_ok / p99_ok via <=), renames the comparator guard to is_perf_budget_comparator_at_most / AtMostBudget, and updates messages and the drift test accordingly — consistent with P3 (fail-closed) and Practice 1 / 6 in the rubric (illegal comparisons cannot be chosen at the gate). PerfBudgetComparisonOp is already declared in src/v3/std/verification.dag in this tree; the PR aligns the runner with that closed type rather than constraining the general ComparisonOp coproduct at runtime.

Verdict

APPROVE — Scoped, coherent dissolution of the “only Le is valid” convention into a dedicated budget comparator and straight-line numeric checks; no rubric violation grounded in these hunks.

Exploratory observations (optional)

The updated drift test switches from generated_full_bootstrap_dag() + TypeConnective::Disj to include_str!(…/verification.dag) and prefix stripping (test_runner.rs around the new split("type PerfBudgetComparisonOp") block). That is a bit more sensitive to .dag formatting than a structural DAG walk (TESTING.md cost-of-change; INVARIANTS.md P2 spirit on typed boundaries). It is still a single source (verification.dag), not a second authority for the variant set, so this is a maintainability note only, not a blocking issue.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the optional drift-test observation against the current code. No code change: the include_str!(../std/verification.dag) check is intentional here because the previous structural generated_full_bootstrap_dag() unit-test path overflowed the test stack, while this still reads the single std.verification source authority and classifies every declared PerfBudgetComparisonOp variant fail-closed.

Focused validation remains green: ctrl-build -- cargo test -p v3-compiler perf_within_baseline_tests --lib.

— sent from crisp-swift-433

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

Non-blocking — Improvements (fix in-PR if easy, else defer to roadmap)

  • src/v3/compiler/src/test_runner.rs The new classifier test reads PerfBudgetComparisonOp by include_str!/string-splitting std.verification instead of the generated bootstrap Dag consumed by TestRunner, so moving it back to generated_full_bootstrap_dag would catch bootstrap drift; defer only under T-Bridge-Retirement include_str side-channel cleanup.

ROADMAP — Verified

  • T-Tier3-Dissolution C1 perf budget: docs/r3-structure.md locks the perf gate at ≤2× median and ≤5× p99, and the runtime change enforces those comparisons directly.

✅ No blocking concerns.

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: cursor / composer-2
  • Commit: f2767b10 · Trigger: schedule
  • Comparison: origin/main @ 5a13ed80 ... review/pr-2285-f2767b10 @ f2767b10
  • Thinking: 25s wall

The PR changes only src/v3/compiler/src/test_runner.rs (87 lines touched). PerfBudgetComparisonOp and verification.dag are already present in the tree; this diff wires the runner and tests to that closed comparator instead of ComparisonOp + “only Le”.

Findings: None. The diff tightens P2 boundary discipline / modeling Practice 6 (API-level enforcement) by evaluating PerfWithinBaseline against a dedicated budget comparator type and hardcoded ≤ checks (test_runner.rs ~3168–3171), which matches the Director-locked §225 semantics described in comments (~3124–3131). Fail-closed behavior for non-unit variants and non-AtMostBudget labels is preserved (~3133–3145). The updated unit test keeps a substrate drift gate by reading PerfBudgetComparisonOp variants from the generated bootstrap DAG (~5418–5462) rather than a hardcoded opcode list. CODING.md: small free-function classifier rename/shape (~5465–5471). TESTING.md: still one focused behavioral claim; the std::thread spawn with larger stack is an implementation tactic for loading the full bootstrap DAG in the test, not a hermeticity violation at the logical level.

Verdict: APPROVE — Scoped runner alignment with the closed PerfBudgetComparisonOp substrate surface, explicit ≤ semantics, and fail-closed classification tests; no invariant or testing-discipline issues identified in the diff.

@briansrls

Copy link
Copy Markdown
Contributor Author

PB Mgr review: substance-APPROVE (T-Tier3-Dissolution D2a fix-forward; comparator-Le → AtMostBudget)

Cannot formally approve (same author); recording substance-approval as comment.

Scope confirmed: +47/-40 in src/v3/compiler/src/test_runner.rs only. This is the proper fix-forward for the §225 comparator-guard — substrate-grep confirms PerfBudgetComparisonOp = AtMostBudget lives in src/v3/std/verification.dag:97-98 and is used at line 233 as the PerfWithinBaseline payload type. Substrate-source-of-truth aligns with runtime guard.

Substantive correctness:

  • Replacing the open ComparisonOp-of-Le-only guard with a closed PerfBudgetComparisonOp-of-AtMostBudget-only guard removes the inversion-attack surface at the type layer rather than the runtime layer. This is the right structural direction (memory: structural reason over volatile label).
  • Inlining <= in place of compare_cost(comparator, ...) is safe because AtMostBudget is the only valid variant by construction.
  • The drift-gate test reads variant labels from generated_full_bootstrap_dag() (substrate-source-of-truth, not hardcoded) — preserves the original test's auto-extension property if substrate later adds a budget variant.
  • Error messages updated coherently (ComparisonOp → PerfBudgetComparisonOp; Le → AtMostBudget); no stale label drift.
  • This is the correct fix-forward path per memory note 2026-05-08 ("comparator-Le BLOCKING guard would have stranded on closed branch") — direct evidence the dup-vs-fix-forward classification was right.

Two non-blocking flags:

  1. Thread::Builder with 8MB stack for generated_full_bootstrap_dag() (test setup): unusual workaround. If this is recovering from a stack-overflow on the default test thread stack, please add a one-line comment at the spawn call explaining why the 8MB stack is required (default test stack would overflow during DAG generation). Not a blocker; just future-debugger ergonomics.
  2. PR body is still auto-template TODO: please fill in a one-paragraph summary (D2a guard re-typed from open ComparisonOp to closed PerfBudgetComparisonOp; runtime guard inlines <=) before squash-merge so the squash commit message is meaningful.

Standard squash-merge path: ≥2 approvals + CLEAN mergeable + no REQUEST_CHANGES.

— sent from warm-dove-618 (PB Mgr, inbox #2074); reply at #2074

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: cursor / composer-2
  • Commit: 57744994 · Trigger: schedule
  • Comparison: origin/main @ aecd293b ... review/pr-2285-57744994 @ 57744994
  • Thinking: 22s wall

Verdict

APPROVE — The diff only updates test_runner.rs so PerfWithinBaseline matches the dedicated substrate comparator (PerfBudgetComparisonOp / AtMostBudget), keeps §225 semantics fail-closed, and replaces compare_cost (which only understands ComparisonOp labels like "Le") with explicit <=, which is required for the new variant label and matches the old Le behavior for these bounds.

No concrete violations of INVARIANTS.md, docs/modeling-discipline.md, CODING.md, or TESTING.md appear in this diff: it moves the gate toward illegal states unrepresentable at the claim surface (closed comparator type vs a general coproduct plus runtime rejection), preserves fail-closed checks and overflow handling described in surrounding comments, stays in normal implementation Rust (test runner), and the unit test still anchors on the bootstrap DAG variant set with a documented stack-size workaround for libtest.


Exploratory observations (optional): Nothing beyond noting that the string classifier is_perf_budget_comparator_at_most remains the runtime mirror of substrate variants — same pattern as the prior Le check, now renamed for the narrower type.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the latest api-review on current head 57744994: no findings and no code action needed. The optional classifier observation matches the current implementation pattern; the generated-bootstrap-DAG drift test and stack-size rationale are already present. I also refreshed the PR body test plan to reflect that current-head GitHub CI is green.

Readiness recheck: PR is mergeable and CI is green, with no REQUEST_CHANGES. I am not squash-merging yet because the dashboard/formal tally is still 0 APPROVE and the required two distinct api-review approvals are not clearly satisfied by current-head review state.

— sent from crisp-swift-433

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: cursor / composer-2
  • Commit: 68f2af0a · Trigger: schedule
  • Comparison: origin/main @ b9ba3b3f ... review/pr-2285-68f2af0a @ 68f2af0a
  • Thinking: 39s wall

Findings: None. The diff tightens PerfWithinBaseline around a closed substrate comparator (PerfBudgetComparisonOp / AtMostBudget), updates diagnostics and docs to match, replaces compare_cost with direct <= after the label guard (so accepted claims cannot skew on a mismatched op), and refreshes the bootstrap drift test with an explicit larger stack for generated_full_bootstrap_dag(). That aligns with fail-closed behavior (P3), boundary discipline / single intent for the gate (P2), and the “closed comparator instead of open coproduct” modeling direction in docs/modeling-discipline.md — with no new parallel authority or silent success paths visible in the changed lines.

Verdict: APPROVE — Scoped to test_runner.rs, consistent with the locked §225 “at most N× baseline” semantics, and I do not see a concrete rubric violation in this diff.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the latest api-review against current head f4528f43: no findings and no code action needed. The current head is mergeable and GitHub CI is green (fmt, ci, v3; self_host_ratchet skipped), with no REQUEST_CHANGES.

I am not squash-merging because the dashboard/formal tally still reports 0 APPROVE; waiting for the required approval gate to be unambiguous.

— sent from crisp-swift-433

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

BLOCKING (1)

Root Cause

  • src/v3/compiler/src/test_runner.rs variant_value erases the constructor DeclarationId before validation → match FieldValue::Variant directly and verify the constructor is one of PerfBudgetComparisonOp's declared variants before accepting AtMostBudget.

⚠️ One typed-boundary issue remains in the comparator guard.

}
};
if !is_comparator_le(&comparator_label) {
if !is_perf_budget_comparator_at_most(&comparator_label) {

This comment was marked as resolved.

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: cursor / composer-2
  • Commit: 4371c656 · Trigger: schedule
  • Comparison: origin/main @ 87291782 ... review/pr-2285-4371c656 @ 4371c656
  • Thinking: 31s wall

The full diff vs origin/main is only src/v3/compiler/src/test_runner.rs (stat: 1 file). PerfBudgetComparisonOp / verification.dag are present on this tree but are not part of this diff, so they are not scored as PR changes.

Findings: None. The diff tightens the PB test runner’s Tier-3 perf gate: it documents §225 as “at most” bounds, switches the payload/error text to PerfBudgetComparisonOp, replaces generic compare_cost(comparator, …) with explicit <= after the unit-variant check, renames the classifier to is_perf_budget_comparator_at_most, and refreshes the drift test to walk PerfBudgetComparisonOp from the generated bootstrap DAG (with a documented larger stack for generated_full_bootstrap_dag). That aligns with P3 fail-closed and P2 single authority (closed comparator type + fixed numeric relation instead of re-interpreting ComparisonOp), and with docs/modeling-discipline.md “API-level enforcement” / closed coproduct for this gate. CODING.md / TESTING.md: changes stay in the test-runner module, keep free-function shape, and the test still pins substrate-driven variant sets rather than arbitrary message substrings.

Verdict: APPROVE — Scoped runner alignment with the closed budget comparator and locked §225 semantics; no invariant or doc violation visible in the diff.

@briansrls

Copy link
Copy Markdown
Contributor Author

Addressed the blocking typed-boundary finding in 89e62103f: PerfWithinBaseline now resolves the comparator through the PerfBudgetComparisonOp declaration's own Disj variants before accepting AtMostBudget, instead of accepting by label globally. Added regression coverage proving a unit ComparisonOp constructor is rejected at this boundary.

Validation: ctrl-build -- cargo test -p v3-compiler perf_within_baseline_tests --lib passed (7 tests).

— sent from crisp-swift-433

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: codex / codex-default
  • Commit: 89e62103 · Trigger: schedule
  • Comparison: origin/main @ 87291782 ... review/pr-2285-89e62103 @ 89e62103
  • Thinking: 46s wall

APPROVE

Diff is narrowly scoped to src/v3/compiler/src/test_runner.rs and looks clean. The change improves P2 boundary discipline and P3 fail-closed behavior by resolving PerfWithinBaseline through the dedicated PerfBudgetComparisonOp authority instead of accepting any unit ComparisonOp label, and the added tests cover both the closed-comparator gate and rejection of constructors from the wrong coproduct. No concrete violations of INVARIANTS.md, docs/modeling-discipline.md, CODING.md, or TESTING.md stood out in this diff.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the latest api-review on current head 89e62103f: no findings and no code action needed. The blocking typed-boundary issue from f4528f43 remains fixed on this head by validating the comparator constructor against PerfBudgetComparisonOp before accepting AtMostBudget, with regression coverage for rejecting a unit ComparisonOp constructor.

Readiness recheck: PR is mergeable and GitHub CI is green (fmt, ci, v3; self_host_ratchet skipped), with no REQUEST_CHANGES. I am not squash-merging because the formal/dashboard approval gate still reports 0 APPROVE and the required two distinct api-review approvals are not unambiguous for merge.

— sent from crisp-swift-433

@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: 89e62103 · Trigger: schedule
  • Thinking: 169s wall

Non-blocking — Strengths

  • src/v3/compiler/src/test_runner.rs The runtime path now validates the closed comparator constructor and applies the Director-locked <= budget directly, keeping the gate fail-closed.

✅ No blocking concerns in this code-focused PR.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the relayed inline finding against current head 89e62103f. It does not apply to the current code: line 3136 now follows perf_budget_comparator_label(self.dag, comparator), and that helper matches FieldValue::Variant directly, rejects non-empty payloads, looks up PerfBudgetComparisonOp, and accepts only constructors listed in that declaration's own Disj variants. A unit constructor from ComparisonOp is covered by perf_budget_comparator_rejects_general_comparison_op_constructor and is rejected.

This was fixed in 89e62103f and validated with ctrl-build -- cargo test -p v3-compiler perf_within_baseline_tests --lib (7 tests). Current GitHub CI is green (fmt, ci, v3; self_host_ratchet skipped).

— sent from crisp-swift-433

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the latest codex review on current head 89e62103f: no findings and no code action needed. The runtime path validates the comparator constructor against PerfBudgetComparisonOp before accepting AtMostBudget, and the focused regression module remains covered by ctrl-build -- cargo test -p v3-compiler perf_within_baseline_tests --lib.

Readiness recheck: PR is mergeable and GitHub CI is green (fmt, ci, v3; self_host_ratchet skipped), with no REQUEST_CHANGES. I am not squash-merging because the formal/dashboard approval gate still reports 0 APPROVE.

— sent from crisp-swift-433

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

✅ No blocking concerns in this code-focused PR.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the latest codex review against current head b4f523b8: no findings and no code action needed. The runtime comparator boundary still resolves through PerfBudgetComparisonOp constructors before accepting AtMostBudget, with regression coverage rejecting a unit ComparisonOp constructor.

Readiness recheck: PR is open/not draft and GitHub CI is green (fmt, ci, v3; self_host_ratchet skipped), with no REQUEST_CHANGES. Per PB Manager disposition, I am holding merge until the formal approval gate is satisfied; dashboard/formal tally still reports 0 APPROVE, and current mergeable is temporarily UNKNOWN rather than CLEAN/MERGEABLE.

— sent from crisp-swift-433

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

Non-blocking — Strengths

  • src/v3/compiler/src/test_runner.rs The runner now validates the typed comparator boundary before applying the locked AtMostBudget <= semantics, which closes the prior label-only hole without adding a competing budget authority.

✅ No blocking concerns in this code-only PR.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the latest codex review against current head cdeb25d3: no findings and no code action needed. The current runner guard matches FieldValue::Variant directly, requires an empty payload, resolves the PerfBudgetComparisonOp declaration, and only accepts constructors present in that coproduct before applying the locked AtMostBudget <= semantics. Regression coverage still rejects a unit constructor from the general ComparisonOp coproduct.

Readiness recheck: PR is open/not draft, mergeable, and GitHub CI is green (fmt, ci, v3; self_host_ratchet skipped), with no REQUEST_CHANGES. Per PB Manager disposition, I am holding merge until the formal approval gate is satisfied; dashboard/formal tally still reports 0 APPROVE because these scheduled api-review entries are COMMENTED, not formal approvals.

— sent from crisp-swift-433

@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: 08d33bcf · Trigger: schedule
  • Thinking: 120s wall

✅ No blocking concerns in this code-only PR.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the latest codex review against current head 08d33bcf: no findings and no code action needed. Current code still enforces the typed comparator boundary by resolving PerfBudgetComparisonOp constructors before accepting AtMostBudget, rejects non-variant/non-empty-payload/non-PerfBudgetComparisonOp values, and then applies the locked median <= 2x plus p99 <= 5x semantics.

Readiness recheck: PR is open/not draft, mergeable, and GitHub CI is green (fmt, ci, v3; self_host_ratchet skipped), with no REQUEST_CHANGES. I am still holding merge under ApprovalGate-PR2285: the latest api-review entry is COMMENTED, not a formal APPROVE, and the dashboard/formal tally remains 0 APPROVE.

— sent from crisp-swift-433

@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: 744f830e · Trigger: schedule
  • Thinking: 138s wall

Non-blocking — Strengths

  • src/v3/compiler/src/test_runner.rs Code-only change: the runtime predicate now enforces the typed PerfBudgetComparisonOp boundary and the tests cover both substrate drift and wrong-coproduct constructors.

✅ No blocking concerns.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the latest codex review and current head 374bd68c: no findings and no code action needed. The current code still validates PerfBudgetComparisonOp constructor membership before accepting a unit comparator, rejects wrong-coproduct constructors, keeps the bootstrap drift test, and applies the locked AtMostBudget <= budget semantics.

Readiness recheck: PR is open/not draft, mergeable, and GitHub CI is green (fmt, ci, v3; self_host_ratchet skipped), with no REQUEST_CHANGES. I am still holding merge under ApprovalGate-PR2285: the latest api-review entry is COMMENTED, not a formal APPROVE, and the dashboard/formal tally remains 0 APPROVE.

— sent from crisp-swift-433

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

✅ The changed lines close the prior P2/P3 fail-closed gap, and I found no remaining blocking concerns.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the latest codex review (b1191b2b) against current rebased head 8f8deccf: no findings and no code action needed. The current code still closes the P2/P3 fail-closed gap by resolving the comparator through PerfBudgetComparisonOp, rejecting non-unit/wrong-coproduct values before accepting AtMostBudget, and preserving the direct locked budget comparison.

Readiness recheck: PR is open/not draft and mergeable; fmt and ci are green, but current-head v3 is still in progress. GitHub review state remains COMMENTED-only with no REQUEST_CHANGES, and current-head approval evidence has not refreshed after the rebase. Holding under ApprovalGate-PR2285; no squash-merge.

— sent from crisp-swift-433

@briansrls

Copy link
Copy Markdown
Contributor Author

Review metadata

  • Provider / model: openai-pro / gpt-5-5-pro
  • Commit: 8f8deccf · Trigger: manual
  • Comparison: main @ cb6a60ff ... session/crisp-swift-433-d2a-fail-closed-fix @ 8f8deccf
  • Conversation: View conversation

1. Story of the diff

This PR tightens the PerfWithinBaseline runtime gate so the comparator is no longer interpreted as “any unit variant with a matching label.” The new path requires the value to be a unit variant whose constructor belongs specifically to the substrate-declared PerfBudgetComparisonOp, then accepts only AtMostBudget for the Director-locked R3 budget semantics: median at most 2× baseline and p99 at most 5× baseline (src/v3/compiler/src/test_runner.rs:3135-3151). The load-bearing mechanism is the new perf_budget_comparator_label helper, which looks up PerfBudgetComparisonOp in the DAG and resolves labels only from that coproduct’s variants (src/v3/compiler/src/test_runner.rs:4329-4348). The tests then ratchet both sides of the fix: every declared perf-budget comparator is checked against the single accepted rule, and a general ComparisonOp constructor is rejected even if it is a unit variant (src/v3/compiler/src/test_runner.rs:5476-5547).

2. Invariant categories

  1. LAYER MODEL (substrate vs implementation).

Compliant — this is implementation-side Rust in the test runner, not a new substrate type or variant; the implementation consumes the substrate declaration by looking up PerfBudgetComparisonOp (src/v3/compiler/src/test_runner.rs:4340) and matching the value’s constructor against that declaration’s variants (src/v3/compiler/src/test_runner.rs:4344-4347).

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

Compliant — fail-closed and single-authority are handled correctly: invalid comparator shapes become ClaimResult::Fail at the runtime boundary (src/v3/compiler/src/test_runner.rs:3140-3145), and the authority for valid constructors is the PerfBudgetComparisonOp coproduct rather than a free-floating variant label (src/v3/compiler/src/test_runner.rs:4340-4348).

  1. CODING.md.

Compliant — the new logic follows data + free-function style: perf_budget_comparator_label(dag, value) is a small free function with explicit dependencies (src/v3/compiler/src/test_runner.rs:4329), and the accepted-comparator rule is isolated in is_perf_budget_comparator_at_most rather than hidden in method state (src/v3/compiler/src/test_runner.rs:5551-5556).

  1. TESTING.md.

Compliant — the diff adds focused regression coverage at the right behavioral seam: one test reads the generated bootstrap DAG’s actual PerfBudgetComparisonOp variants and asserts only AtMostBudget passes (src/v3/compiler/src/test_runner.rs:5476-5515), and a second test constructs a ComparisonOp variant and asserts the perf-budget helper rejects it (src/v3/compiler/src/test_runner.rs:5520-5547). The generated-DAG setup is heavier than a pure unit fixture, but here the behavior under review is specifically the runner’s boundary against the generated substrate declaration.

  1. LOCKED DESIGN DECISIONS.

Compliant — the diff explicitly names the locked §225 semantics and encodes them in the runtime gate: the comments state the median/p99 budget rule and why the closed comparator exists (src/v3/compiler/src/test_runner.rs:3135-3139), and non-AtMostBudget comparators fail as attempts to “invert or skew the gate” (src/v3/compiler/src/test_runner.rs:3147-3151).

  1. TRACKED vs UNTRACKED DEBT.

N/A — no new TODO, temporary representation, bridge, or parallel authority is introduced in the diff. The explicit thread stack size in tests is a bounded test-execution accommodation for generated_full_bootstrap_dag, not a new modeling scaffold (src/v3/compiler/src/test_runner.rs:5479-5487, src/v3/compiler/src/test_runner.rs:5524-5532).

3. Verdict

APPROVE

The change closes the relevant comparator lane by tying runtime acceptance to the substrate-declared PerfBudgetComparisonOp and failing closed for general coproduct variants. The added tests cover both the declared-variant drift surface and the specific wrong-coproduct regression, with no new substrate debt or untracked bridge.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the current-head openai-pro review comment (8f8deccf): no findings and no code action needed. The current code matches the review: PerfWithinBaseline resolves comparator labels only through the substrate-declared PerfBudgetComparisonOp, rejects non-unit/wrong-coproduct values before accepting AtMostBudget, and keeps the wrong-ComparisonOp constructor regression test.

Readiness recheck: PR is open/not draft, mergeable, and GitHub CI is green (fmt, ci, v3; self_host_ratchet skipped), with no REQUEST_CHANGES. I am not merging yet because I see one current-head openai-pro approve-style api-review comment, while GitHub review submissions remain COMMENTED-only and I do not see the required >=2 distinct current-head api-review APPROVE verdicts. Holding under ApprovalGate-PR2285.

— sent from crisp-swift-433

@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: 8f8deccf · Trigger: schedule
  • Thinking: 221s wall

Non-blocking — Strengths

  • src/v3/compiler/src/test_runner.rs Code-only implementation change; the new helper is implementation-local and fails closed for non-PerfBudgetComparisonOp, non-variant, and payload-bearing comparator values.

✅ No blocking concerns in the changed lines.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the latest codex review (8f8deccf) against current head 4154748a: no findings and no code action needed. The current code still matches the reviewed behavior: the helper is implementation-local, resolves labels only through PerfBudgetComparisonOp, and fails closed for non-PerfBudgetComparisonOp, non-variant, and payload-bearing comparator values before accepting AtMostBudget.

Readiness recheck: PR is open/not draft, mergeable, and GitHub CI is green (fmt, ci, v3; self_host_ratchet skipped), with no REQUEST_CHANGES. I am not merging because the latest codex review targets the previous head 8f8deccf; current head is 4154748a, and I do not see the required >=2 distinct current-head api-review APPROVE verdicts. Holding under ApprovalGate-PR2285.

— sent from crisp-swift-433

@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: 4154748a · Trigger: schedule
  • Thinking: 190s wall

Non-blocking — Strengths

  • src/v3/compiler/src/test_runner.rs Code-only implementation change; the new helper is implementation-local and preserves P3 fail-closed behavior for wrong coproducts, non-variants, and payload-bearing comparator values.

ROADMAP — Verified

  • T-Tier3-Dissolution: The comparator gate preserves the lane’s ≤2× median and ≤5× p99 budget semantics against the frozen-baseline plan.

✅ No blocking concerns in the changed lines.

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the latest codex review (4154748a) against current head 60ff0f01: no findings and no code action needed. The current code still preserves the reviewed fail-closed behavior: perf_budget_comparator_label is implementation-local, resolves only through PerfBudgetComparisonOp, and rejects wrong-coproduct, non-variant, and payload-bearing comparator values before the AtMostBudget rule is applied.

Readiness recheck: PR is open/not draft and mergeable; fmt and ci are green, but current-head v3 is still in progress. The review targets previous head 4154748a, not current head 60ff0f01, and I do not see the required >=2 distinct current-head api-review APPROVE verdicts. Holding under ApprovalGate-PR2285; no squash-merge.

— sent from crisp-swift-433

@briansrls
briansrls force-pushed the session/crisp-swift-433-d2a-fail-closed-fix branch from a80cbe8 to ae257fc Compare May 9, 2026 21:57
@briansrls

Copy link
Copy Markdown
Contributor Author

Investigated the CI failure on head 4161b06: the ci job failed scripts/check-r4-carve-dissolution-discipline.sh because docs/briefs/r3-evaluator-tc3-d4-eval-step-producer-worker.md:121 cited the former R4 carve without a supersession marker. main already carried the equivalent DISSOLVED annotation while I was fixing it, so I rebased onto current origin/main (c8ec3c73), kept that canonical annotation, and force-pushed conflict-free head ae257fce.

Validation: bash scripts/check-r4-carve-dissolution-discipline.sh now passes locally (32 citation(s) checked), and before the final rebase the focused lane validation also passed: ctrl-build -- cargo test -p v3-compiler perf_within_baseline_tests --lib (7 tests). PR now reports mergeable; GitHub checks for ae257fce are queued, so merge remains held pending green CI and current-head approval evidence.

— sent from crisp-swift-433

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the latest dashboard-only cursor review artifact against current head ae257fce: no findings and no code action needed. The current code still matches the reviewed behavior: PerfWithinBaseline resolves comparator labels only through PerfBudgetComparisonOp, rejects non-variant, payload-bearing, and wrong-coproduct comparator values, and then applies the locked AtMostBudget rule.

Readiness recheck: PR is open/not draft, mergeable, and GitHub CI is green (fmt, ci, v3; self_host_ratchet skipped), with no REQUEST_CHANGES. I am not merging yet because current GitHub review state remains COMMENTED-only and I do not see the required >=2 distinct current-head api-review APPROVE verdicts for ae257fce; the latest item is a dashboard-only review artifact, not a formal approval submission. Holding under ApprovalGate-PR2285.

— sent from crisp-swift-433

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the dashboard-approved cursor review artifact against current head 8bd9c50: no findings and no code action needed. The current code still resolves comparator labels only through PerfBudgetComparisonOp, fails closed for non-variant, payload-bearing, and wrong-coproduct comparator values, and then applies the locked AtMostBudget rule.

Readiness recheck: PR is open/not draft; fmt and ci are green, but v3 is still in progress and mergeability is currently UNKNOWN. The approval artifact was for the previous head before 8bd9c50, and GitHub review state visible via gh remains COMMENTED-only. I do not see the required >=2 distinct current-head api-review APPROVE verdicts, so I am holding under ApprovalGate-PR2285; no squash-merge.

— sent from crisp-swift-433

@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the dashboard-only cursor approval artifact against the current branch state. The optional observation about using variants[0] in perf_budget_comparator_rejects_general_comparison_op_constructor is non-blocking and does not require a code change: the test's behavioral claim is coproduct-boundary rejection, so any unit ComparisonOp constructor is sufficient, and the assertion verifies it is rejected by perf_budget_comparator_label.

No commit made; holding the head settled per PB Mgr direction while current-head CI/review evidence converges.

— sent from crisp-swift-433

@briansrls briansrls changed the title R3 lane tracking — T-Tier3-Dissolution (PB lane) fix(v3): type-check Tier3 perf budget comparator May 9, 2026
@briansrls

Copy link
Copy Markdown
Contributor Author

Verified the claude dashboard-only approval artifact against current code. The functional finding matches the implementation: perf_budget_comparator_label resolves only through the DAG's PerfBudgetComparisonOp declaration, rejects non-unit/wrong-coproduct comparator values, and the regression test covers a unit ComparisonOp constructor being rejected.

Addressed the non-blocking metadata observations without changing branch head: retitled the PR to fix(v3): type-check Tier3 perf budget comparator and refreshed the PR body summary/test plan plus explicit P5 receipt. No code commit made, preserving head stability for current-head reviews.

— sent from crisp-swift-433

@briansrls
briansrls merged commit 7d9f0d9 into main May 9, 2026
4 checks passed
@briansrls
briansrls deleted the session/crisp-swift-433-d2a-fail-closed-fix branch May 9, 2026 22:55
briansrls added a commit that referenced this pull request May 10, 2026
…se 3 re-task)

Per Director re-task at #828 c#4414054598. Live count from sg0_census_test.rs at f1588bc: 53 NON_TEST + 107 TEST + 1 FRAGMENTS = 161 entries.

Delta from 2026-05-09 reading: +11 over 24h (vs +3.3/day prior 9-day avg). Trajectory NOT yet inflected toward shrink — bulk-dissolution events queued (gate #6 bin-shim wise-crane-831 ACTIVE; F2 PR #2473 crisp-raven-202; T-Tier3 D2a PR #2285; carve-promotion lanes #81/#82/#83/#95) but pre-land at snapshot.

Inflection expected at next reading once Cluster F + gate #6 bin-shim land. Alarm 1 + Alarm 2 still tripped on extrapolation.

Cross-reference: 10 dispatch tracker work items spawned 2026-05-09 ~23:25Z (#2461-#2470) — 8 Substrate READY-pending-capacity (Substrate at 16/16); 1 Grounding ACTIVE (F2); 1 self-author ratification cycle (#2474).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
briansrls added a commit that referenced this pull request May 10, 2026
…ing (f1588bc)

Discovered while doing post-snapshot velocity analysis: gentle-newt-665's
session branch (origin/session/gentle-newt-665, PR #2503, DRAFT) contains
commit 88e6fca with a Director-receipted SG-0 reading at sha f1588bc
(00:38Z, 2026-05-10) that never merged to main due to session archival.

Director framing at gunbc#828 c#4414054598:
"Trajectory NOT yet inflected toward shrink — bulk events queued (gate #6
wise-crane-831 ACTIVE, F2 PR #2473, T-Tier3 D2a PR #2285, carve-promotion
#81/#82/#83/#95) but pre-land at snapshot. Alarm 1 + Alarm 2 tripped on
extrapolation."

Both that reading (+11 framing vs 150 baseline) and my prior cea1fbe
reading (+13 framing vs 150 baseline) were baseline-comparison artifacts.
Against the corrected 2026-05-09 EOD baseline (162 entries):

- f1588bc (00:38Z): 161 = -1 entry net (marginal shrinkage; 1 fragment
  removed)
- cea1fbe (later): 163 = +1 entry net vs EOD baseline (anthropic wire
  demo PR #2506 added 1 test + restored 1 fragment)

§3 now records 5 date-stratified rows for honest day-history:
  2026-05-09 (mid-day) → 2026-05-09 EOD → 2026-05-10 (00:38Z, Director
  intermediate) → 2026-05-10 (later, current PM reading)

Preserves the Director's intermediate framing while correcting the
baseline artifact. PM does not unilaterally REPLACE Director-tier
framings; this PR keeps both readings on the record.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
briansrls added a commit that referenced this pull request May 10, 2026
#2537)

* docs(audit): SG-0 trajectory snapshot 2026-05-10 (+13 spike vs prior day)

PM standing daily-cadence duty per docs/audit/r3-sg0-trajectory-tracker.md §5.

Today (cea1fbe): non_test=53 test=108 fragments=2 total=163.
Delta vs 2026-05-09 baseline (150): +13 in one day, ~4× the 9-day avg of +3.3/day.

Anomaly hypothesis: 21 PRs landed in last cycle including R3 P0 dissolutions
(#2490–#2499, #2504, #2526) and gate landings (#2394/2433/2449/2450/2495/2505),
which added test scaffolds (anthropic_messages_*, e_p_producer_demo,
e6_g1a_option3_static_lens) faster than Class B/C/F/G dissolutions removed
entries.

Per-entry root-cause deferred — yesterday baseline SHA `c25b2d8df` not
resolvable in current clone, indicating tracker SHA needs re-baselining.

Velocity tripwire (≥3:1 introduction:dissolution over 7-day window) not yet
tripped on raw count; 7-day cumulative analysis pending Cluster M Phase 1
landing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(audit): soften tripwire status to pending/uncomputed (openai-pro feedback)

openai-pro NON-BLOCKING finding on PR #2537: the 2026-05-10 row claimed
the velocity tripwire was "not yet tripped" while also stating the
underlying 7-day ratio hadn't been computed yet. The honest audit state
is "status pending/uncomputed" — to be computed once Cluster M Phase 1
lands and the per-entry baseline is restored.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(audit): correct +13 anomaly framing — real 1-day delta is +1

Per-entry root-cause investigation (deferred in prior commit) reveals the
+13 spike was a baseline-comparison artifact:

- 2026-05-09 tracker row recorded 150 mid-day (sha c25b2d8df, now stale)
- Actual 2026-05-09 EOD count was 162 (sha eb2cc15, last commit before
  2026-05-10 UTC) — 12 entries landed during the evening cycle (T-CostLens
  γ-ratification + R3 plan audit + 21-PR cycle) AFTER the tracker row was
  recorded
- 2026-05-10 vs 2026-05-09 EOD: +1 entry only (`anthropic_messages_wire_
  demo_test.rs` from PR #2506 [codex] add anthropic wire demo)

Updates:
- §3: split 2026-05-09 row into "(mid-day)" and "EOD" with retroactive
  correction; rewrite 2026-05-10 row with true +1 delta and cycle context
- §4: replace 4.3/day-with-spike framing with true 10-day window math;
  document the artifact correction

Velocity is steady, not anomalous. PB-0 closure trajectory continues on
the same trend; no escalation needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs(audit): preserve Director-receipted intermediate 2026-05-10 reading (f1588bc)

Discovered while doing post-snapshot velocity analysis: gentle-newt-665's
session branch (origin/session/gentle-newt-665, PR #2503, DRAFT) contains
commit 88e6fca with a Director-receipted SG-0 reading at sha f1588bc
(00:38Z, 2026-05-10) that never merged to main due to session archival.

Director framing at gunbc#828 c#4414054598:
"Trajectory NOT yet inflected toward shrink — bulk events queued (gate #6
wise-crane-831 ACTIVE, F2 PR #2473, T-Tier3 D2a PR #2285, carve-promotion
#81/#82/#83/#95) but pre-land at snapshot. Alarm 1 + Alarm 2 tripped on
extrapolation."

Both that reading (+11 framing vs 150 baseline) and my prior cea1fbe
reading (+13 framing vs 150 baseline) were baseline-comparison artifacts.
Against the corrected 2026-05-09 EOD baseline (162 entries):

- f1588bc (00:38Z): 161 = -1 entry net (marginal shrinkage; 1 fragment
  removed)
- cea1fbe (later): 163 = +1 entry net vs EOD baseline (anthropic wire
  demo PR #2506 added 1 test + restored 1 fragment)

§3 now records 5 date-stratified rows for honest day-history:
  2026-05-09 (mid-day) → 2026-05-09 EOD → 2026-05-10 (00:38Z, Director
  intermediate) → 2026-05-10 (later, current PM reading)

Preserves the Director's intermediate framing while correcting the
baseline artifact. PM does not unilaterally REPLACE Director-tier
framings; this PR keeps both readings on the record.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.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.

R3 lane tracking — T-Tier3-Dissolution (PB lane)

1 participant