tidaldb/tidal/tests/regression_guards.rs
jx12n b55ad70141 fix: M0-M10 third-pass remediation — durability, replication, and CLI hardening
Resolves the 142 findings from tidal/docs/reviews/CODE_REVIEW_m0-m10.md across
the engine, server, net, and CLI surfaces:

- WAL/session-journal durability, checkpoint format, and crash-recovery hardening
- Replication shipper/receiver, tenant isolation, and migration paths
- Cluster scatter-gather, router, standalone server + health/offload endpoints
- tidalctl refactored into command modules with JSON output and WAL-state tooling
- Cohort, governance, signal-ledger, and vector-registry correctness fixes
- Expanded UAT/integration/durability test coverage across all milestones
2026-06-08 10:28:34 -06:00

59 lines
2.3 KiB
Rust

#![allow(clippy::too_many_lines)]
//! Regression guards for the 2026-05-28 quality sweep.
//!
//! These tests fail the build if a previously-fixed systemic defect is
//! reintroduced. Each guard maps to a finding from the sweep:
//!
//! - `DOCDRIFT-2`: stale "no implementation yet" status reappearing in
//! `CLAUDE.md` after M0-M8 shipped.
//! - `DOCKER-2`: the standalone container booting ephemeral (silent data loss
//! on restart) because `--data-dir` was dropped from the entrypoint.
//!
//! The "silent-wrong-results" cluster (profiles referencing unimplemented
//! aggregations) is guarded by unit tests in `ranking::registry`
//! (`register_rejects_ratio_aggregation_in_gate` et al.) and the `ThirtyDays`
//! window by `signals::warm` tests — those live next to the code they protect.
use std::{fs, path::PathBuf};
/// Crate root (`tidal/`), resolved at compile time.
fn crate_root() -> PathBuf {
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
}
/// Read a crate-relative file, panicking with a clear message if absent.
fn read(rel: &str) -> String {
let path = crate_root().join(rel);
fs::read_to_string(&path).unwrap_or_else(|e| panic!("cannot read {}: {e}", path.display()))
}
/// DOCDRIFT-2: the crate must not re-advertise itself as unimplemented now that
/// M0-M8 has shipped (see CHANGELOG.md).
#[test]
fn claude_md_does_not_claim_unimplemented() {
let claude_md = read("CLAUDE.md");
for stale in ["No implementation yet", "Vision and specification phase"] {
assert!(
!claude_md.contains(stale),
"tidal/CLAUDE.md reintroduced the stale status phrase {stale:?}; \
the crate has shipped M0-M8 (see CHANGELOG.md)."
);
}
}
/// DOCKER-2: the standalone image must boot with a persistent `--data-dir` and
/// declare the volume, so a restart never silently loses durable data.
#[test]
fn standalone_dockerfile_is_persistent() {
let dockerfile = read("docker/standalone/Dockerfile");
assert!(
dockerfile.contains("--data-dir"),
"docker/standalone/Dockerfile dropped `--data-dir`; the container would boot ephemeral \
and lose all durable data on restart (DOCKER-2)."
);
assert!(
dockerfile.contains("VOLUME"),
"docker/standalone/Dockerfile dropped its VOLUME declaration for the data directory."
);
}