Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 33 additions & 20 deletions src/v3/compiler/tests/fixtures/r3_free_consequences_first_batch.dag
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,39 @@
// - auto-parallelism x3
// - auto-memoization x2
//
// The referenced report declarations lock the consumer shape for
// `BinaryDimensionReportEquals`. Runner evaluation stays NotYetImplemented
// until the relevant `Lens<C>` instances, R2-Evaluator witness construction,
// and T-CostLens-Composition cost facts land.
// The auto-parallelism gates use ordinary lens data, not `DimensionReport<C>`:
// 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<C>` half of `Lens<Purity>·Lens<Cost>`.

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<AutoParallelismEvidence>
type independent_binds_expected_report = DimensionReport<AutoParallelismEvidence>
type dependent_binds_observed_report = DimensionReport<AutoParallelismEvidence>
type dependent_binds_expected_report = DimensionReport<AutoParallelismEvidence>
type branch_arms_observed_report = DimensionReport<AutoParallelismEvidence>
type branch_arms_expected_report = DimensionReport<AutoParallelismEvidence>
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 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 = 1

type repeated_pure_call_observed_report = DimensionReport<AutoMemoizationEvidence>
type repeated_pure_call_expected_report = DimensionReport<AutoMemoizationEvidence>
Expand All @@ -38,9 +48,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: []
}
Expand All @@ -49,9 +60,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: []
}
Expand All @@ -60,9 +72,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: []
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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<C> and cost witnesses land.
//! 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};
Expand Down Expand Up @@ -40,17 +41,31 @@ 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!(
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!(
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
);
}
}
}
1 change: 0 additions & 1 deletion src/v3/compiler/tests/integration/sg0_census_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ 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",
"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.
Expand Down
Loading