tidaldb/tidal/tests/regression_guards.rs
jx12n 3bcfb3c576 feat: Bazel build, crate docs/ai-lookup, docker images, and engine hardening
- Add BUILD.bazel across tidal, tidal-net, tidal-server, tidalctl for bzlmod build
- Add tidal/ crate docs (README, CHANGELOG, CONTRIBUTING, AGENTS, CLAUDE, API, ARCHITECTURE) and ai-lookup reference
- Add docker standalone/cluster/deploy images, compose, and prometheus config
- Harden WAL (batch format, writer, dedup, diagnostics), text syncer/collectors, and vector registry
- Expand tidalctl CLI and tests; restructure WAL/visibility integration test suites
- Refine tidal-net transport/client/server and tidal-server cluster/scatter-gather
2026-06-07 18:29:38 -06:00

58 lines
2.3 KiB
Rust

//! 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."
);
}