Splits monolithic cluster.rs into tidal-server/src/cluster/ modules. Adds redeliver-missed relay, bounded HLC drift, lag tracking, and reconcile idempotence. Five new tier-3 test suites (chaos, lifecycle, multiproc, region, routes, runbook) all green. Docs, CHANGELOG, and ROADMAP updated with G4/G5/G6 known gaps.
80 lines
3.0 KiB
Rust
80 lines
3.0 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"))
|
|
}
|
|
|
|
/// Workspace root (the parent of `tidal/`), where the canonical `docker/`
|
|
/// images live since the docker consolidation.
|
|
fn workspace_root() -> PathBuf {
|
|
crate_root()
|
|
.parent()
|
|
.expect("tidal/ crate lives inside the workspace root")
|
|
.to_path_buf()
|
|
}
|
|
|
|
/// Read a crate-relative file, panicking with a clear message if absent.
|
|
fn read(rel: &str) -> String {
|
|
read_at(&crate_root(), rel)
|
|
}
|
|
|
|
/// Read a workspace-relative file, panicking with a clear message if absent.
|
|
fn read_workspace(rel: &str) -> String {
|
|
read_at(&workspace_root(), rel)
|
|
}
|
|
|
|
fn read_at(root: &std::path::Path, rel: &str) -> String {
|
|
let path = 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.
|
|
///
|
|
/// The Dockerfile lives at the WORKSPACE root (`docker/standalone/`) since the
|
|
/// docker consolidation removed the per-crate `tidal/docker/` mirror.
|
|
#[test]
|
|
fn standalone_dockerfile_is_persistent() {
|
|
let dockerfile = read_workspace("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."
|
|
);
|
|
}
|