From 172f3a639838ce8afef9969927557dfb41aaa50f Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 30 May 2026 22:47:03 +0000 Subject: [PATCH] test(manifest,gc): positive postgres-storage case + realistic gc fixture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to #144 (which closed #112 by dropping the json sidecar store). Adds the two test-only improvements that #144 did not include: - manifest: `postgres_storage_passes_storage_check` — a positive companion to `unsupported_storage_fails`, asserting the postgres dialect passes the new `sidecar-storage-supported` validate check (previously only the negative/json path was covered). - gc: `gc_rejects_non_sqlite_backend` now exercises the realistic non-sqlite value (`postgres`) instead of the dropped `json` value, so the fixture reflects a backend that actually exists post-#112. No production-code change; the sidecar storage set stays closed to sqlite + postgres. https://claude.ai/code/session_01Ux144vBDdySvLUqUrCgkT4 --- src/gc.rs | 5 ++++- src/manifest/mod.rs | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/gc.rs b/src/gc.rs index 16fb4de..d623acf 100644 --- a/src/gc.rs +++ b/src/gc.rs @@ -309,7 +309,10 @@ mod tests { #[test] fn gc_rejects_non_sqlite_backend() { - let m = fixture("/dev/null", RetentionConfig::default(), "json"); + // `postgres` is a valid generate-time dialect, but gc is SQLite-only + // and must refuse rather than silently no-op. (The `json` value was + // dropped as a storage option entirely in V-L2-F2 / #112.) + let m = fixture("/dev/null", RetentionConfig::default(), "postgres"); let err = run_gc(&m, true).unwrap_err(); assert!( err.to_string().contains("only supports the SQLite sidecar"), diff --git a/src/manifest/mod.rs b/src/manifest/mod.rs index 4bf4379..3fe0bb2 100644 --- a/src/manifest/mod.rs +++ b/src/manifest/mod.rs @@ -429,6 +429,42 @@ mod validate_manifest_tests { ); } + /// Complements `unsupported_storage_fails`: the PostgreSQL dialect is a + /// supported `[sidecar].storage` value (it selects the postgres DDL for + /// `generate`), so a postgres sidecar must *pass* the + /// `sidecar-storage-supported` check and validate cleanly. + #[test] + fn postgres_storage_passes_storage_check() { + let dir = tempfile::tempdir().expect("tempdir"); + let path = dir.path().join("verisimiser.toml"); + let sidecar_path = dir.path().join("sidecar.db"); + let body = format!( + "[project]\n\ + name = \"test\"\n\ + [database]\n\ + backend = \"postgresql\"\n\ + [sidecar]\n\ + storage = \"postgres\"\n\ + path = \"{}\"\n", + sidecar_path.display().to_string().replace('\\', "/") + ); + std::fs::write(&path, body).expect("write"); + + let report = validate_manifest(path.to_str().unwrap()); + assert!( + report.passed, + "postgres storage must validate; checks: {:?}", + report.checks + ); + assert!( + report + .checks + .iter() + .any(|c| c.name == "sidecar-storage-supported" && c.passed), + "the storage-supported check must run and pass for postgres" + ); + } + /// A malformed manifest must fail `manifest-loads` and stop further /// checks (because the rest depend on having a parsed manifest). #[test]