fix: show outside a project names the missing Aura.toml, not the id

show_process/show_campaign now guard env.provenance().is_none() before
touching the registry — the guard their siblings (campaign_runs,
validate_campaign_file) already carry — refusing with the honest
degradation prose ('needs a project ... no Aura.toml found up from
{cwd}') instead of blaming the id with 'not found in the project
store' against a store that does not exist. Refusal exit 1 unchanged.
The register-verb sibling gap (silently creating a stray ./runs/) is
deliberately NOT touched here — tracked as #305.

RED-first: the in-process pin landed at 803c970; independent verify
re-ran it green with the suite.

closes #304
This commit is contained in:
2026-07-21 13:29:39 +02:00
parent 803c9704cc
commit da37f596f2
+18
View File
@@ -263,6 +263,15 @@ fn register_process(file: &PathBuf, env: &Env) -> Result<(), String> {
}
fn show_process(id: &str, env: &Env) -> Result<(), String> {
if env.provenance().is_none() {
let cwd = std::env::current_dir()
.map(|d| d.display().to_string())
.unwrap_or_default();
return Err(format!(
"process show needs a project: the document store lives under the \
project store root (no Aura.toml found up from {cwd})"
));
}
let registry = env.registry();
match registry.get_process(id).map_err(|e| e.to_string())? {
Some(bytes) => {
@@ -584,6 +593,15 @@ fn register_campaign(file: &PathBuf, env: &Env) -> Result<(), String> {
}
fn show_campaign(id: &str, env: &Env) -> Result<(), String> {
if env.provenance().is_none() {
let cwd = std::env::current_dir()
.map(|d| d.display().to_string())
.unwrap_or_default();
return Err(format!(
"campaign show needs a project: the document store lives under the \
project store root (no Aura.toml found up from {cwd})"
));
}
let registry = env.registry();
match registry.get_campaign(id).map_err(|e| e.to_string())? {
Some(bytes) => {