diff --git a/src/v3/compiler/src/pipeline_authority.rs b/src/v3/compiler/src/pipeline_authority.rs index f0353fe0009..45a267fc9b4 100644 --- a/src/v3/compiler/src/pipeline_authority.rs +++ b/src/v3/compiler/src/pipeline_authority.rs @@ -1,12 +1,8 @@ -#[cfg(test)] -use crate::dag::ArrowBody; use crate::dag::{Dag, DeclarationId, FieldValue, TypeConnective, ValueBody}; pub(crate) const PIPELINE_AUTHORITY_FILE: &str = "src/v3/compiler/pipeline.dag"; const PIPELINE_STAGE_BINDING_TYPE: &str = "PipelineStageBinding"; -#[cfg(test)] -const PIPELINE_COMPILE_FN: &str = "compile"; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub(crate) enum PipelineSnapshotKind { @@ -221,6 +217,10 @@ fn require_snapshot_kind( mod tests { use super::*; + use crate::dag::ArrowBody; + + const PIPELINE_COMPILE_FN: &str = "compile"; + #[test] fn ordered_pipeline_stages_authority_is_pipeline_stage_binding_only() { let dag = Dag::new(); @@ -235,7 +235,7 @@ mod tests { "lens_complexity".to_string(), "emit".to_string(), ], - "ordering is structural declaration order of PipelineStageBinding rows; update this test when pipeline.dag stage set changes" + "ordering is structural declaration order of PipelineStageBinding rows (bootstrap pipeline.dag)" ); } diff --git a/src/v3/compiler/tests/integration.rs b/src/v3/compiler/tests/integration.rs index 19b4dbbb579..d80a30f1461 100644 --- a/src/v3/compiler/tests/integration.rs +++ b/src/v3/compiler/tests/integration.rs @@ -37,6 +37,8 @@ #[path = "integration/common/mod.rs"] mod common; +#[path = "integration/bridge_lower_helpers_patch_zero_residual_test.rs"] +mod bridge_lower_helpers_patch_zero_residual_test; #[path = "integration/canonical_lens_bridge_ratchet_test.rs"] mod canonical_lens_bridge_ratchet_test; #[path = "integration/cementing/cementing_lens_registry_dispatch_test.rs"] diff --git a/src/v3/compiler/tests/integration/bridge_lower_helpers_patch_zero_residual_test.rs b/src/v3/compiler/tests/integration/bridge_lower_helpers_patch_zero_residual_test.rs new file mode 100644 index 00000000000..3734577223e --- /dev/null +++ b/src/v3/compiler/tests/integration/bridge_lower_helpers_patch_zero_residual_test.rs @@ -0,0 +1,68 @@ +//! **Layer:** integration +//! +//! Zero-residual receipt for **`bridge_patch_lower_helpers_residual_retired`** +//! (T-Bridge-Retirement distributed bridge #5; see `docs/r3-structure.md` and +//! `docs/briefs/r2-pure-bootstrap-manager.md`). PR #1014 retired the +//! `patch_lower` + `_helpers` generated-Rust exact-string patch class; this +//! test fails if that contiguous symbol reappears in v3-compiler Rust sources, +//! `build.rs`, or integration/boundary/unit tests under this crate. + +use std::ffi::OsStr; +use std::fs; +use std::path::{Path, PathBuf}; + +const SELF_BASENAME: &str = "bridge_lower_helpers_patch_zero_residual_test.rs"; + +/// The retired bridge spells this contiguous substring; keep it out of the +/// tree except via `concat!(...)` in this file's own needle definition. +const FORBIDDEN: &str = concat!("patch_lower", "_helpers"); + +fn visit_rs(root: &Path, offenders: &mut Vec) { + let Ok(read_dir) = fs::read_dir(root) else { + return; + }; + for entry in read_dir.flatten() { + let path = entry.path(); + if path.is_dir() { + visit_rs(&path, offenders); + continue; + } + if path.extension() != Some(OsStr::new("rs")) { + continue; + } + if path + .file_name() + .and_then(|n| n.to_str()) + .is_some_and(|n| n == SELF_BASENAME) + { + continue; + } + let Ok(text) = fs::read_to_string(&path) else { + continue; + }; + if text.contains(FORBIDDEN) { + offenders.push(path.display().to_string()); + } + } +} + +#[test] +fn lower_helpers_patch_bridge_exact_string_residual_stays_zero() { + let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + let mut offenders = Vec::new(); + + visit_rs(&manifest_dir.join("src"), &mut offenders); + visit_rs(&manifest_dir.join("tests"), &mut offenders); + + let build_rs = manifest_dir.join("build.rs"); + if let Ok(text) = fs::read_to_string(&build_rs) { + if text.contains(FORBIDDEN) { + offenders.push(build_rs.display().to_string()); + } + } + + assert!( + offenders.is_empty(), + "bridge_patch_lower_helpers_residual_retired: contiguous `{FORBIDDEN}` must not appear in v3-compiler crate Rust after PR #1014 (offenders: {offenders:?})" + ); +} diff --git a/src/v3/compiler/tests/integration/sg0_census_test.rs b/src/v3/compiler/tests/integration/sg0_census_test.rs index 39d6bd6439f..542da1242b4 100644 --- a/src/v3/compiler/tests/integration/sg0_census_test.rs +++ b/src/v3/compiler/tests/integration/sg0_census_test.rs @@ -307,6 +307,7 @@ const EXPECTED_HAND_AUTHORED_TEST: &[&str] = &[ // .dag `TestClaim` form when the testgen path covers reflected-Dag // structural assertions over std/ types. "src/v3/compiler/tests/integration/method_template_contract_test.rs", + "src/v3/compiler/tests/integration/bridge_lower_helpers_patch_zero_residual_test.rs", "src/v3/compiler/tests/integration/p0_std_render_repeat_string_test.rs", "src/v3/compiler/tests/integration/pb1_bootstrap_full_snapshot_test.rs", "src/v3/compiler/tests/integration/pipe_desugar.rs",