Repository navigation
Substrate T-E-P P1 Slice 4: multi-arg composition cementing tests - #2192
Conversation
T-E-P-Producer-Broadening Phase 1, Slice 4 of N. Pure cementing
slice — no producer extension; pins the per-arg evidence vector
contract that Slices 1-3 built but only single-arg tests exercise.
The contract aligns with v2's `ExprCall.descent_evidence:
List<SubValueRelation>?` shape (`src/v2/00_core.dag:199`) — one
relation per argument port.
Two new behavioral tests:
1. emits_per_arg_relation_for_multi_arg_self_call — three-arg
recursion over `EpListA` with mixed arg shapes:
- arg 0 (`tail`): match-payload positional → StrictSubValue
(Slice 1 classifier)
- arg 1 (`acc + 1`): non-descending arithmetic → SubValueUnknown
(sound fail-closed: accumulator grows, can't be sub-value of itself)
- arg 2 (`limit`): unchanged forwarded param → PreservedValue
2. emits_per_arg_arithmetic_descent_on_non_first_param — two-arg
recursion exercising `param_1` arithmetic descent (vs the
conventional `param_0`-only recursion). Pins per-arg classifier
independence: arg N is classified against `caller.params[N]`,
not always against `params[0]`. ArithmeticDescent's ordinal label
tracks the per-arg index.
No producer code changes; both tests pass on existing Slice-1-3 code.
This slice is discipline cement: future producer broadening MUST
preserve per-arg classification independence.
Cross-slice invariants preserved: no new CallPattern variant, no
TransformNode widening, no INVARIANTS.md P1 substrate-fact-introduction
trigger, no termination-prover changes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Review metadata
APPROVE — Two new behavior-driven tests cementing the per-arg |
briansrls
left a comment
There was a problem hiding this comment.
Review metadata
- Provider / model:
codex/unknown - Commit:
e9e80ba0· Trigger:schedule - Thinking:
166s wall
Non-blocking — Strengths
src/v3/compiler/tests/integration/m2_substrate_inhabitance_test.rsRust test-only PR; the added fixtures cleanly ratchet the E-P per-argument SubValueRelation contract without adding substrate state.
ROADMAP — Verified
- T-E-P-Producer-Broadening: The tests advance the documented producer-broadening lane by covering multi-arg evidence vectors and non-first-parameter arithmetic descent.
✅ No blocking concerns.
Original Slice 4 fixture `ep_two_param_descent(x, n)` had arg 0 = x (unchanged) and arg 1 = n - 1 (arithmetic descent). v3's existing termination prover requires the FIRST argument to descend (`is_strictly_smaller(args[0], first_param)`), so the fixture failed at compile time before the per-call producer ever ran — exactly the same shape gate that earlier Slice 1 self-call fixtures satisfy by structuring the first-arg descent. Rework as `ep_two_descent(n, m)` with arg 0 = n - 1 AND arg 1 = m - 1: the first arg satisfies termination, AND the second arg's evidence still pins the per-arg ordinal-label contract — `param_1`, not collapsed to `param_0` — which was the test's intent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI fix pushed — commit c6578eaOriginal Slice 4 non-first-param fixture ( Rework: Other Slice 4 test ( — sent from eager-bat-178 |
|
Review metadata
Verdict: APPROVE Diff is narrowly scoped to integration-test additions in m2_substrate_inhabitance_test.rs. I did not find a concrete violation of the pinned modeling, coding, or testing docs. The new cases stay behavior-focused, exercise the public contract of |
|
Review metadata
1. Story of the diffThis PR is a focused test-only ratchet in 2. Invariant categories
N/A — diff is test-only: it consumes existing
Compliant — fail-closed / facts-flow-forward: the first test requires the evidence vector length to match the recursive call’s argument count at
Compliant — the added code uses existing data + free-function shape:
Compliant — the tests are behavior-driven and narrowly named: one pins multi-arg per-relation emission at
N/A — no locked design document, schema surface, or substrate target is altered. The v2 reference in the comment at
N/A — no TODO, scaffold, temporary bridge, compatibility shim, or new debt marker is introduced. The “Phase-1 broadening Slice 4” comments at 3. VerdictAPPROVE. The diff strengthens regression coverage for multi-argument descent evidence without changing substrate or implementation shape. I do not see a diff-anchored invariant violation. |
Summary
T-E-P-Producer-Broadening Phase 1, Slice 4 of N. Pure cementing slice — no producer extension. Pins the per-arg evidence vector contract that Slices 1-3 (#2167, #2178, #2182) built but only single-arg tests exercised. The contract aligns with v2's
ExprCall.descent_evidence: List<SubValueRelation>?shape (src/v2/00_core.dag:199) — one relation per argument port.Two new behavioral tests
1.
emits_per_arg_relation_for_multi_arg_self_callThree-arg recursion over
EpListAwith mixed arg shapes:tail): match-payload positional →StrictSubValue(Slice 1 classifier)acc + 1): non-descending arithmetic →SubValueUnknown(sound fail-closed: accumulator grows, can't be sub-value of itself)limit): unchanged forwarded param →PreservedValue2.
emits_per_arg_arithmetic_descent_on_non_first_paramTwo-arg recursion exercising
param_1arithmetic descent (vs the conventionalparam_0-only recursion):Pins per-arg classifier independence: arg N is classified against
caller.params[N], not always againstparams[0].ArithmeticDescent's ordinal label tracks the per-arg index (param_1).Cross-slice invariants reaffirmed
CallPatternvariantTransformNodewideningINVARIANTS.mdP1 substrate-fact-introduction triggerDiscipline value
Future producer broadening MUST preserve per-arg classification independence. This slice cements the contract with two behavioral pins so a regression that drops any of the three classifiers (StrictSubValue / ArithmeticDescent / PreservedValue) on multi-arg shapes fires immediately.
Gate progress
e_p_per_call_descent_evidence_full_coverage(gate Lane B tasks #76, P1): partial — Slice 4 cements. No additional shapes classified, but the per-arg contract (one relation per port) is now behaviorally pinned.Tests
e_p_per_call_descent_evidence_*tests now (Slices 1-3's 7 + 2 new − 1 already-existing pattern overlap = 8 passing). Previously: 7 green on Slice 3.Test plan
Authority
docs/briefs/r3-t-e-p-producer-broadening-worker.md(PR R3 Substrate #1782, MERGED)🤖 Generated with Claude Code