From 1442d6f137da697675b2b0bd69017631708b4638 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Fri, 1 May 2026 05:05:42 +0000 Subject: [PATCH 1/4] fix(v3): keep free-consequences parallelism off DimensionReport --- .../r3_free_consequences_first_batch.dag | 50 +++++++++++-------- .../r3_free_consequences_first_batch_test.rs | 35 ++++++++----- 2 files changed, 52 insertions(+), 33 deletions(-) diff --git a/src/v3/compiler/tests/fixtures/r3_free_consequences_first_batch.dag b/src/v3/compiler/tests/fixtures/r3_free_consequences_first_batch.dag index 68c2c5ec79e..b48ef15bf62 100644 --- a/src/v3/compiler/tests/fixtures/r3_free_consequences_first_batch.dag +++ b/src/v3/compiler/tests/fixtures/r3_free_consequences_first_batch.dag @@ -5,29 +5,36 @@ // - auto-parallelism x3 // - auto-memoization x2 // -// The referenced report declarations lock the consumer shape for -// `BinaryDimensionReportEquals`. Runner evaluation stays NotYetImplemented -// until the relevant `Lens` instances, R2-Evaluator witness construction, -// and T-CostLens-Composition cost facts land. +// The auto-parallelism gates use ordinary lens data, not `DimensionReport`: +// DB-3 explicitly keeps parallelism outside the Dimension abstraction, and +// DB-20 models workflow parallelism through `WorkflowParallelismReport`. +// The auto-memoization gates still lock the `BinaryDimensionReportEquals` +// shape for the cost-related `DimensionReport` half of `Lens·Lens`. module std.r3_free_consequences_first_batch import std.dimensions { DimensionReport } +import std.substrate { Dag } import std.verification { BinaryDimensionReportEquals, + LensOutputEquals, + ProgramInput, TestClaim, TestSuite } -type AutoParallelismEvidence {} type AutoMemoizationEvidence {} -type independent_binds_observed_report = DimensionReport -type independent_binds_expected_report = DimensionReport -type dependent_binds_observed_report = DimensionReport -type dependent_binds_expected_report = DimensionReport -type branch_arms_observed_report = DimensionReport -type branch_arms_expected_report = DimensionReport +data auto_parallelism_program_input: ProgramInput = {} + +// Ordinary-lens placeholder until `src/v3/lenses/parallelism.dag` is ported from +// its fail-closed stub to a `.dag` producer over DB-20 workflow parallelism data. +// Keep this scalar: current `LensOutputEquals` evaluation can execute scalar +// demo lenses, while DB-20's full `WorkflowParallelismReport` producer is still +// a follow-on ordinary-lens surface. +fn auto_parallelism_pending_lens(_d: Dag) -> Int = 0 + +data auto_parallelism_pending_expected: Int = 0 type repeated_pure_call_observed_report = DimensionReport type repeated_pure_call_expected_report = DimensionReport @@ -38,9 +45,10 @@ data auto_parallelism_independent_binds_emit_parallel: TestClaim = { name: "auto_parallelism_independent_binds_emit_parallel", source: "// free-consequences fixture: independent binds may emit parallel schedule when independence, effect-commutativity, and cost witnesses land.\nlet _: Int = 0\n", file_name: "r3_free_consequences_auto_parallelism_independent_binds.v3", - predicate: BinaryDimensionReportEquals( - independent_binds_observed_report, - independent_binds_expected_report + predicate: LensOutputEquals( + auto_parallelism_pending_lens, + auto_parallelism_program_input, + auto_parallelism_pending_expected ), requires: [] } @@ -49,9 +57,10 @@ data auto_parallelism_dependent_binds_emit_sequential: TestClaim = { name: "auto_parallelism_dependent_binds_emit_sequential", source: "// free-consequences fixture: dependent binds must remain sequential.\nlet _: Int = 0\n", file_name: "r3_free_consequences_auto_parallelism_dependent_binds.v3", - predicate: BinaryDimensionReportEquals( - dependent_binds_observed_report, - dependent_binds_expected_report + predicate: LensOutputEquals( + auto_parallelism_pending_lens, + auto_parallelism_program_input, + auto_parallelism_pending_expected ), requires: [] } @@ -60,9 +69,10 @@ data auto_parallelism_branch_arms_serialize: TestClaim = { name: "auto_parallelism_branch_arms_serialize", source: "// free-consequences fixture: branch arms are exclusive alternatives, not parallel work.\nlet _: Int = 0\n", file_name: "r3_free_consequences_auto_parallelism_branch_arms.v3", - predicate: BinaryDimensionReportEquals( - branch_arms_observed_report, - branch_arms_expected_report + predicate: LensOutputEquals( + auto_parallelism_pending_lens, + auto_parallelism_program_input, + auto_parallelism_pending_expected ), requires: [] } diff --git a/src/v3/compiler/tests/integration/r3_free_consequences_first_batch_test.rs b/src/v3/compiler/tests/integration/r3_free_consequences_first_batch_test.rs index 796e7e49430..d410b087b17 100644 --- a/src/v3/compiler/tests/integration/r3_free_consequences_first_batch_test.rs +++ b/src/v3/compiler/tests/integration/r3_free_consequences_first_batch_test.rs @@ -1,8 +1,9 @@ //! **Layer:** integration //! //! R3 T-Free-Consequences first-batch author-now/fire-later claims. The -//! fixture locks five `BinaryDimensionReportEquals` consumer shapes; runner -//! evaluation remains deferred until the Lens and cost witnesses land. +//! auto-parallelism claims exercise the ordinary lens-data path because +//! parallelism is not a Dimension instance; auto-memoization locks the +//! cost-related `BinaryDimensionReportEquals` shape. use v3_compiler::compile_to_dag; use v3_compiler::test_runner::{ClaimResult, TestRunner}; @@ -40,17 +41,25 @@ fn r3_free_consequences_first_batch_reaches_unified_predicate_shape() { let results = TestRunner::new(&dag).run_suite(SUITE_NAME); assert_eq!(results.len(), EXPECTED_CLAIMS.len()); - for (result, expected_name) in results.iter().zip(EXPECTED_CLAIMS) { + for (idx, (result, expected_name)) in results.iter().zip(EXPECTED_CLAIMS).enumerate() { assert_eq!(result.claim_name, expected_name); - assert!( - matches!( - &result.result, - ClaimResult::NotYetImplemented(reason) - if reason.contains("BinaryDimensionReportEquals") - && reason.contains("structural shape is valid") - ), - "expected {expected_name} to reach BinaryDimensionReportEquals deferred path, got {:?}", - result.result - ); + if idx < 3 { + assert_eq!( + result.result, + ClaimResult::Pass, + "expected {expected_name} to exercise the ordinary parallelism lens-data path" + ); + } else { + assert!( + matches!( + &result.result, + ClaimResult::NotYetImplemented(reason) + if reason.contains("BinaryDimensionReportEquals") + && reason.contains("structural shape is valid") + ), + "expected {expected_name} to reach BinaryDimensionReportEquals deferred path, got {:?}", + result.result + ); + } } } From 1b1af849c054666fb70f53b41922fdf5295dd95b Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Fri, 1 May 2026 05:21:56 +0000 Subject: [PATCH 2/4] test(v3): add BinShim carrier ratchet entries --- src/v3/compiler/tests/integration/parse_corpus_manifest.txt | 1 + src/v3/compiler/tests/integration/sg0_census_test.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/v3/compiler/tests/integration/parse_corpus_manifest.txt b/src/v3/compiler/tests/integration/parse_corpus_manifest.txt index 8dad2455fc9..1c9b611055a 100644 --- a/src/v3/compiler/tests/integration/parse_corpus_manifest.txt +++ b/src/v3/compiler/tests/integration/parse_corpus_manifest.txt @@ -25,6 +25,7 @@ src/v3/std/algebra.dag 42 303630 8be5b86cc9520bc3 src/v3/std/anthropic_messages.dag 5 6056 25140dcf6faa8e6b src/v3/std/anthropic_operations.dag 6 3404 a729e7662be9af5f src/v3/std/anthropic_schema.dag 8 20682 cdd44a074743988b +src/v3/std/bin_shim.dag 4 2544 9ac96f1b3feafe47 src/v3/std/bridge_ledger.dag 7 27382 fdcd9c26dc2b70b0 src/v3/std/clean_emission.dag 15 23867 e7bc1e6145f4781e src/v3/std/computation.dag 18 36754 8023f388c3fb0918 diff --git a/src/v3/compiler/tests/integration/sg0_census_test.rs b/src/v3/compiler/tests/integration/sg0_census_test.rs index ad78104c806..409915e6bf0 100644 --- a/src/v3/compiler/tests/integration/sg0_census_test.rs +++ b/src/v3/compiler/tests/integration/sg0_census_test.rs @@ -232,6 +232,9 @@ const EXPECTED_HAND_AUTHORED_TEST: &[&str] = &[ // (#1252). Hand-authored ratchet entry added per SG-0 census discipline. "src/v3/compiler/tests/integration/anthropic_operations_test.rs", "src/v3/compiler/tests/integration/anthropic_schema_lockstep_test.rs", + // BinShim substrate carrier ratchet: pins `src/v3/std/bin_shim.dag` carrier + // shape until bin-shim rows and behavior migrate into `.dag` authority. + "src/v3/compiler/tests/integration/bin_shim_carrier_test.rs", "src/v3/compiler/tests/integration/bridge_ledger_carrier_test.rs", // PB Tier-2 lower-helper exact-string patch class (#1014): zero-residual receipt + // source ratchet; see `bridge_lower_helpers_patch_zero_residual_test.rs` module docs. From 8f7538c5adae2ddd4c954ee6bc97cd171d4d5c59 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Fri, 1 May 2026 01:36:35 -0400 Subject: [PATCH 3/4] WIP: cool-crab-614 --- src/v3/compiler/src/test_runner.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/v3/compiler/src/test_runner.rs b/src/v3/compiler/src/test_runner.rs index bca562b5ad1..a319c859f0c 100644 --- a/src/v3/compiler/src/test_runner.rs +++ b/src/v3/compiler/src/test_runner.rs @@ -2397,11 +2397,12 @@ impl<'a> TestRunner<'a> { ), }; if law_label == "Identity" { - return ClaimResult::NotYetImplemented(format!( + return ClaimResult::NotYetImplemented( "AlgebraicLaw::Identity is blocked: no lens identity-element edge is exposed on \ the algebra inhabitance yet (PR-B.3 W2); leave fail-closed until that substrate \ fact exists" - )); + .to_string(), + ); } if law_label != "Associativity" && law_label != "Commutativity" { return ClaimResult::NotYetImplemented(format!( From 301571f04ac3710ee9919dbe5ba5e02de1a62346 Mon Sep 17 00:00:00 2001 From: Brian Searls Date: Fri, 1 May 2026 01:51:31 -0400 Subject: [PATCH 4/4] WIP: cool-crab-614 --- .../r3_free_consequences_first_batch.dag | 11 ++++++---- .../r3_free_consequences_first_batch_test.rs | 20 ++++++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/v3/compiler/tests/fixtures/r3_free_consequences_first_batch.dag b/src/v3/compiler/tests/fixtures/r3_free_consequences_first_batch.dag index b48ef15bf62..9e6c7fea680 100644 --- a/src/v3/compiler/tests/fixtures/r3_free_consequences_first_batch.dag +++ b/src/v3/compiler/tests/fixtures/r3_free_consequences_first_batch.dag @@ -29,12 +29,15 @@ data auto_parallelism_program_input: ProgramInput = {} // Ordinary-lens placeholder until `src/v3/lenses/parallelism.dag` is ported from // its fail-closed stub to a `.dag` producer over DB-20 workflow parallelism data. -// Keep this scalar: current `LensOutputEquals` evaluation can execute scalar -// demo lenses, while DB-20's full `WorkflowParallelismReport` producer is still -// a follow-on ordinary-lens surface. +// Keep this scalar and intentionally mismatched: current `LensOutputEquals` +// evaluation can execute scalar demo lenses, while DB-20's full +// `WorkflowParallelismReport` producer is still a follow-on ordinary-lens +// surface. The mismatch keeps the gate fail-closed; replace the placeholder +// lens and expected value together when `parallelism.dag` exposes the real +// structural producer. fn auto_parallelism_pending_lens(_d: Dag) -> Int = 0 -data auto_parallelism_pending_expected: Int = 0 +data auto_parallelism_pending_expected: Int = 1 type repeated_pure_call_observed_report = DimensionReport type repeated_pure_call_expected_report = DimensionReport diff --git a/src/v3/compiler/tests/integration/r3_free_consequences_first_batch_test.rs b/src/v3/compiler/tests/integration/r3_free_consequences_first_batch_test.rs index d410b087b17..479efa4bfaa 100644 --- a/src/v3/compiler/tests/integration/r3_free_consequences_first_batch_test.rs +++ b/src/v3/compiler/tests/integration/r3_free_consequences_first_batch_test.rs @@ -1,9 +1,9 @@ //! **Layer:** integration //! //! R3 T-Free-Consequences first-batch author-now/fire-later claims. The -//! auto-parallelism claims exercise the ordinary lens-data path because -//! parallelism is not a Dimension instance; auto-memoization locks the -//! cost-related `BinaryDimensionReportEquals` shape. +//! auto-parallelism claims exercise the ordinary lens-data path and stay +//! fail-closed because parallelism is not a Dimension instance; auto-memoization +//! locks the cost-related `BinaryDimensionReportEquals` shape. use v3_compiler::compile_to_dag; use v3_compiler::test_runner::{ClaimResult, TestRunner}; @@ -44,10 +44,16 @@ fn r3_free_consequences_first_batch_reaches_unified_predicate_shape() { for (idx, (result, expected_name)) in results.iter().zip(EXPECTED_CLAIMS).enumerate() { assert_eq!(result.claim_name, expected_name); if idx < 3 { - assert_eq!( - result.result, - ClaimResult::Pass, - "expected {expected_name} to exercise the ordinary parallelism lens-data path" + assert!( + matches!( + &result.result, + ClaimResult::Fail(reason) + if reason.contains("expected 1") + && reason.contains("computed 0") + && reason.contains("auto_parallelism_pending_lens") + ), + "expected {expected_name} to fail closed on the pending ordinary parallelism lens, got {:?}", + result.result ); } else { assert!(