From 72683beea066d066637e747c40dc859fb709babf Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 2 Dec 2025 21:20:17 +0000 Subject: refactor: rename AuditMode variants and change CLI default to shared Breaking change: Renamed AuditMode enum variants for clarity: - AuditMode::CI -> AuditMode::Isolated (fresh fixtures per test) - AuditMode::Production -> AuditMode::Shared (reuse fixtures across tests) Config constructors renamed (with deprecated aliases): - AuditConfig::ci() -> AuditConfig::isolated() - AuditConfig::production() -> AuditConfig::shared() CLI default changed from 'ci' to 'shared' mode, which enables fixture caching across tests. This fixes the issue where fixtures were being re-created for every test in CLI mode. Fixture caching behavior: - Shared mode (CLI default): Uses client's cache, fixtures reused - Isolated mode (for cargo test): Local cache per TestContext --- grasp-audit/src/bin/grasp-audit.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'grasp-audit/src/bin') diff --git a/grasp-audit/src/bin/grasp-audit.rs b/grasp-audit/src/bin/grasp-audit.rs index 48c1580..0d88bce 100644 --- a/grasp-audit/src/bin/grasp-audit.rs +++ b/grasp-audit/src/bin/grasp-audit.rs @@ -20,8 +20,11 @@ enum Commands { #[arg(short, long)] relay: String, - /// Mode: ci or production - #[arg(short, long, default_value = "ci")] + /// Fixture mode: shared (default) or isolated + /// + /// - shared: Fixtures are cached and reused across tests (efficient for sequential test runs) + /// - isolated: Each test creates fresh fixtures (for parallel tests like cargo test) + #[arg(short, long, default_value = "shared")] mode: String, /// Spec to test (nip01-smoke, nip11, event-acceptance, cors, git-clone, push-auth, repo-creation, all) @@ -53,10 +56,14 @@ async fn main() -> Result<()> { spec, git_data_dir, } => { + #[allow(deprecated)] let mut config = match mode.as_str() { + "shared" => AuditConfig::shared(), + "isolated" => AuditConfig::isolated(), + // Backwards compatibility aliases "ci" => AuditConfig::ci(), "production" => AuditConfig::production(), - _ => return Err(anyhow!("Invalid mode: {}. Use 'ci' or 'production'", mode)), + _ => return Err(anyhow!("Invalid mode: {}. Use 'shared' or 'isolated'", mode)), }; // Audit needs to create events to test the relay, so disable read-only mode -- cgit v1.2.3