diff --git a/crates/aura-cli/tests/research_docs.rs b/crates/aura-cli/tests/research_docs.rs index 87ab115..7b4ef46 100644 --- a/crates/aura-cli/tests/research_docs.rs +++ b/crates/aura-cli/tests/research_docs.rs @@ -596,6 +596,42 @@ fn campaign_validate_outside_project_skips_referential_tier() { assert!(out.contains("referential checks skipped (no Aura.toml found up from ")); } +/// #305: `register` outside a project (no Aura.toml up from the cwd) refuses +/// up front — exit 1, prose naming the invoked verb and the missing Aura.toml +/// (the honest-degradation guard family `show`, `campaign runs`, and the +/// dissolved run verbs already share) — and leaves NO store. Today the missing +/// `env.provenance()` guard lets `Env::registry()`'s relative `runs/` fallback +/// silently materialise `./runs/` in the innocent cwd and register the +/// document into a store no project owns, exit 0. +#[test] +fn register_outside_a_project_refuses_and_leaves_no_store() { + for (verb, file, doc) in [ + ("process", "p.process.json", PROCESS_DOC), + ("campaign", "c.campaign.json", CAMPAIGN_DOC), + ] { + let dir = temp_cwd(&format!("{verb}-register-outside-project")); + write_doc(&dir, file, doc); + let (out, code) = run_code_in(&dir, &[verb, "register", file]); + assert_eq!( + code, + Some(1), + "{verb} register outside a project must refuse; stdout/stderr: {out}" + ); + assert!( + out.contains(&format!("{verb} register needs a project")), + "{verb} register's refusal must name the invoked verb: {out}" + ); + assert!( + out.contains("no Aura.toml found up from"), + "{verb} register's refusal must name the missing Aura.toml: {out}" + ); + assert!( + !dir.join("runs").exists(), + "{verb} register refused outside a project must leave no ./runs/ store" + ); + } +} + #[test] fn campaign_validate_refuses_empty_axis_prose_exit_1() { let dir = temp_cwd("campaign-validate-empty-axis");