From 74dd7a3a8c25b8b786a2129b7b266ccd141533ba Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Thu, 14 May 2026 17:13:13 +0000 Subject: [PATCH 1/4] Ratchet call pattern lookup authority --- docs/r3-program-plan.md | 2 +- .../m2_substrate_inhabitance_test.rs | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/docs/r3-program-plan.md b/docs/r3-program-plan.md index 717136853b3..c52f4ddd321 100644 --- a/docs/r3-program-plan.md +++ b/docs/r3-program-plan.md @@ -301,7 +301,7 @@ This principle is NOT a separate lane; it's a per-lane gate-shape requirement ap | 74 | `tests_as_data_demonstration` | demonstration | T-Tests-As-Data-Completeness | **CONSUMER_LANDED + PASSING** — one-cell `.dag` carrier `src/v3/compiler/tests/dag/t_r3_tests_as_data_demonstration.dag` ports the retired Rust integration test `t_pb_b_brief_d_pipeline_smoke_fixture_lowers_cleanly` to `TestClaim` (`Compiles`) and executes through `TestRunner` via `r3_tests_as_data_demonstration_suite_passes_through_runner` | Demonstration only; gate #84 owns bulk Rust-test port coverage | | 75 | `pr_anticipation_discipline_ci_active` | CI-discipline | R3 Debt-Paydown (standing) | **PASSING** — CI job runs `scripts/check-pr-sg0-net-shrink-discipline.sh --self-test` and PR-body enforcement before bootstrap verify | landed by PR #1807; tightened by PR #2335 + PR #2361; local self-test re-verified 2026-05-10 | | 76 | `e_p_per_call_descent_evidence_full_coverage` | substrate-shape | T-E-P-Producer-Broadening | **CONSUMER_LANDED** (PR #2147 carrier + PR #2190 consumer; refresh per cluster-analysis audit §1) | per-call DescentEvidence covers all live call sites | -| 77 | `e_p_call_pattern_lookup_authoritative` | substrate-shape | T-E-P-Producer-Broadening | **CONSUMER_LANDED** — integration `e_p_call_pattern_lookup_authoritative` (`m2_substrate_inhabitance_test.rs`) pins `per_call_pattern_at` as the lens-facing query over the per-call evidence authority | CallPattern lookup authoritative | +| 77 | `e_p_call_pattern_lookup_authoritative` | substrate-shape | T-E-P-Producer-Broadening | **PASSING** — integrations `e_p_call_pattern_lookup_authoritative` + `e_p_call_pattern_lookup_authoritative_consumers_use_query_surface` (`m2_substrate_inhabitance_test.rs`) pin `per_call_pattern_at` as the lens-facing query over the per-call evidence authority and ratchet cost/complexity `.dag` + generated consumers against direct side-table or `lower_call_pattern` routing | CallPattern lookup authoritative | | 78 | `e_p_sub_value_relation_per_call_landed` | substrate-shape | T-E-P-Producer-Broadening | **CONSUMER_LANDED** (T-E-P P1 slices 1-7 per cluster-analysis audit §1) | SubValueRelation per-call landing | | 79 | `complexity_lens_behaviorally_complete` | structural-fold | T-Lens-Behavioral-Parity | SATISFIED-BY-CONSTRUCTION — #2220 | symbolic CostExpr + work/span split + asymptotic classification + temporary Rust cementing receipt (`complexity_lens_behavioral_completion.rs`) until `ComplexitySummary` TestClaim literals are expressible | | 80 | `cost_lens_behaviorally_complete` | structural-fold | T-Lens-Behavioral-Parity | **PASSING** — gate #80 abstract-cost scope now has executable `DimensionReport` wiring via `analyze_symbolic_cost_dimension`, `SizeVariable` value identity by `source_port`, recursive `CallPattern` consumption, and Band-C frozen-projection cementing in `cost_lens_symbolic_consumer_test.rs`; target-realization composition remains tracked separately by T-CostLens gates #37/#40/#70 | Dimension wiring + SizeVar value semantics + cementing test | diff --git a/src/v3/compiler/tests/integration/m2_substrate_inhabitance_test.rs b/src/v3/compiler/tests/integration/m2_substrate_inhabitance_test.rs index fd32784a1cb..95a973dc876 100644 --- a/src/v3/compiler/tests/integration/m2_substrate_inhabitance_test.rs +++ b/src/v3/compiler/tests/integration/m2_substrate_inhabitance_test.rs @@ -1472,6 +1472,62 @@ fn caller(n: Int) -> Int = helper(n) ); } +#[test] +fn e_p_call_pattern_lookup_authoritative_consumers_use_query_surface() { + let cost_lens = include_str!("../../../lenses/cost.dag"); + let complexity_lens = include_str!("../../../lenses/complexity.dag"); + let generated_cost = include_str!("../../src/lens_cost_symbolic_generated.rs"); + let generated_complexity = include_str!("../../src/complexity_lens_generated.rs"); + + for (name, source) in [ + ("src/v3/lenses/cost.dag", cost_lens), + ("src/v3/lenses/complexity.dag", complexity_lens), + ] { + assert!( + source.contains("per_call_pattern_at"), + "{name} must consume CallPattern facts through the authoritative \ + std.computation::per_call_pattern_at query" + ); + assert!( + !source.contains("per_call_descent_evidence"), + "{name} must not read per_call_descent_evidence directly; \ + per_call_pattern_at is the L-7 consumer surface" + ); + assert!( + !source.contains("lower_call_pattern"), + "{name} must not consume compiler-internal lower_call_pattern; \ + lens-facing CallPattern lookup is per_call_pattern_at" + ); + } + + for (name, source) in [ + ( + "src/v3/compiler/src/lens_cost_symbolic_generated.rs", + generated_cost, + ), + ( + "src/v3/compiler/src/complexity_lens_generated.rs", + generated_complexity, + ), + ] { + assert!( + source.contains("per_call_pattern_at("), + "{name} must retain generated calls to the authoritative \ + per_call_pattern_at substrate accessor" + ); + assert!( + !source.contains("per_call_descent_evidence("), + "{name} must not regenerate a direct side-table consumer; \ + CallPattern consumers route through per_call_pattern_at" + ); + assert!( + !source.contains("lower_call_pattern("), + "{name} must not regenerate compiler-internal lowering as a \ + lens-facing CallPattern consumer" + ); + } +} + #[test] fn e_p_runtime_mirror_matches_induction_carrier_shape() { let dag = Dag::new(); From e63765a8c4c9de08ab34cc35241c028972231a74 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Thu, 14 May 2026 19:34:24 +0000 Subject: [PATCH 2/4] Document gate 77 P5 receipt --- docs/r3-program-plan.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/r3-program-plan.md b/docs/r3-program-plan.md index ec86a2a45bb..3fb087cf0f9 100644 --- a/docs/r3-program-plan.md +++ b/docs/r3-program-plan.md @@ -301,7 +301,7 @@ This principle is NOT a separate lane; it's a per-lane gate-shape requirement ap | 74 | `tests_as_data_demonstration` | demonstration | T-Tests-As-Data-Completeness | **CONSUMER_LANDED + PASSING** — one-cell `.dag` carrier `src/v3/compiler/tests/dag/t_r3_tests_as_data_demonstration.dag` ports the retired Rust integration test `t_pb_b_brief_d_pipeline_smoke_fixture_lowers_cleanly` to `TestClaim` (`Compiles`) and executes through `TestRunner` via `r3_tests_as_data_demonstration_suite_passes_through_runner` | Demonstration only; gate #84 owns bulk Rust-test port coverage | | 75 | `pr_anticipation_discipline_ci_active` | CI-discipline | R3 Debt-Paydown (standing) | **PASSING** — CI job runs `scripts/check-pr-sg0-net-shrink-discipline.sh --self-test` and PR-body enforcement before bootstrap verify | landed by PR #1807; tightened by PR #2335 + PR #2361; local self-test re-verified 2026-05-10 | | 76 | `e_p_per_call_descent_evidence_full_coverage` | substrate-shape | T-E-P-Producer-Broadening | **CONSUMER_LANDED** (PR #2147 carrier + PR #2190 consumer; refresh per cluster-analysis audit §1). **Phase-3 cementing ratchets authored** at `src/v3/compiler/tests/integration/cementing/e_p_per_call_descent_lens_consumer_cementing.rs` (4 `#[ignore]`'d tests pinning the consumer-path expectation for match-payload + multi-arg per-arg vectors against both `complexity_of` + `symbolic_cost_of`). **NOT promoted to PASSING** per `feedback_only_claim_what_actually_exists` — named blocker: **lens-consumer match-arm walker substrate extension** (`src/v3/lenses/complexity.dag` + `src/v3/lenses/cost.dag` currently have no Disj/match-arm summary fold; `branch_summary` handles only `Branch` behavior, leaving `compose_many_inputs` unreached on match-arm result ports for ADT-typed recursive functions). Producer surface is correct (m2 receipts `e_p_per_call_descent_evidence_classifies_match_payload_self_call_as_strict_sub_value` + `..._emits_per_arg_relation_for_multi_arg_self_call` + `per_call_pattern_at` `ChildAccessorCall` projection); gap is consumer-side only. Follow-on lens-consumer-walker canvas pending under R3 Substrate Mgr standing authority per `docs/design-complexity-lens-behavioral-completeness.md` §272/§282; follow-on PR drops the `#[ignore]` markers as its same-PR cementing receipt. | per-call DescentEvidence covers all live call sites | -| 77 | `e_p_call_pattern_lookup_authoritative` | substrate-shape | T-E-P-Producer-Broadening | **PASSING** — integrations `e_p_call_pattern_lookup_authoritative` + `e_p_call_pattern_lookup_authoritative_consumers_use_query_surface` (`m2_substrate_inhabitance_test.rs`) pin `per_call_pattern_at` as the lens-facing query over the per-call evidence authority and ratchet cost/complexity `.dag` + generated consumers against direct side-table or `lower_call_pattern` routing | CallPattern lookup authoritative | +| 77 | `e_p_call_pattern_lookup_authoritative` | substrate-shape | T-E-P-Producer-Broadening | **PASSING** — integrations `e_p_call_pattern_lookup_authoritative` + `e_p_call_pattern_lookup_authoritative_consumers_use_query_surface` (`m2_substrate_inhabitance_test.rs`) pin `per_call_pattern_at` as the lens-facing query over the per-call evidence authority and ratchet cost/complexity `.dag` + generated consumers against direct side-table or `lower_call_pattern` routing. **P5 receipt:** expanded hand-Rust is test-only SG-0 ratchet surface in the existing `m2_substrate_inhabitance_test.rs` harness; it introduces no substrate authority, producer, mirror, or runtime behavior path. Deferral target is T-Tests-As-Data-Completeness / gate #84: port this ratchet to `.dag` `TestClaim` data with the surrounding M2 substrate-inhabitance SG-0 test surface. | CallPattern lookup authoritative | | 78 | `e_p_sub_value_relation_per_call_landed` | substrate-shape | T-E-P-Producer-Broadening | **CONSUMER_LANDED** (T-E-P P1 slices 1-7 per cluster-analysis audit §1) | SubValueRelation per-call landing | | 79 | `complexity_lens_behaviorally_complete` | structural-fold | T-Lens-Behavioral-Parity | SATISFIED-BY-CONSTRUCTION — #2220 | symbolic CostExpr + work/span split + asymptotic classification + temporary Rust cementing receipt (`complexity_lens_behavioral_completion.rs`) until `ComplexitySummary` TestClaim literals are expressible | | 80 | `cost_lens_behaviorally_complete` | structural-fold | T-Lens-Behavioral-Parity | **PASSING** — gate #80 abstract-cost scope now has executable `DimensionReport` wiring via `analyze_symbolic_cost_dimension`, `SizeVariable` value identity by `source_port`, recursive `CallPattern` consumption, and Band-C frozen-projection cementing in `cost_lens_symbolic_consumer_test.rs`; target-realization composition remains tracked separately by T-CostLens gates #37/#40/#70 | Dimension wiring + SizeVar value semantics + cementing test | From baaaf98fbbcf5570318bd2a9c3b329eaffc94f4b Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Thu, 14 May 2026 16:24:25 -0400 Subject: [PATCH 3/4] WIP: R3 gate #77: e_p_call_pattern_lookup_authoritative (T-E-P-Producer-Broad --- docs/r3-program-plan.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/r3-program-plan.md b/docs/r3-program-plan.md index e3f709bb71d..1653572b4b8 100644 --- a/docs/r3-program-plan.md +++ b/docs/r3-program-plan.md @@ -301,7 +301,7 @@ This principle is NOT a separate lane; it's a per-lane gate-shape requirement ap | 74 | `tests_as_data_demonstration` | demonstration | T-Tests-As-Data-Completeness | **CONSUMER_LANDED + PASSING** — one-cell `.dag` carrier `src/v3/compiler/tests/dag/t_r3_tests_as_data_demonstration.dag` ports the retired Rust integration test `t_pb_b_brief_d_pipeline_smoke_fixture_lowers_cleanly` to `TestClaim` (`Compiles`) and executes through `TestRunner` via `r3_tests_as_data_demonstration_suite_passes_through_runner` | Demonstration only; gate #84 owns bulk Rust-test port coverage | | 75 | `pr_anticipation_discipline_ci_active` | CI-discipline | R3 Debt-Paydown (standing) | **PASSING** — CI job runs `scripts/check-pr-sg0-net-shrink-discipline.sh --self-test` and PR-body enforcement before bootstrap verify | landed by PR #1807; tightened by PR #2335 + PR #2361; local self-test re-verified 2026-05-10 | | 76 | `e_p_per_call_descent_evidence_full_coverage` | substrate-shape | T-E-P-Producer-Broadening | **CONSUMER_LANDED** (PR #2147 carrier + PR #2190 consumer; refresh per cluster-analysis audit §1). **Phase-3 cementing ratchets authored** at `src/v3/compiler/tests/integration/cementing/e_p_per_call_descent_lens_consumer_cementing.rs` (4 `#[ignore]`'d tests pinning the consumer-path expectation for match-payload + multi-arg per-arg vectors against both `complexity_of` + `symbolic_cost_of`). **NOT promoted to PASSING** per `feedback_only_claim_what_actually_exists` — named blocker: **lens-consumer match-arm walker substrate extension** (`src/v3/lenses/complexity.dag` + `src/v3/lenses/cost.dag` currently have no Disj/match-arm summary fold; `branch_summary` handles only `Branch` behavior, leaving `compose_many_inputs` unreached on match-arm result ports for ADT-typed recursive functions). Producer surface is correct (m2 receipts `e_p_per_call_descent_evidence_classifies_match_payload_self_call_as_strict_sub_value` + `..._emits_per_arg_relation_for_multi_arg_self_call` + `per_call_pattern_at` `ChildAccessorCall` projection); gap is consumer-side only. Follow-on lens-consumer-walker canvas pending under R3 Substrate Mgr standing authority per `docs/design-complexity-lens-behavioral-completeness.md` §272/§282; follow-on PR drops the `#[ignore]` markers as its same-PR cementing receipt. | per-call DescentEvidence covers all live call sites | -| 77 | `e_p_call_pattern_lookup_authoritative` | substrate-shape | T-E-P-Producer-Broadening | **PASSING** — integrations `e_p_call_pattern_lookup_authoritative` + `e_p_call_pattern_lookup_authoritative_consumers_use_query_surface` (`m2_substrate_inhabitance_test.rs`) pin `per_call_pattern_at` as the lens-facing query over the per-call evidence authority and ratchet cost/complexity `.dag` + generated consumers against direct side-table or `lower_call_pattern` routing. **P5 receipt:** expanded hand-Rust is test-only SG-0 ratchet surface in the existing `m2_substrate_inhabitance_test.rs` harness; it introduces no substrate authority, producer, mirror, or runtime behavior path. Deferral target is T-Tests-As-Data-Completeness / gate #84: port this ratchet to `.dag` `TestClaim` data with the surrounding M2 substrate-inhabitance SG-0 test surface. | CallPattern lookup authoritative | +| 77 | `e_p_call_pattern_lookup_authoritative` | substrate-shape | T-E-P-Producer-Broadening | **PASSING** — integrations `e_p_call_pattern_lookup_authoritative` + `e_p_call_pattern_lookup_authoritative_consumers_use_query_surface` (`m2_substrate_inhabitance_test.rs`) pin `per_call_pattern_at` as the lens-facing query over the per-call evidence authority and ratchet cost/complexity `.dag` + generated consumers against direct side-table or `lower_call_pattern` routing. **P5 receipt:** expanded hand-Rust is test-only SG-0 ratchet surface in the existing `m2_substrate_inhabitance_test.rs` harness; it introduces no substrate authority, producer, mirror, or runtime behavior path. Deferral target is T-Tests-As-Data-Completeness / gate #84: port this ratchet to `.dag` `TestClaim` data with the surrounding M2 substrate-inhabitance SG-0 test surface. Concrete ROADMAP row: `ROADMAP.md` §"Two distinct baselines inside T-PB-A" / SG-0 hand-Rust census (`EXPECTED_HAND_AUTHORED_TEST` / T-PB-B subset) plus §"R3 Cluster M / §1.8 gate #84 coordinator anchors". | CallPattern lookup authoritative | | 78 | `e_p_sub_value_relation_per_call_landed` | substrate-shape | T-E-P-Producer-Broadening | **CONSUMER_LANDED** (T-E-P P1 slices 1-7 per cluster-analysis audit §1) | SubValueRelation per-call landing | | 79 | `complexity_lens_behaviorally_complete` | structural-fold | T-Lens-Behavioral-Parity | SATISFIED-BY-CONSTRUCTION — #2220 | symbolic CostExpr + work/span split + asymptotic classification + temporary Rust cementing receipt (`complexity_lens_behavioral_completion.rs`) until `ComplexitySummary` TestClaim literals are expressible | | 80 | `cost_lens_behaviorally_complete` | structural-fold | T-Lens-Behavioral-Parity | **PASSING** — gate #80 abstract-cost scope now has executable `DimensionReport` wiring via `analyze_symbolic_cost_dimension`, `SizeVariable` value identity by `source_port`, recursive `CallPattern` consumption, and Band-C frozen-projection cementing in `cost_lens_symbolic_consumer_test.rs`; target-realization composition remains tracked separately by T-CostLens gates #37/#40/#70 | Dimension wiring + SizeVar value semantics + cementing test | From 6bf05b46e9c6aec395f878774f06f569c1d31d37 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Thu, 14 May 2026 21:16:22 +0000 Subject: [PATCH 4/4] Fix gate 77 generated cost include --- .../tests/integration/m2_substrate_inhabitance_test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/v3/compiler/tests/integration/m2_substrate_inhabitance_test.rs b/src/v3/compiler/tests/integration/m2_substrate_inhabitance_test.rs index 46146d50823..d8086be41ff 100644 --- a/src/v3/compiler/tests/integration/m2_substrate_inhabitance_test.rs +++ b/src/v3/compiler/tests/integration/m2_substrate_inhabitance_test.rs @@ -1523,7 +1523,7 @@ fn caller(n: Int) -> Int = helper(n) fn e_p_call_pattern_lookup_authoritative_consumers_use_query_surface() { let cost_lens = include_str!("../../../lenses/cost.dag"); let complexity_lens = include_str!("../../../lenses/complexity.dag"); - let generated_cost = include_str!("../../src/lens_cost_symbolic_generated.rs"); + let generated_cost = include_str!("../../src/cost_symbolic_lens_generated.rs"); let generated_complexity = include_str!("../../src/complexity_lens_generated.rs"); for (name, source) in [ @@ -1549,7 +1549,7 @@ fn e_p_call_pattern_lookup_authoritative_consumers_use_query_surface() { for (name, source) in [ ( - "src/v3/compiler/src/lens_cost_symbolic_generated.rs", + "src/v3/compiler/src/cost_symbolic_lens_generated.rs", generated_cost, ), (