From 0b9dd000df5ba036c3fef214639591d56b8e8fd0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 31 Oct 2026 14:07:08 +0000 Subject: [PATCH 1/4] cli: name a next step in refusal messages and drop the baseline fragments Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01SvmPmp1dk37XMDiDt4z11j --- crates/ripr/src/cli/agent.rs | 199 +++++++++++------- crates/ripr/src/cli/command.rs | 16 +- crates/ripr/src/cli/commands.rs | 23 +- crates/ripr/src/cli/commands/agent.rs | 151 ++++++++----- crates/ripr/src/cli/commands/agent_card.rs | 2 +- crates/ripr/src/cli/commands/baseline.rs | 58 +++-- crates/ripr/src/cli/commands/cache.rs | 52 +++-- crates/ripr/src/cli/commands/capabilities.rs | 6 +- crates/ripr/src/cli/commands/check.rs | 12 +- .../cli/commands/check_argv_refusal_tests.rs | 2 +- crates/ripr/src/cli/commands/check_fanout.rs | 32 +-- crates/ripr/src/cli/commands/ci_packet.rs | 81 ++++--- crates/ripr/src/cli/commands/ci_summary.rs | 6 +- crates/ripr/src/cli/commands/config.rs | 8 +- crates/ripr/src/cli/commands/context.rs | 2 +- crates/ripr/src/cli/commands/doctor.rs | 16 +- crates/ripr/src/cli/commands/feedback.rs | 6 +- crates/ripr/src/cli/commands/gate.rs | 4 +- crates/ripr/src/cli/commands/init.rs | 51 +++-- crates/ripr/src/cli/commands/pilot.rs | 22 +- crates/ripr/src/cli/commands/policy/parse.rs | 26 ++- .../ripr/src/cli/commands/policy/reports.rs | 2 +- .../src/cli/commands/pr_comments_github.rs | 54 ++--- crates/ripr/src/cli/commands/receipt.rs | 23 +- .../ripr/src/cli/commands/review_comments.rs | 30 +-- crates/ripr/src/cli/commands/swarm/ingest.rs | 32 ++- crates/ripr/src/cli/commands/swarm/queue.rs | 8 +- crates/ripr/src/cli/commands/task_first.rs | 14 +- crates/ripr/src/cli/commands_agent_support.rs | 22 +- crates/ripr/src/cli/commands_context.rs | 4 +- crates/ripr/src/cli/commands_numeric.rs | 14 +- crates/ripr/src/cli/commands_timestamps.rs | 2 +- crates/ripr/src/cli/execute.rs | 14 +- crates/ripr/src/cli/help/overview.rs | 2 +- crates/ripr/src/cli/help_json.rs | 6 +- crates/ripr/src/cli/interrupt.rs | 17 +- crates/ripr/src/cli/mod.rs | 88 +++++--- crates/ripr/src/cli/parse/value.rs | 2 +- crates/ripr/src/cli/rerun.rs | 41 ++-- crates/ripr/tests/cli_help_hierarchy.rs | 2 +- crates/ripr/tests/cli_smoke.rs | 14 +- .../tests/cli_smoke/baseline_path_values.rs | 10 +- .../tests/cli_smoke/cli_value_contracts.rs | 6 +- .../crates__ripr__src__cli__agent.rs.txt | 46 ---- .../crates__ripr__src__cli__command.rs.txt | 3 - ...es__ripr__src__cli__commands__agent.rs.txt | 33 --- ...ipr__src__cli__commands__agent_card.rs.txt | 1 - ..._ripr__src__cli__commands__baseline.rs.txt | 7 - ...es__ripr__src__cli__commands__cache.rs.txt | 20 -- ...r__src__cli__commands__capabilities.rs.txt | 1 - ...es__ripr__src__cli__commands__check.rs.txt | 5 - ...r__src__cli__commands__check_fanout.rs.txt | 12 -- ...ripr__src__cli__commands__ci_packet.rs.txt | 22 -- ...ipr__src__cli__commands__ci_summary.rs.txt | 1 - ...s__ripr__src__cli__commands__config.rs.txt | 1 - ...s__ripr__src__cli__commands__doctor.rs.txt | 2 - ..._ripr__src__cli__commands__feedback.rs.txt | 2 - ...tes__ripr__src__cli__commands__gate.rs.txt | 2 - ...tes__ripr__src__cli__commands__init.rs.txt | 7 - ...es__ripr__src__cli__commands__pilot.rs.txt | 4 - ...__src__cli__commands__policy__parse.rs.txt | 6 - ...src__cli__commands__policy__reports.rs.txt | 1 - ...__cli__commands__pr_comments_github.rs.txt | 22 -- ...__ripr__src__cli__commands__receipt.rs.txt | 9 - ...src__cli__commands__review_comments.rs.txt | 13 -- ...__src__cli__commands__swarm__ingest.rs.txt | 4 - ...r__src__cli__commands__swarm__queue.rs.txt | 3 - ...ipr__src__cli__commands__task_first.rs.txt | 4 - ...r__src__cli__commands_agent_support.rs.txt | 7 - ...s__ripr__src__cli__commands_context.rs.txt | 2 - ...s__ripr__src__cli__commands_numeric.rs.txt | 2 - .../crates__ripr__src__cli__help_json.rs.txt | 3 - .../crates__ripr__src__cli__interrupt.rs.txt | 18 -- .../crates__ripr__src__cli__mod.rs.txt | 9 - ...rates__ripr__src__cli__parse__value.rs.txt | 1 - .../crates__ripr__src__cli__rerun.rs.txt | 6 - 76 files changed, 737 insertions(+), 724 deletions(-) delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__agent.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__command.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__agent.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__agent_card.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__baseline.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__cache.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__capabilities.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__check.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__check_fanout.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__ci_packet.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__ci_summary.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__config.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__doctor.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__feedback.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__gate.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__init.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__pilot.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__policy__parse.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__policy__reports.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__pr_comments_github.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__receipt.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__review_comments.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__swarm__ingest.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__swarm__queue.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands__task_first.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands_agent_support.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands_context.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__commands_numeric.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__help_json.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__interrupt.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__mod.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__parse__value.rs.txt delete mode 100644 policy/refusal-next-step.d/crates__ripr__src__cli__rerun.rs.txt diff --git a/crates/ripr/src/cli/agent.rs b/crates/ripr/src/cli/agent.rs index cc6710b5984..be155cb2065 100644 --- a/crates/ripr/src/cli/agent.rs +++ b/crates/ripr/src/cli/agent.rs @@ -362,7 +362,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { refuse_repeated_flag(seam_id.is_some(), "agent repair", "--seam-id")?; let value = expect_value(args, i, "--seam-id")?; if value.trim().is_empty() { - return Err("agent repair --seam-id requires a non-empty ID".to_string()); + return Err("agent repair --seam-id requires a non-empty ID; pass a value right after --seam-id".to_string()); } seam_id = Some(value.to_string()); } @@ -371,7 +371,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { refuse_repeated_flag(gap_id.is_some(), "agent repair", "--gap-id")?; let value = expect_value(args, i, "--gap-id")?; if value.trim().is_empty() { - return Err("agent repair --gap-id requires a non-empty ID".to_string()); + return Err("agent repair --gap-id requires a non-empty ID; pass a value right after --gap-id".to_string()); } gap_id = Some(value.to_string()); } @@ -380,7 +380,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { refuse_repeated_flag(base.is_some(), "agent repair", "--base")?; let value = expect_value(args, i, "--base")?; if value.trim().is_empty() { - return Err("agent repair --base requires a non-empty ref".to_string()); + return Err("agent repair --base requires a non-empty ref; pass a value right after --base".to_string()); } base = Some(value.to_string()); } @@ -389,7 +389,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { refuse_repeated_flag(attempt_id.is_some(), "agent repair", "--attempt")?; let value = expect_value(args, i, "--attempt")?; if value.trim().is_empty() { - return Err("agent repair --attempt requires a non-empty ID".to_string()); + return Err("agent repair --attempt requires a non-empty ID; pass a value right after --attempt".to_string()); } attempt_id = Some(value.to_string()); } @@ -403,7 +403,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { let value = expect_value(args, i, "--python-repair-trust-manifest")?; if value.trim().is_empty() { return Err( - "agent repair --python-repair-trust-manifest requires a non-empty path" + "agent repair --python-repair-trust-manifest requires a non-empty path; pass a value right after --python-repair-trust-manifest" .to_string(), ); } @@ -419,7 +419,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { let value = expect_value(args, i, "--python-repair-trust-attempt")?; if value.trim().is_empty() { return Err( - "agent repair --python-repair-trust-attempt requires a non-empty attempt identity" + "agent repair --python-repair-trust-attempt requires a non-empty attempt identity; pass a value right after --python-repair-trust-attempt" .to_string(), ); } @@ -434,7 +434,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { let value = expect_value(args, i, "--edit-authority")?; if value.trim().is_empty() { return Err( - "agent repair --edit-authority requires a non-empty operator or agent identity" + "agent repair --edit-authority requires a non-empty operator or agent identity; pass a value right after --edit-authority" .to_string(), ); } @@ -453,7 +453,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { let value = expect_value(args, i, "--verify-authority")?; if value.trim().is_empty() { return Err( - "agent repair --verify-authority requires a non-empty operator or agent identity" + "agent repair --verify-authority requires a non-empty operator or agent identity; pass a value right after --verify-authority" .to_string(), ); } @@ -467,7 +467,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { refuse_repeated_flag(store.is_some(), "agent repair", "--store")?; let value = expect_value(args, i, "--store")?; if value.trim().is_empty() { - return Err("agent repair --store requires a non-empty path".to_string()); + return Err("agent repair --store requires a non-empty path; pass a value right after --store".to_string()); } store = Some(PathBuf::from(value)); } @@ -523,7 +523,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { } if base.is_none() { return Err( - "agent repair --gap-id requires --base ; the gap's findings are diff-scoped, so the base the check ran against must be recorded" + "agent repair --gap-id requires --base ; the gap's findings are diff-scoped, so the base the check ran against must be recorded; pass `--base ` with the ref you gave `ripr check`" .to_string(), ); } @@ -551,13 +551,13 @@ fn parse_agent_repair_command(args: &[String]) -> Result { } (Some(_), None) => { return Err( - "agent repair --python-repair-trust-manifest requires --python-repair-trust-attempt " + "agent repair --python-repair-trust-manifest requires --python-repair-trust-attempt ; add `--python-repair-trust-attempt ` to the command" .to_string(), ); } (None, Some(_)) => { return Err( - "agent repair --python-repair-trust-attempt requires --python-repair-trust-manifest " + "agent repair --python-repair-trust-attempt requires --python-repair-trust-manifest ; add `--python-repair-trust-manifest ` to the command" .to_string(), ); } @@ -566,7 +566,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { if gap_id.is_some() && python_repair_trust.is_some() { return Err( - "agent repair --gap-id does not take the Python repair-trust flags; a gap-bound start carries no Python trust binding" + "agent repair --gap-id does not take the Python repair-trust flags; a gap-bound start carries no Python trust binding; drop the Python repair-trust flags, or use `--seam-id` instead of `--gap-id`" .to_string(), ); } @@ -580,20 +580,20 @@ fn parse_agent_repair_command(args: &[String]) -> Result { }; if edit_authorization.authority.is_some() && !edit_authorization.authorized { return Err( - "agent repair --edit-authority requires --edit-authorized; the driver accepts only the explicit pair" + "agent repair --edit-authority requires --edit-authorized; the driver accepts only the explicit pair; pass `--edit-authorized` together with `--edit-authority `" .to_string(), ); } if edit_authorization.authorized && edit_authorization.authority.is_none() { return Err( - "agent repair --edit-authorized requires --edit-authority ; the driver never authorizes an edit automatically" + "agent repair --edit-authorized requires --edit-authority ; the driver never authorizes an edit automatically; pass `--edit-authority ` with it" .to_string(), ); } match (&python_repair_trust, &phase) { (None, AgentRepairPhase::Before) if edit_authorization.authorized => { return Err( - "agent repair --edit-authorized/--edit-authority require --python-repair-trust-manifest and --python-repair-trust-attempt; the unbound driver flow retains no edit authorization" + "agent repair --edit-authorized/--edit-authority require --python-repair-trust-manifest and --python-repair-trust-attempt; the unbound driver flow retains no edit authorization; pass both Python repair-trust flags, or drop the edit flags" .to_string(), ); } @@ -614,13 +614,13 @@ fn parse_agent_repair_command(args: &[String]) -> Result { }; if verify_authorization.authority.is_some() && !verify_authorization.authorized { return Err( - "agent repair --verify-authority requires --verify-authorized; the driver accepts only the explicit pair" + "agent repair --verify-authority requires --verify-authorized; the driver accepts only the explicit pair; pass `--verify-authorized` together with `--verify-authority `" .to_string(), ); } if verify_authorization.authorized && verify_authorization.authority.is_none() { return Err( - "agent repair --verify-authorized requires --verify-authority ; the driver never authorizes a verification automatically" + "agent repair --verify-authorized requires --verify-authority ; the driver never authorizes a verification automatically; pass `--verify-authority ` with it" .to_string(), ); } @@ -644,7 +644,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { // flag is already refused); kept as an explicit guard so a rollback // demand can never ride on an absent verification authorization. return Err( - "agent repair --verify-rollback requires --verify-authorized and --verify-authority " + "agent repair --verify-rollback requires --verify-authorized and --verify-authority ; pass both, and if you did, report this as a ripr bug with the command you ran" .to_string(), ); } @@ -675,7 +675,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { } (false, false) => { return Err( - "agent repair --phase after requires --attempt or --seam-id " + "agent repair --phase after requires --attempt or --seam-id ; pass the attempt ID the before phase printed, or the seam ID" .to_string(), ); } @@ -689,7 +689,7 @@ fn parse_agent_repair_command(args: &[String]) -> Result { ); } if attempt_id.is_none() { - return Err("agent repair --phase verify requires --attempt ".to_string()); + return Err("agent repair --phase verify requires --attempt ; add `--attempt ` to the command".to_string()); } } } @@ -744,7 +744,7 @@ pub(super) fn parse_agent_start_options(args: &[String]) -> Result Result Result Result Result Result Result {} (false, true, false) => { - return Err("agent packet --gap-ledger requires --gap-id".to_string()); + return Err( + "agent packet --gap-ledger requires --gap-id; add `--gap-id` to the command" + .to_string(), + ); } (false, false, true) => { - return Err("agent packet --gap-id requires --gap-ledger".to_string()); + return Err( + "agent packet --gap-id requires --gap-ledger; add `--gap-ledger` to the command" + .to_string(), + ); } (false, false, false) => { return Err( - "agent packet requires --seam-id or --gap-ledger with --gap-id".to_string(), + "agent packet requires --seam-id or --gap-ledger with --gap-id; pass `--seam-id `, or pass both `--gap-ledger ` and `--gap-id `".to_string(), ); } _ => {} @@ -957,7 +965,7 @@ pub(super) fn parse_agent_card_options(args: &[String]) -> Result Result Result Result".to_string())?, + .ok_or_else(|| "agent verify-execute requires --packet ; add `--packet ` to the command".to_string())?, result_json: result_json - .ok_or_else(|| "agent verify-execute requires --result-json ".to_string())?, + .ok_or_else(|| "agent verify-execute requires --result-json ; add `--result-json ` to the command".to_string())?, authorize, cancel_after_ms, json, @@ -1210,7 +1222,7 @@ pub(super) fn parse_agent_receipt_options(args: &[String]) -> Result Result Result Result Result".to_string())?; - let seam_id = seam_id.ok_or_else(|| "agent receipt requires --seam-id".to_string())?; + let verify_json = verify_json.ok_or_else(|| { + "agent receipt requires --verify-json ; add `--verify-json ` to the command" + .to_string() + })?; + let seam_id = seam_id.ok_or_else(|| { + "agent receipt requires --seam-id; add `--seam-id` to the command".to_string() + })?; if !json { return Err( "agent receipt requires --json (the supported output for this subcommand); add --json to the command".to_string(), @@ -1300,7 +1316,7 @@ pub(super) fn parse_agent_status_options(args: &[String]) -> Result Result Result, String> { for part in value.split(',') { let trimmed = part.trim(); if trimmed.is_empty() { - return Err("agent brief --files requires non-empty paths".to_string()); + return Err("agent brief --files requires non-empty paths; pass comma-separated paths with no empty entries, such as `--files src/a.rs,src/b.rs`".to_string()); } paths.push(PathBuf::from(trimmed)); } @@ -1387,7 +1403,7 @@ fn parse_max_seams(value: &str) -> Result { let parsed = super::commands_numeric::parse_positive_usize(value, "--max-seams")?; if parsed > AGENT_BRIEF_HARD_MAX_SEAMS { return Err(format!( - "invalid --max-seams: maximum is {AGENT_BRIEF_HARD_MAX_SEAMS}" + "invalid --max-seams: maximum is {AGENT_BRIEF_HARD_MAX_SEAMS}; pass a value of {AGENT_BRIEF_HARD_MAX_SEAMS} or less" )); } Ok(parsed) @@ -1570,7 +1586,7 @@ mod tests { ])); match parsed { Err(message) => assert!( - message.contains("agent verify --gap-id requires a non-empty ID"), + message.contains("agent verify --gap-id requires a non-empty ID; pass a value right after --gap-id"), "unexpected refusal: {message:?}" ), other => return Err(format!("an empty --gap-id must refuse, got {other:?}")), @@ -1644,7 +1660,7 @@ mod tests { "0", "--json", ], - "--cancel-after-ms requires a positive integer; got \"0\"", + "--cancel-after-ms requires a positive integer; pass a whole number of 1 or more, got \"0\"", ), ] { let error = parse_agent_verify_execute_options(&args(&argv)) @@ -1695,7 +1711,7 @@ mod tests { // requirement. assert_eq!( parse_agent_args(&args(&["packet"])), - Err("agent packet requires --seam-id or --gap-ledger with --gap-id".to_string()) + Err("agent packet requires --seam-id or --gap-ledger with --gap-id; pass `--seam-id `, or pass both `--gap-ledger ` and `--gap-id `".to_string()) ); assert_eq!( parse_agent_args(&args(&["packet", "--seam-id", "abc"])), @@ -1864,7 +1880,10 @@ mod tests { "--phase", "before", ])), - Err("agent repair --store requires a non-empty path".to_string()) + Err( + "agent repair --store requires a non-empty path; pass a value right after --store" + .to_string() + ) ); } @@ -2280,11 +2299,14 @@ mod tests { ); assert_eq!( parse_agent_start_options(&args(&[])), - Err("agent start requires --seam-id".to_string()) + Err("agent start requires --seam-id; add `--seam-id` to the command".to_string()) ); assert_eq!( parse_agent_start_options(&args(&["--seam-id", ""])), - Err("agent start --seam-id requires a non-empty ID".to_string()) + Err( + "agent start --seam-id requires a non-empty ID; pass a value right after --seam-id" + .to_string() + ) ); } @@ -2292,7 +2314,7 @@ mod tests { fn agent_start_requires_values_and_rejects_unknown_arguments() { assert_eq!( parse_agent_start_options(&args(&["--root"])), - Err("missing value for --root".to_string()) + Err("missing value for --root; pass a value right after it".to_string()) ); assert_eq!( parse_agent_start_options(&args(&["--seam-id"])), @@ -2304,7 +2326,10 @@ mod tests { ); assert_eq!( parse_agent_start_options(&args(&["--seam-id", "abc", "--out", ""])), - Err("agent start --out requires a non-empty path".to_string()) + Err( + "agent start --out requires a non-empty path; pass a value right after --out" + .to_string() + ) ); assert_eq!( parse_agent_start_options(&args(&["--seam-id", "abc", "--xml"])), @@ -2439,7 +2464,7 @@ mod tests { fn agent_brief_requires_values_for_value_flags() { assert_eq!( parse_agent_brief_options(&args(&["--root"])), - Err("missing value for --root".to_string()) + Err("missing value for --root; pass a value right after it".to_string()) ); assert_eq!( parse_agent_brief_options(&args(&["--diff"])), @@ -2473,7 +2498,7 @@ mod tests { "--max-seams", "many", ])), - Err("--max-seams requires a positive integer; got \"many\"".to_string()) + Err("--max-seams requires a positive integer; pass a whole number of 1 or more, got \"many\"".to_string()) ); assert_eq!( parse_agent_brief_options(&args(&[ @@ -2483,7 +2508,7 @@ mod tests { "--max-seams", "0", ])), - Err("--max-seams requires a positive integer; got \"0\"".to_string()) + Err("--max-seams requires a positive integer; pass a whole number of 1 or more, got \"0\"".to_string()) ); assert_eq!( parse_agent_brief_options(&args(&[ @@ -2493,11 +2518,11 @@ mod tests { "--max-seams", "11", ])), - Err("invalid --max-seams: maximum is 10".to_string()) + Err("invalid --max-seams: maximum is 10; pass a value of 10 or less".to_string()) ); assert_eq!( parse_agent_brief_options(&args(&["--files", "src/lib.rs,", "--json"])), - Err("agent brief --files requires non-empty paths".to_string()) + Err("agent brief --files requires non-empty paths; pass comma-separated paths with no empty entries, such as `--files src/a.rs,src/b.rs`".to_string()) ); } @@ -2544,11 +2569,11 @@ mod tests { ); assert_eq!( parse_agent_packet_options(&args(&["--json"])), - Err("agent packet requires --seam-id or --gap-ledger with --gap-id".to_string()) + Err("agent packet requires --seam-id or --gap-ledger with --gap-id; pass `--seam-id `, or pass both `--gap-ledger ` and `--gap-id `".to_string()) ); assert_eq!( parse_agent_packet_options(&args(&["--seam-id", "", "--json"])), - Err("agent packet --seam-id requires a non-empty ID".to_string()) + Err("agent packet --seam-id requires a non-empty ID; pass a value right after --seam-id".to_string()) ); } @@ -2601,11 +2626,14 @@ mod tests { fn agent_card_requires_seam_id_and_rejects_unknown_arguments() { assert_eq!( parse_agent_card_options(&args(&["--json"])), - Err("agent card requires --seam-id".to_string()) + Err("agent card requires --seam-id; add `--seam-id` to the command".to_string()) ); assert_eq!( parse_agent_card_options(&args(&["--seam-id", ""])), - Err("agent card --seam-id requires a non-empty ID".to_string()) + Err( + "agent card --seam-id requires a non-empty ID; pass a value right after --seam-id" + .to_string() + ) ); assert_eq!( parse_agent_card_options(&args(&["--seam-id", "abc", "--xml"])), @@ -2657,15 +2685,21 @@ mod tests { ); assert_eq!( parse_agent_packet_options(&args(&["--gap-ledger", "ledger.json", "--json"])), - Err("agent packet --gap-ledger requires --gap-id".to_string()) + Err( + "agent packet --gap-ledger requires --gap-id; add `--gap-id` to the command" + .to_string() + ) ); assert_eq!( parse_agent_packet_options(&args(&["--gap-id", "gap:a", "--json"])), - Err("agent packet --gap-id requires --gap-ledger".to_string()) + Err( + "agent packet --gap-id requires --gap-ledger; add `--gap-ledger` to the command" + .to_string() + ) ); assert_eq!( parse_agent_packet_options(&args(&["--gap-ledger", "", "--gap-id", "gap:a", "--json"])), - Err("agent packet --gap-ledger requires a non-empty path".to_string()) + Err("agent packet --gap-ledger requires a non-empty path; pass a value right after --gap-ledger".to_string()) ); assert_eq!( parse_agent_packet_options(&args(&[ @@ -2675,7 +2709,10 @@ mod tests { "", "--json" ])), - Err("agent packet --gap-id requires a non-empty ID".to_string()) + Err( + "agent packet --gap-id requires a non-empty ID; pass a value right after --gap-id" + .to_string() + ) ); } @@ -2850,7 +2887,7 @@ mod tests { " ", "--json", ])), - Err("agent receipt --attempt requires a non-empty ID".to_string()) + Err("agent receipt --attempt requires a non-empty ID; pass a value right after --attempt".to_string()) ); } @@ -2870,11 +2907,11 @@ mod tests { ); assert_eq!( parse_agent_receipt_options(&args(&["--seam-id", "abc", "--json"])), - Err("agent receipt requires --verify-json ".to_string()) + Err("agent receipt requires --verify-json ; add `--verify-json ` to the command".to_string()) ); assert_eq!( parse_agent_receipt_options(&args(&["--verify-json", "agent-verify.json", "--json"])), - Err("agent receipt requires --seam-id".to_string()) + Err("agent receipt requires --seam-id; add `--seam-id` to the command".to_string()) ); assert_eq!( parse_agent_receipt_options(&args(&[ @@ -2884,7 +2921,7 @@ mod tests { "", "--json", ])), - Err("agent receipt --seam-id requires a non-empty ID".to_string()) + Err("agent receipt --seam-id requires a non-empty ID; pass a value right after --seam-id".to_string()) ); } @@ -2915,7 +2952,10 @@ mod tests { "", "--json", ])), - Err("agent receipt --test requires a non-empty value".to_string()) + Err( + "agent receipt --test requires a non-empty value; pass a value right after --test" + .to_string() + ) ); assert_eq!( parse_agent_receipt_options(&args(&[ @@ -2927,7 +2967,7 @@ mod tests { "", "--json", ])), - Err("agent receipt --command requires a non-empty value".to_string()) + Err("agent receipt --command requires a non-empty value; pass a value right after --command".to_string()) ); } @@ -2978,7 +3018,10 @@ mod tests { ); assert_eq!( parse_agent_status_options(&args(&["--store", ""])), - Err("agent status --store requires a non-empty path".to_string()) + Err( + "agent status --store requires a non-empty path; pass a value right after --store" + .to_string() + ) ); } @@ -3015,7 +3058,7 @@ mod tests { ); assert_eq!( parse_agent_status_options(&args(&["--attempt", ""])), - Err("agent status --attempt requires a non-empty repair attempt ID".to_string()) + Err("agent status --attempt requires a non-empty repair attempt ID; pass a value right after --attempt".to_string()) ); } @@ -3034,7 +3077,7 @@ mod tests { ); assert_eq!( parse_agent_status_options(&args(&["--root"])), - Err("missing value for --root".to_string()) + Err("missing value for --root; pass a value right after it".to_string()) ); assert_eq!( parse_agent_status_options(&args(&["--json", "--xml"])), @@ -3077,7 +3120,7 @@ mod tests { fn agent_review_summary_requires_values_and_rejects_unknown_arguments() { assert_eq!( parse_agent_review_summary_options(&args(&["--root"])), - Err("missing value for --root".to_string()) + Err("missing value for --root; pass a value right after it".to_string()) ); assert_eq!( parse_agent_review_summary_options(&args(&["--xml"])), diff --git a/crates/ripr/src/cli/command.rs b/crates/ripr/src/cli/command.rs index 5e709274626..111f5fd7e52 100644 --- a/crates/ripr/src/cli/command.rs +++ b/crates/ripr/src/cli/command.rs @@ -72,7 +72,7 @@ impl CliCommand { Some("--help" | "-h") if wants_all(&command_args) => match command_args.len() { 1 => Ok(Self::HelpAll), _ => Err( - "usage: ripr --help --all (this route accepts no other arguments)".to_string(), + "usage: ripr --help --all (this route accepts no other arguments); drop the extra arguments, or run `ripr --help` to list commands".to_string(), ), }, None | Some("--help" | "-h") => Ok(Self::Help), @@ -89,7 +89,7 @@ impl CliCommand { return match command_args.len() { 1 => Ok(Self::HelpAll), _ => Err( - "usage: ripr help --all (this route accepts no other arguments)" + "usage: ripr help --all (this route accepts no other arguments); drop the extra arguments, or run `ripr --help` to list commands" .to_string(), ), }; @@ -100,7 +100,7 @@ impl CliCommand { return match command_args.len() { 1 => Ok(Self::HelpJson), _ => Err( - "usage: ripr help --json (this route accepts no other arguments)" + "usage: ripr help --json (this route accepts no other arguments); drop the extra arguments, or run `ripr --help` to list commands" .to_string(), ), }; @@ -189,7 +189,7 @@ fn help_workflow_command(args: &[String]) -> Result { [] => Ok(CliCommand::HelpWorkflow(None)), [name] if !name.starts_with('-') => Ok(CliCommand::HelpWorkflow(Some(name.clone()))), _ => Err( - "usage: ripr help workflow [] (this route accepts no flags)".to_string(), + "usage: ripr help workflow [] (this route accepts no flags); drop the flags, or run `ripr help workflow` to list workflows".to_string(), ), } } @@ -432,7 +432,7 @@ mod tests { /// usage error naming the accepted form. #[test] fn help_all_rejects_trailing_arguments() { - let usage = "usage: ripr help --all (this route accepts no other arguments)"; + let usage = "usage: ripr help --all (this route accepts no other arguments); drop the extra arguments, or run `ripr --help` to list commands"; for bad in [ args(&["--all", "check"]), args(&["--all", "foo", "bar"]), @@ -443,7 +443,7 @@ mod tests { Err(usage.to_string()) ); } - let flag_usage = "usage: ripr --help --all (this route accepts no other arguments)"; + let flag_usage = "usage: ripr --help --all (this route accepts no other arguments); drop the extra arguments, or run `ripr --help` to list commands"; assert_eq!( CliCommand::from_parts(Some("--help"), args(&["--all", "check"])), Err(flag_usage.to_string()) @@ -827,7 +827,7 @@ mod tests { ); // Flag-shaped names and extra arguments are usage errors, keeping the // failure family distinct from the unknown-workflow family. - let usage = "usage: ripr help workflow [] (this route accepts no flags)"; + let usage = "usage: ripr help workflow [] (this route accepts no flags); drop the flags, or run `ripr help workflow` to list workflows"; for bad in [ args(&["workflow", "--json"]), args(&["workflow", "repair-gap", "extra"]), @@ -848,7 +848,7 @@ mod tests { CliCommand::from_parts(Some("help"), args(&["--json"])), Ok(CliCommand::HelpJson) ); - let usage = "usage: ripr help --json (this route accepts no other arguments)"; + let usage = "usage: ripr help --json (this route accepts no other arguments); drop the extra arguments, or run `ripr --help` to list commands"; for bad in [ args(&["--json", "extra"]), args(&["--json", "--quiet"]), diff --git a/crates/ripr/src/cli/commands.rs b/crates/ripr/src/cli/commands.rs index 8f37e4a8332..8e9c2fa10fd 100644 --- a/crates/ripr/src/cli/commands.rs +++ b/crates/ripr/src/cli/commands.rs @@ -92,7 +92,7 @@ fn write_text_file(path: &Path, rendered: &str) -> Result<(), String> { crate::atomic_file::ensure_relative_output_contained(path)?; output::file_write::write(path, rendered.as_bytes()).map_err(|err| { format!( - "write output {} failed: {err}", + "write output {} failed: {err}; check you can write to that path, then rerun", output::outcome::display_path(path) ) }) @@ -4970,7 +4970,7 @@ mod tests { ); assert_eq!( parse_policy_operations_options(&args(&[])), - Err("policy operations requires --policy-readiness ".to_string()) + Err("policy operations requires --policy-readiness ; add `--policy-readiness ` to the command".to_string()) ); assert_eq!( parse_policy_operations_options(&args(&["--policy-readiness", ""])), @@ -4982,7 +4982,9 @@ mod tests { ); assert_eq!( parse_policy_promotion_options(&args(&[])), - Err("policy promote requires --to ".to_string()) + Err( + "policy promote requires --to ; add `--to ` to the command".to_string() + ) ); assert_eq!( parse_policy_promotion_options(&args(&["--to", "strict"])), @@ -5000,7 +5002,7 @@ mod tests { ); assert_eq!( parse_policy_promotion_options(&args(&["--to", "visible-only"])), - Err("policy promote requires --operations ".to_string()) + Err("policy promote requires --operations ; add `--operations ` to the command".to_string()) ); assert_eq!( parse_policy_promotion_options(&args(&["--to", "visible-only", "--operations", ""])), @@ -5015,7 +5017,7 @@ mod tests { ); assert_eq!( parse_policy_preview_promotion_options(&args(&[])), - Err("policy preview-promote requires --language ".to_string()) + Err("policy preview-promote requires --language ; add `--language ` to the command".to_string()) ); assert_eq!( parse_policy_preview_promotion_options(&args(&["--language", "ruby"])), @@ -5033,7 +5035,7 @@ mod tests { ); assert_eq!( parse_policy_preview_promotion_options(&args(&["--language", "typescript"])), - Err("policy preview-promote requires --class ".to_string()) + Err("policy preview-promote requires --class ; add `--class ` to the command".to_string()) ); assert_eq!( parse_policy_preview_promotion_options(&args(&[ @@ -5082,7 +5084,10 @@ mod tests { ); assert_eq!( parse_policy_history_options(&args(&[])), - Err("policy history requires --current ".to_string()) + Err( + "policy history requires --current ; add `--current ` to the command" + .to_string() + ) ); assert_eq!( parse_policy_history_options(&args(&["--current", ""])), @@ -7873,7 +7878,7 @@ language = "rust" fn init_requires_root_value() { assert_eq!( init(&args(&["--root"])), - Err("missing value for --root".to_string()) + Err("missing value for --root; pass a value right after it".to_string()) ); assert_eq!( init(&args(&["--ci"])), @@ -8953,7 +8958,7 @@ language = "rust" fn explain_requires_values_for_value_flags() { assert_eq!( explain(&args(&["--root"])), - Err("missing value for --root".to_string()) + Err("missing value for --root; pass a value right after it".to_string()) ); assert_eq!( explain(&args(&["--base"])), diff --git a/crates/ripr/src/cli/commands/agent.rs b/crates/ripr/src/cli/commands/agent.rs index be85cd29581..52ac4ccea35 100644 --- a/crates/ripr/src/cli/commands/agent.rs +++ b/crates/ripr/src/cli/commands/agent.rs @@ -470,8 +470,12 @@ fn write_agent_start_with_report( add_agent_brief_provenance_warning(&input.root, &mut selection); let out_dir = resolve_agent_start_out_dir(&input.root, &options.out_dir); - std::fs::create_dir_all(&out_dir) - .map_err(|err| format!("create {} failed: {err}", out_dir.display()))?; + std::fs::create_dir_all(&out_dir).map_err(|err| { + format!( + "create {} failed: {err}; check you can create files under that directory, then rerun", + out_dir.display() + ) + })?; let agent_brief_json = output::agent_brief::render_agent_brief_json( &input.root, @@ -804,7 +808,7 @@ fn render_agent_packet_with_context( } let seam_id = options.seam_id.as_deref().ok_or_else(|| { - CoreError::from("agent packet requires --seam-id or --gap-ledger with --gap-id") + CoreError::from("agent packet requires --seam-id or --gap-ledger with --gap-id; pass `--seam-id `, or pass both `--gap-ledger ` and `--gap-id `") })?; let config = load_for_root(&options.root).map_err(|err| config_load_refusal(&options.root, err))?; @@ -1033,7 +1037,7 @@ fn run_agent_receipt_for_attempt( .get("inputs") .and_then(|inputs| inputs.get("before_content_sha256")) .and_then(serde_json::Value::as_str) - .ok_or_else(|| "agent verify JSON is missing before_content_sha256".to_string())?; + .ok_or_else(|| "agent verify JSON is missing before_content_sha256; regenerate it with `ripr agent verify --json` from this ripr version".to_string())?; crate::app::repair_attempt::validate_verify_binding_from( &options.root, store, @@ -1101,12 +1105,12 @@ fn run_agent_receipt_for_attempt( analysis_outcome, )?; let mut receipt: serde_json::Value = serde_json::from_str(&rendered) - .map_err(|error| format!("parse rendered agent receipt failed: {error}"))?; + .map_err(|error| format!("parse rendered agent receipt failed: {error}; report this as a ripr bug with the command you ran"))?; if let Some(binding) = repair_attempt_binding { receipt["repair_attempt"] = binding; } let rendered = serde_json::to_string_pretty(&receipt) - .map_err(|error| format!("serialize bound agent receipt failed: {error}"))? + .map_err(|error| format!("serialize bound agent receipt failed: {error}; report this as a ripr bug with the command you ran"))? + "\n"; match options.out { @@ -1177,7 +1181,7 @@ fn resolve_agent_receipt_out_path(root: &Path, out: &Path) -> Result Result<() != crate::agent::loop_commands::lexically_clean(&default_dir) { return Err(format!( - "agent status --out {} is not supported: agent status reads the workflow artifacts under {}", + "agent status --out {} is not supported: agent status reads the workflow artifacts under {}; omit --out, or pass the default workflow directory", dir.display(), default_dir.display() )); @@ -1216,7 +1220,7 @@ pub(in crate::cli) fn run_agent_status(options: AgentStatusOptions) -> Result<() // lexical resolution provably matches filesystem resolution. if parent_dir_follows_symlink(&requested) { return Err(format!( - "agent status --out {} is not supported: a symlink before `..` resolves to a different directory than its spelling; agent status reads the workflow artifacts under {}", + "agent status --out {} is not supported: a symlink before `..` resolves to a different directory than its spelling; agent status reads the workflow artifacts under {}; omit --out, or pass the default workflow directory", dir.display(), default_dir.display() )); @@ -1338,7 +1342,7 @@ pub(in crate::cli) fn run_before_repair_with_identity( ) -> Result<(), crate::cli::BeforePhaseError> { if options.phase != AgentRepairPhase::Before { return Err(CommandError::Failure( - "prepared before identity requires the before phase".to_string(), + "prepared before identity requires the before phase; report this as a ripr bug with the command you ran".to_string(), ) .into()); } @@ -1395,7 +1399,7 @@ fn run_agent_repair_with_identity_ctx( .map(|message| format!("; prior phase failure: {message}")) .unwrap_or_default(); result = Err(format!( - "resolve shared workflow artifacts failed: {error}{previous}" + "resolve shared workflow artifacts failed: {error}{previous}; remove target/ripr/workflow by hand, then rerun the repair command" )); refusal.typed = false; refusal.pending_stdout = if json { @@ -1651,14 +1655,22 @@ fn read_workflow_file(path: &Path) -> Result, WorkflowFileIdenti let mut file = match output::file_write::open_regular_read(path) { Ok(file) => file, Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(None), - Err(error) => return Err(format!("open {} failed: {error}", path.display())), + Err(error) => { + return Err(format!( + "open {} failed: {error}; check the path exists and you can read it, then rerun", + path.display() + )); + } }; - let before = file - .metadata() - .map_err(|error| format!("inspect {} failed: {error}", path.display()))?; + let before = file.metadata().map_err(|error| { + format!( + "inspect {} failed: {error}; check the path exists and you can read it, then rerun", + path.display() + ) + })?; if before.len() > crate::edit_cage::MAX_CAPTURE_FILE_BYTES { return Err(format!( - "workflow artifact {} exceeds the edit-cage capture limit; leave it in place and inspect it before retrying", + "workflow artifact {} exceeds the edit-cage capture limit; inspect it before retrying, and leave it in place", path.display() )); } @@ -1666,18 +1678,30 @@ fn read_workflow_file(path: &Path) -> Result, WorkflowFileIdenti (&mut file) .take(crate::edit_cage::MAX_CAPTURE_FILE_BYTES + 1) .read_to_end(&mut bytes) - .map_err(|error| format!("read {} failed: {error}", path.display()))?; + .map_err(|error| { + format!( + "read {} failed: {error}; check the path exists and you can read it, then rerun", + path.display() + ) + })?; if bytes.len() as u64 > crate::edit_cage::MAX_CAPTURE_FILE_BYTES { return Err(format!( - "workflow artifact {} exceeds the edit-cage capture limit", + "workflow artifact {} exceeds the edit-cage capture limit; remove or shrink that file, then rerun", path.display() )); } - let after = file - .metadata() - .map_err(|error| format!("reinspect {} failed: {error}", path.display()))?; - let leaf = std::fs::symlink_metadata(path) - .map_err(|error| format!("reinspect {} failed: {error}", path.display()))?; + let after = file.metadata().map_err(|error| { + format!( + "reinspect {} failed: {error}; check the path exists and you can read it, then rerun", + path.display() + ) + })?; + let leaf = std::fs::symlink_metadata(path).map_err(|error| { + format!( + "reinspect {} failed: {error}; check the path exists and you can read it, then rerun", + path.display() + ) + })?; if !leaf.file_type().is_file() || !crate::edit_cage::same_file_object(&after, &leaf) || before.len() != after.len() @@ -1748,18 +1772,28 @@ impl SharedWorkflowArtifacts { )); } Err(error) if error.kind() == std::io::ErrorKind::NotFound => {} - Err(error) => return Err(format!("inspect {} failed: {error}", backup.display())), + Err(error) => { + return Err(format!( + "inspect {} failed: {error}; check the path exists and you can read it, then rerun", + backup.display() + )); + } } match std::fs::symlink_metadata(path) { Ok(metadata) if !metadata.file_type().is_file() => { return Err(format!( - "workflow artifact {} is not a regular file", + "workflow artifact {} is not a regular file; replace it with a regular file or remove it, then rerun", path.display() )); } Ok(_) => {} Err(error) if error.kind() == std::io::ErrorKind::NotFound => {} - Err(error) => return Err(format!("inspect {} failed: {error}", path.display())), + Err(error) => { + return Err(format!( + "inspect {} failed: {error}; check the path exists and you can read it, then rerun", + path.display() + )); + } } } let copy_result = (|| -> Result<_, String> { @@ -1773,10 +1807,10 @@ impl SharedWorkflowArtifacts { // publishes the replacement. Failed copies are retained for // inspection instead of deleting uncertain evidence. let source = output::file_write::open_regular_read(path) - .map_err(|error| format!("open {} failed: {error}", path.display()))?; + .map_err(|error| format!("open {} failed: {error}; check the path exists and you can read it, then rerun", path.display()))?; let source_metadata = source .metadata() - .map_err(|error| format!("inspect {} failed: {error}", path.display()))?; + .map_err(|error| format!("inspect {} failed: {error}; check the path exists and you can read it, then rerun", path.display()))?; if workflow_mode(&source_metadata) != identity.mode { return Err(format!( "workflow artifact {} changed while preserved", @@ -1837,13 +1871,17 @@ impl SharedWorkflowArtifacts { } if bytes.len() as u64 > crate::edit_cage::MAX_CAPTURE_FILE_BYTES { return Err(format!( - "workflow output {} exceeds capture limit of {} bytes", + "workflow output {} exceeds capture limit of {} bytes; remove the oversized file under target/ripr/workflow, then rerun", path.display(), crate::edit_cage::MAX_CAPTURE_FILE_BYTES )); } - output::file_write::write(path, bytes) - .map_err(|error| format!("publish {} failed: {error}", path.display()))?; + output::file_write::write(path, bytes).map_err(|error| { + format!( + "publish {} failed: {error}; check you can write to that path, then rerun", + path.display() + ) + })?; self.note_write(path, bytes) } @@ -1951,10 +1989,10 @@ impl SharedWorkflowArtifacts { } if let Some(bytes) = backup_bytes { let permissions = output::file_write::open_regular_read( - backup.as_ref().ok_or("backup missing")?, + backup.as_ref().ok_or("workflow backup missing; report this as a ripr bug with the command you ran")?, ) .and_then(|file| file.metadata()) - .map_err(|error| format!("inspect backup permissions failed: {error}"))? + .map_err(|error| format!("inspect backup permissions failed: {error}; check permissions on target/ripr/workflow, then rerun"))? .permissions(); crate::app::repair_attempt::replace_file_atomically(path, bytes)?; std::fs::set_permissions(path, permissions).map_err(|error| { @@ -1965,7 +2003,7 @@ impl SharedWorkflowArtifacts { })?; } else { std::fs::remove_file(path) - .map_err(|error| format!("remove {} failed: {error}", path.display()))?; + .map_err(|error| format!("remove {} failed: {error}; check you can write to that path, then rerun", path.display()))?; } } } @@ -2001,7 +2039,7 @@ impl SharedWorkflowArtifacts { { let mut permissions = std::fs::metadata(backup) .map_err(|error| { - format!("inspect backup {} failed: {error}", backup.display()) + format!("inspect backup {} failed: {error}; check permissions on that path, then rerun", backup.display()) })? .permissions(); if permissions.readonly() { @@ -2042,7 +2080,7 @@ fn render_repair_after_refusal_json( }); serde_json::to_string_pretty(&document) .map(|rendered| format!("{rendered}\n")) - .map_err(|error| format!("serialize after-phase refusal document failed: {error}")) + .map_err(|error| format!("serialize after-phase refusal document failed: {error}; report this as a ripr bug with the command you ran")) } /// The typed-failure stdout document of an after phase whose edit cage @@ -2068,7 +2106,7 @@ fn render_repair_after_failure_json( }); serde_json::to_string_pretty(&document) .map(|rendered| format!("{rendered}\n")) - .map_err(|error| format!("serialize after-phase failure document failed: {error}")) + .map_err(|error| format!("serialize after-phase failure document failed: {error}; report this as a ripr bug with the command you ran")) } impl AfterPhaseRefusalContext { @@ -2426,7 +2464,7 @@ fn run_agent_repair_phase( refusal.typed = true; refusal.stop_unrecorded = true; return Err(format!( - "repair attempt `{}` has spent its after-phase retry budget ({} refusals)", + "repair attempt `{}` has spent its after-phase retry budget ({} refusals); start a new attempt with `ripr agent repair --phase before`", attempt.attempt_id.as_str(), crate::app::repair_attempt::after_refusal_total(&prior_refusals) )); @@ -2468,7 +2506,7 @@ fn run_agent_repair_phase( refusal .workflow_artifacts .as_mut() - .ok_or("workflow tracking missing")? + .ok_or("workflow tracking missing; report this as a ripr bug with the command you ran")? .write(&after, snapshot.rendered.as_bytes())?; gap_analysis_outcome = Some(snapshot.rendered); after @@ -2478,7 +2516,7 @@ fn run_agent_repair_phase( refusal .workflow_artifacts .as_mut() - .ok_or("workflow tracking missing")? + .ok_or("workflow tracking missing; report this as a ripr bug with the command you ran")? .note_write(&after, &bytes)?; after }; @@ -2491,7 +2529,7 @@ fn run_agent_repair_phase( ) })?; let packet_text = String::from_utf8(packet_bytes.clone()) - .map_err(|error| format!("retained repair packet is not UTF-8: {error}"))?; + .map_err(|error| format!("retained repair packet is not UTF-8: {error}; start a new attempt with `ripr agent repair --phase before`"))?; let mut cage_policy = crate::app::repair_attempt::edit_cage_policy_from_packet( &packet_text, &attempt.seam_id, @@ -2520,7 +2558,7 @@ fn run_agent_repair_phase( None => { if edit_authorization.authorized { return Err( - "agent repair --edit-authorized/--edit-authority require an attempt whose before phase recorded a python repair-trust binding; this attempt is not trust-bound" + "agent repair --edit-authorized/--edit-authority require an attempt whose before phase recorded a python repair-trust binding; this attempt is not trust-bound; drop those flags, or start a trust-bound attempt with `--phase before`" .to_string(), ); } @@ -2570,7 +2608,7 @@ fn run_agent_repair_phase( // above, so it maps to the decision exit code 3. refusal.typed = true; return Err(format!( - "repair attempt `{}` cannot finish: HEAD {current_head} does not descend from its before-phase head {}", + "repair attempt `{}` cannot finish: HEAD {current_head} does not descend from its before-phase head {}; check out the before-phase head, or start a new attempt with `ripr agent repair --phase before`", attempt.attempt_id.as_str(), attempt.repository_head )); @@ -2590,7 +2628,9 @@ fn run_agent_repair_phase( refusal .workflow_artifacts .as_mut() - .ok_or("workflow tracking missing")? + .ok_or( + "workflow tracking missing; report this as a ripr bug with the command you ran", + )? .write(&outcome_path, &outcome_bytes)?; let verify_options = AgentVerifyOptions { @@ -2655,7 +2695,9 @@ fn run_agent_repair_phase( refusal .workflow_artifacts .as_mut() - .ok_or("workflow tracking missing")? + .ok_or( + "workflow tracking missing; report this as a ripr bug with the command you ran", + )? .write(&verify_json, rendered_verify.as_bytes())?; // With --json, stdout carries exactly one JSON document on every @@ -2710,7 +2752,7 @@ fn run_agent_repair_phase( let owned_backups = refusal .workflow_artifacts .as_ref() - .ok_or("workflow tracking missing")? + .ok_or("workflow tracking missing; report this as a ripr bug with the command you ran")? .owned_backups(&root)?; let cage_after = match finish_repair_attempt_with_workflow_backups_from( &root, @@ -2917,7 +2959,7 @@ fn run_agent_repair_phase( } Err(restore_error) => { apply_record_result = Err(format!( - "{error}; rolling the attempt back for a retry also failed: {restore_error}" + "{error}; rolling the attempt back for a retry also failed: {restore_error}; remove target/ripr/workflow by hand, then rerun the repair command" )); } } @@ -2982,9 +3024,9 @@ fn run_agent_repair_phase( } }; let document: serde_json::Value = serde_json::from_str(&rendered_verify) - .map_err(|error| format!("parse rendered agent verify JSON failed: {error}"))?; + .map_err(|error| format!("parse rendered agent verify JSON failed: {error}; report this as a ripr bug with the command you ran"))?; let status_document: serde_json::Value = serde_json::from_str(&status_rendered) - .map_err(|error| format!("parse rendered agent status JSON failed: {error}"))?; + .map_err(|error| format!("parse rendered agent status JSON failed: {error}; report this as a ripr bug with the command you ran"))?; // The success output is its own versioned envelope // (`repair_after_result`), not a mutated verify document: the // verify outcome already owns the top-level `status` name @@ -3003,7 +3045,7 @@ fn run_agent_repair_phase( "agent_status": status_document, }); let combined = serde_json::to_string_pretty(&envelope).map_err(|error| { - format!("serialize after-phase result document failed: {error}") + format!("serialize after-phase result document failed: {error}; report this as a ripr bug with the command you ran") })?; let receipt_path = root.join("target/ripr/reports/agent-receipt.json"); let mut summary_lines = gap_lines; @@ -3134,7 +3176,7 @@ fn write_agent_repo_exposure_snapshot_with_report( .filter(|parent| !parent.as_os_str().is_empty()) { std::fs::create_dir_all(parent) - .map_err(|err| format!("create {} failed: {err}", parent.display()))?; + .map_err(|err| format!("create {} failed: {err}; check you can create files under that directory, then rerun", parent.display()))?; } // The before-phase snapshot is streamed without the bounded after-phase // backup reader. The shared output owner keeps the previous destination @@ -3173,7 +3215,12 @@ fn publish_agent_snapshot( } Ok(()) }) - .map_err(|error| format!("publish {} failed: {error}", path.display())) + .map_err(|error| { + format!( + "publish {} failed: {error}; check you can write to that path, then rerun", + path.display() + ) + }) } /// Narration for the repair after phase: the receipt's summary, or a line diff --git a/crates/ripr/src/cli/commands/agent_card.rs b/crates/ripr/src/cli/commands/agent_card.rs index 50c9818f9f9..e512cce1508 100644 --- a/crates/ripr/src/cli/commands/agent_card.rs +++ b/crates/ripr/src/cli/commands/agent_card.rs @@ -134,7 +134,7 @@ fn render_agent_card_refusal( }); serde_json::to_string_pretty(&document) .map(|rendered| format!("{rendered}\n")) - .map_err(|error| format!("serialize agent card refusal document failed: {error}")) + .map_err(|error| format!("serialize agent card refusal document failed: {error}; report this as a ripr bug with the command you ran")) } /// The typed remedy route of one refusal kind: the opposite-remedy pairs the diff --git a/crates/ripr/src/cli/commands/baseline.rs b/crates/ripr/src/cli/commands/baseline.rs index 2da142d2ec7..639b93cf1b7 100644 --- a/crates/ripr/src/cli/commands/baseline.rs +++ b/crates/ripr/src/cli/commands/baseline.rs @@ -147,7 +147,7 @@ fn baseline_update(args: &[String]) -> Result<(), String> { let options = parse_baseline_update_options(args)?; if !options.remove_resolved && !options.migrate_legacy_identities { return Err( - "baseline update requires --remove-resolved or --migrate-legacy-identities; adopting new debt is not supported" + "baseline update requires --remove-resolved or --migrate-legacy-identities; adopting new debt is not supported; pass `--remove-resolved` or `--migrate-legacy-identities`" .to_string(), ); } @@ -267,9 +267,10 @@ impl BaselineCreateParseState { fn into_options(self) -> Result { Ok(BaselineCreateOptions { - from: self - .from - .ok_or_else(|| "baseline create requires --from ".to_string())?, + from: self.from.ok_or_else(|| { + "baseline create requires --from ; add `--from ` to the command" + .to_string() + })?, out: self.out, dry_run: self.dry_run, force: self.force, @@ -308,8 +309,14 @@ fn parse_baseline_diff_options(args: &[String]) -> Result".to_string())?, - current: current.ok_or_else(|| "baseline diff requires --current ".to_string())?, + baseline: baseline.ok_or_else(|| { + "baseline diff requires --baseline ; add `--baseline ` to the command" + .to_string() + })?, + current: current.ok_or_else(|| { + "baseline diff requires --current ; add `--current ` to the command" + .to_string() + })?, out, out_md, }) @@ -319,7 +326,9 @@ fn parse_baseline_diff_options(args: &[String]) -> Result Result { if args.get(index).is_some_and(|value| value.starts_with("--")) { - return Err(format!("missing value for {flag}")); + return Err(format!( + "missing value for {flag}; pass a value right after it" + )); } non_empty_path_arg(args, index, flag, "baseline diff") } @@ -359,9 +368,14 @@ fn parse_baseline_update_options(args: &[String]) -> Result".to_string())?, - current: current.ok_or_else(|| "baseline update requires --current ".to_string())?, + baseline: baseline.ok_or_else(|| { + "baseline update requires --baseline ; add `--baseline ` to the command" + .to_string() + })?, + current: current.ok_or_else(|| { + "baseline update requires --current ; add `--current ` to the command" + .to_string() + })?, out, remove_resolved, migrate_legacy_identities, @@ -604,7 +618,10 @@ mod tests { ); assert_eq!( parse_baseline_create_options(&args(&[])), - Err("baseline create requires --from ".to_string()) + Err( + "baseline create requires --from ; add `--from ` to the command" + .to_string() + ) ); assert_eq!( parse_baseline_create_options(&args(&["--from", ""])), @@ -656,11 +673,17 @@ mod tests { fn baseline_diff_requires_inputs_and_rejects_unknown_args() { assert_eq!( parse_baseline_diff_options(&args(&[])), - Err("baseline diff requires --baseline ".to_string()) + Err( + "baseline diff requires --baseline ; add `--baseline ` to the command" + .to_string() + ) ); assert_eq!( parse_baseline_diff_options(&args(&["--baseline", ".ripr/gate-baseline.json"])), - Err("baseline diff requires --current ".to_string()) + Err( + "baseline diff requires --current ; add `--current ` to the command" + .to_string() + ) ); assert_eq!( parse_baseline_diff_options(&args(&["--baseline", ""])), @@ -732,11 +755,14 @@ mod tests { fn baseline_update_requires_inputs_remove_resolved_and_rejects_unknown_args() { assert_eq!( parse_baseline_update_options(&args(&[])), - Err("baseline update requires --baseline ".to_string()) + Err("baseline update requires --baseline ; add `--baseline ` to the command".to_string()) ); assert_eq!( parse_baseline_update_options(&args(&["--baseline", ".ripr/gate-baseline.json"])), - Err("baseline update requires --current ".to_string()) + Err( + "baseline update requires --current ; add `--current ` to the command" + .to_string() + ) ); assert_eq!( parse_baseline_update_options(&args(&["--baseline", ""])), @@ -762,7 +788,7 @@ mod tests { "target/ripr/reports/gate-decision.json", ])), Err( - "baseline update requires --remove-resolved or --migrate-legacy-identities; adopting new debt is not supported" + "baseline update requires --remove-resolved or --migrate-legacy-identities; adopting new debt is not supported; pass `--remove-resolved` or `--migrate-legacy-identities`" .to_string() ) ); diff --git a/crates/ripr/src/cli/commands/cache.rs b/crates/ripr/src/cli/commands/cache.rs index 403778a3672..0a3323378d6 100644 --- a/crates/ripr/src/cli/commands/cache.rs +++ b/crates/ripr/src/cli/commands/cache.rs @@ -125,7 +125,9 @@ fn split_root_arg( let value = iter .next() .filter(|value| !value.is_empty() && !value.starts_with("--")) - .ok_or_else(|| format!("{command} --root requires a path"))?; + .ok_or_else(|| { + format!("{command} --root requires a path; pass the path right after --root") + })?; root = Some(PathBuf::from(value)); } else { rest.push(arg.clone()); @@ -166,7 +168,7 @@ fn cache_dir_for_explicit_root( // RIPR_CACHE_DIR governs the cache location. if !std::fs::metadata(root).is_ok_and(|metadata| metadata.is_dir()) { return Err(format!( - "cache root {} is not an existing directory", + "cache root {} is not an existing directory; pass an existing directory to `--root`", root.display() )); } @@ -181,10 +183,10 @@ fn cache_dir_for_explicit_root( .any(|component| matches!(component, Component::ParentDir)) { std::fs::canonicalize(root) - .map_err(|error| format!("resolve cache root {} failed: {error}", root.display()))? + .map_err(|error| format!("resolve cache root {} failed: {error}; check that the path exists and you can read it, then rerun", root.display()))? } else { std::path::absolute(root) - .map_err(|error| format!("resolve cache root {} failed: {error}", root.display()))? + .map_err(|error| format!("resolve cache root {} failed: {error}; check that the path exists and you can read it, then rerun", root.display()))? }; Ok(cache_dir_for_root(&workspace_root, env_value)) } @@ -337,7 +339,7 @@ fn resolve_cache_dir(root: Option<&Path>) -> Result { Some(root) => cache_dir_for_explicit_root(root, env_value), None => { let current_dir = std::env::current_dir() - .map_err(|error| format!("failed to get current dir: {error}"))?; + .map_err(|error| format!("failed to get current dir: {error}; run from an existing directory, or pass `--root `"))?; cache_dir_for_current_dir(¤t_dir, env_value) } } @@ -360,7 +362,7 @@ fn reject_symlinked_ancestor(cache_dir: &Path) -> Result<(), String> { match std::fs::symlink_metadata(ancestor) { Ok(metadata) if metadata.file_type().is_symlink() => { return Err(format!( - "refusing to clear {}: path component {} is a symlink; no files were removed", + "refusing to clear {}: path component {} is a symlink; no files were removed; point {CACHE_DIR_ENV} at a path without symlinks", cache_dir.display(), ancestor.display() )); @@ -369,7 +371,7 @@ fn reject_symlinked_ancestor(cache_dir: &Path) -> Result<(), String> { Err(error) if error.kind() == std::io::ErrorKind::NotFound => {} Err(error) => { return Err(format!( - "failed to inspect cache path component {}: {error}; no files were removed", + "failed to inspect cache path component {}: {error}; no files were removed; check permissions on that path, then rerun", ancestor.display() )); } @@ -410,13 +412,13 @@ fn classify_cache_root(cache_dir: &Path) -> Result { .any(|component| matches!(component, Component::ParentDir | Component::CurDir)) { return Err(format!( - "refusing to clear {display}: it contains a `..` or `.` component; \ - set {CACHE_DIR_ENV} to an absolute cache path without parent-directory traversal" + "refusing to clear {display}: it contains a `..` or `.` component; set \ + {CACHE_DIR_ENV} to an absolute cache path without parent-directory traversal" )); } if normal_components(cache_dir).len() < 2 { return Err(format!( - "refusing to clear {display}: a cache root must sit at least two directories below the filesystem root" + "refusing to clear {display}: a cache root must sit at least two directories below the filesystem root; set {CACHE_DIR_ENV} to a deeper directory" )); } match std::fs::symlink_metadata(cache_dir) { @@ -428,7 +430,7 @@ fn classify_cache_root(cache_dir: &Path) -> Result { .map(|real| symlink_refusal_detail(&real, cfg!(windows))) .unwrap_or_else(|_| "it is a symlink, not a cache directory".to_string()); Err(format!( - "refusing to clear {display}: {resolved}; no files were removed" + "refusing to clear {display}: {resolved}; no files were removed; point {CACHE_DIR_ENV} at the real directory" )) } Ok(metadata) if metadata.is_dir() => { @@ -436,10 +438,12 @@ fn classify_cache_root(cache_dir: &Path) -> Result { Ok(CacheRoot::Present) } Ok(_) => Err(format!( - "refusing to clear {display}: it is not a directory" + "refusing to clear {display}: it is not a directory; set {CACHE_DIR_ENV} to a directory, or remove the file" )), Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(CacheRoot::Missing), - Err(error) => Err(format!("failed to inspect {display}: {error}")), + Err(error) => Err(format!( + "failed to inspect {display}: {error}; check the path exists and you can read it, then rerun" + )), } } @@ -451,7 +455,7 @@ fn layer_from_status( ) -> Result { if status.state != "ok" { return Err(format!( - "refusing to clear {}: cache layer `{name}` inspection is {}; no files were removed", + "refusing to clear {}: cache layer `{name}` inspection is {}; no files were removed; run `ripr cache status` to see what is wrong with that layer", cache_dir.display(), status.state )); @@ -471,13 +475,13 @@ fn build_clear_plan(cache_dir: &Path) -> Result { match std::fs::symlink_metadata(&layer_path) { Ok(metadata) if metadata.file_type().is_symlink() => { return Err(format!( - "refusing to clear {}: recognized cache layer `{marker}` is a symlink; no files were removed", + "refusing to clear {}: recognized cache layer `{marker}` is a symlink; no files were removed; replace it with a real directory, then rerun", cache_dir.display() )); } Ok(metadata) if !metadata.is_dir() => { return Err(format!( - "refusing to clear {}: recognized cache layer `{marker}` is not a directory; no files were removed", + "refusing to clear {}: recognized cache layer `{marker}` is not a directory; no files were removed; remove it or move it away, then rerun", cache_dir.display() )); } @@ -493,7 +497,7 @@ fn build_clear_plan(cache_dir: &Path) -> Result { Err(error) if error.kind() == std::io::ErrorKind::NotFound => {} Err(error) => { return Err(format!( - "failed to inspect cache layer {}: {error}; no files were removed", + "failed to inspect cache layer {}: {error}; no files were removed; check permissions on that path, then rerun", layer_path.display() )); } @@ -505,7 +509,7 @@ fn build_clear_plan(cache_dir: &Path) -> Result { fn root_has_entries(cache_dir: &Path) -> Result { let mut entries = std::fs::read_dir(cache_dir).map_err(|error| { format!( - "failed to inspect cache root {}: {error}; no files were removed", + "failed to inspect cache root {}: {error}; no files were removed; check permissions on that path, then rerun", cache_dir.display() ) })?; @@ -515,7 +519,7 @@ fn root_has_entries(cache_dir: &Path) -> Result { .map(|entry| entry.is_some()) .map_err(|error| { format!( - "failed to inspect cache root {}: {error}; no files were removed", + "failed to inspect cache root {}: {error}; no files were removed; check permissions on that path, then rerun", cache_dir.display() ) }) @@ -548,18 +552,18 @@ fn layer_count_label(count: usize) -> String { fn verify_layer_before_delete(cache_dir: &Path, layer: &CacheLayerPlan) -> Result<(), String> { match std::fs::symlink_metadata(&layer.path) { Ok(metadata) if metadata.file_type().is_symlink() => Err(format!( - "refusing to clear {}: cache layer `{}` became a symlink; no further files were removed", + "refusing to clear {}: cache layer `{}` became a symlink; no further files were removed; rerun once nothing else is writing the cache", cache_dir.display(), layer.name )), Ok(metadata) if metadata.is_dir() => reject_symlinked_ancestor(&layer.path), Ok(_) => Err(format!( - "refusing to clear {}: cache layer `{}` is no longer a directory; no further files were removed", + "refusing to clear {}: cache layer `{}` is no longer a directory; no further files were removed; rerun once nothing else is writing the cache", cache_dir.display(), layer.name )), Err(error) => Err(format!( - "refusing to clear {}: cache layer `{}` changed after inspection ({error}); no further files were removed", + "refusing to clear {}: cache layer `{}` changed after inspection ({error}); no further files were removed; rerun once nothing else is writing the cache", cache_dir.display(), layer.name )), @@ -786,7 +790,9 @@ fn parse_export_args(args: &[String]) -> Result<(Option, PathBuf), Stri let value = args .next() .filter(|value| !value.is_empty() && !value.starts_with("--")) - .ok_or_else(|| format!("cache export {arg} requires a path"))?; + .ok_or_else(|| { + format!("cache export {arg} requires a path; pass the path right after {arg}") + })?; *slot = Some(PathBuf::from(value)); } Ok(( diff --git a/crates/ripr/src/cli/commands/capabilities.rs b/crates/ripr/src/cli/commands/capabilities.rs index 54650a090cd..aba053bb108 100644 --- a/crates/ripr/src/cli/commands/capabilities.rs +++ b/crates/ripr/src/cli/commands/capabilities.rs @@ -24,7 +24,9 @@ pub(in crate::cli) fn capabilities(args: &[String]) -> Result<(), String> { "--language" => { let value = match arguments.next().map(String::as_str) { Some("--help" | "-h" | "--json" | "--language") | None => { - return Err("missing value for --language".to_string()); + return Err( + "missing value for --language; pass a value right after it".to_string() + ); } Some(value) => value, }; @@ -84,7 +86,7 @@ mod tests { fn bad_arguments_are_refused_with_a_named_reason() { let missing = run(&["--language"]).err().unwrap_or_default(); assert!( - missing.contains("missing value for --language"), + missing.contains("missing value for --language; pass a value right after it"), "{missing}" ); let flag_value = run(&["--language", "--json"]).err().unwrap_or_default(); diff --git a/crates/ripr/src/cli/commands/check.rs b/crates/ripr/src/cli/commands/check.rs index 4dd0046a2c8..c21b08d5898 100644 --- a/crates/ripr/src/cli/commands/check.rs +++ b/crates/ripr/src/cli/commands/check.rs @@ -366,7 +366,7 @@ pub(super) fn resolve_implicit_workspace_root(input: &mut CheckInput) -> Result< return Ok(()); }; let current = std::fs::canonicalize(".") - .map_err(|error| format!("resolve current directory failed: {error}"))?; + .map_err(|error| format!("resolve current directory failed: {error}; run from a directory that still exists, or pass `--root `"))?; if root == current { return Ok(()); } @@ -469,7 +469,7 @@ fn parse_git_timeout_from( let timeout = std::time::Duration::from_secs(secs); if std::time::Instant::now().checked_add(timeout).is_none() { return Err(format!( - "{source} is too large for the platform deadline; got {secs} seconds" + "{source} is too large for the platform deadline; got {secs} seconds; pass a smaller number of seconds" )); } Ok((secs > 0).then_some(timeout)) @@ -496,7 +496,7 @@ fn check_timeout_from_env( Ok(value) => parse_check_timeout_from("RIPR_CHECK_TIMEOUT", &value).map(Some), Err(std::env::VarError::NotPresent) => Ok(None), Err(std::env::VarError::NotUnicode(_)) => { - Err("RIPR_CHECK_TIMEOUT must be valid UTF-8".to_string()) + Err("RIPR_CHECK_TIMEOUT must be valid UTF-8; set it to a whole number of seconds, or unset it".to_string()) } } } @@ -842,7 +842,7 @@ fn check_inner( || write_artifact.is_some() || input.suppression_policy.is_some()) { - return Err("--output-dir requires a named --diff file and cannot be combined with --format/--json, --worktree/--committed, --candidate-tree/--candidate-base, --gap-ledger, --write-artifact or --suppression-policy".into()); + return Err("--output-dir requires a named --diff file and cannot be combined with --format/--json, --worktree/--committed, --candidate-tree/--candidate-base, --gap-ledger, --write-artifact or --suppression-policy; pass a named `--diff ` and drop the other flags".into()); } // #6834: refusal-envelope context for every failure below. Argv usage // errors above return before this snapshot exists and stay prose-only. @@ -2137,7 +2137,7 @@ fn render_check_gap_ledger_badge( } }; let text = crate::bounded_input::read_to_string(gap_ledger) - .map_err(|err| format!("failed to read gap ledger {}: {err}", gap_ledger.display()))?; + .map_err(|err| format!("failed to read gap ledger {}: {err}; check the path passed to `--gap-ledger` exists and you can read it", gap_ledger.display()))?; let policy = output::badge::BadgePolicy { suppressions_path: config.suppressions().display_path(), ..output::badge::BadgePolicy::default() @@ -3288,7 +3288,7 @@ mod tests { fn check_requires_values_for_all_value_flags() { assert_eq!( check(&args(&["--root"])), - Err("missing value for --root".to_string()) + Err("missing value for --root; pass a value right after it".to_string()) ); assert_eq!( check(&args(&["--base"])), diff --git a/crates/ripr/src/cli/commands/check_argv_refusal_tests.rs b/crates/ripr/src/cli/commands/check_argv_refusal_tests.rs index 1fe0a5c05f3..baa3f97472b 100644 --- a/crates/ripr/src/cli/commands/check_argv_refusal_tests.rs +++ b/crates/ripr/src/cli/commands/check_argv_refusal_tests.rs @@ -469,7 +469,7 @@ fn check_timeout_environment_is_a_fallback_and_fails_closed() -> Result<(), Stri "x" ))) ), - Err("RIPR_CHECK_TIMEOUT must be valid UTF-8".to_string()) + Err("RIPR_CHECK_TIMEOUT must be valid UTF-8; set it to a whole number of seconds, or unset it".to_string()) ); Ok(()) } diff --git a/crates/ripr/src/cli/commands/check_fanout.rs b/crates/ripr/src/cli/commands/check_fanout.rs index 5b4a4c4c92b..ecd7b0237ac 100644 --- a/crates/ripr/src/cli/commands/check_fanout.rs +++ b/crates/ripr/src/cli/commands/check_fanout.rs @@ -46,7 +46,7 @@ impl Custody { pub(super) fn capture(input: &CheckInput, destination: &Path) -> Result { let root = input.root.canonicalize().map_err(|e| e.to_string())?; if root.ancestors().take(65).count() > 64 { - return Err("--output-dir input ancestry exceeds depth 64".into()); + return Err("--output-dir input ancestry exceeds depth 64; run from a shallower workspace path, or drop --output-dir".into()); } let requested_destination = destination.to_path_buf(); let parent = destination @@ -55,15 +55,15 @@ impl Custody { .unwrap_or(Path::new(".")); let destination = parent .canonicalize() - .map_err(|e| format!("--output-dir parent: {e}"))? + .map_err(|e| format!("--output-dir parent: {e}; create the parent directory first, then rerun"))? .join( destination .file_name() - .ok_or("--output-dir requires a new directory name")?, + .ok_or("--output-dir requires a new directory name; pass a directory name such as `--output-dir target/ripr/out`")?, ); if std::fs::symlink_metadata(&destination).is_ok() { return Err( - "--output-dir must name a new directory; existing output sets are never replaced" + "--output-dir must name a new directory; existing output sets are never replaced; pass a directory that does not exist yet, such as `--output-dir target/ripr/out-2`" .into(), ); } @@ -86,7 +86,7 @@ impl Custody { files: BTreeMap::new(), today: crate::output::suppressions::current_iso_date(), cargo: crate::analysis::cargo_input_identity(&input.root) - .ok_or("--output-dir cannot capture Cargo input identity")?, + .ok_or("--output-dir cannot capture Cargo input identity; run from a workspace with a readable Cargo.toml and Cargo.lock, or drop --output-dir")?, budget: std::env::var_os("RIPR_CHECK_FINDINGS_BYTES"), }; custody.files = custody.observe()?; @@ -146,7 +146,7 @@ impl Custody { let mut visited = 0; while let Some((dir, depth)) = pending.pop() { if depth > 64 { - return Err("--output-dir input directory depth exceeds 64".into()); + return Err("--output-dir input directory depth exceeds 64; flatten the nested inputs, or drop --output-dir".into()); } for entry in std::fs::read_dir(&dir).map_err(|e| format!("inspect {}: {e}", dir.display()))? @@ -154,7 +154,7 @@ impl Custody { let entry = entry.map_err(|e| e.to_string())?; visited += 1; if visited > MAX_ENTRIES { - return Err("--output-dir input inventory exceeds 16384 entries".into()); + return Err("--output-dir input inventory exceeds 16384 entries; run on a smaller workspace, or drop --output-dir".into()); } let path = entry.path(); if path == self.destination { @@ -180,7 +180,7 @@ impl Custody { paths.dedup(); if paths.len() > MAX_ENTRIES { return Err( - "--output-dir input inventory including auxiliary paths exceeds 16384 entries" + "--output-dir input inventory including auxiliary paths exceeds 16384 entries; run on a smaller workspace, or drop --output-dir" .into(), ); } @@ -269,12 +269,12 @@ fn observe_file(path: &Path, bytes_left: &mut u64) -> Result } if !meta.is_file() { return Err(format!( - "--output-dir requires regular input files: {}", + "--output-dir requires regular input files: {}; replace that path with a regular file, or drop --output-dir", path.display() )); } if meta.len() > *bytes_left { - return Err("--output-dir input custody exceeds 128 MiB".into()); + return Err("--output-dir input custody exceeds 128 MiB; run on a smaller workspace, or drop --output-dir".into()); } let mut bytes = Vec::new(); std::fs::File::open(path) @@ -283,7 +283,7 @@ fn observe_file(path: &Path, bytes_left: &mut u64) -> Result .read_to_end(&mut bytes) .map_err(|e| e.to_string())?; if bytes.len() as u64 > *bytes_left { - return Err("--output-dir input custody exceeds 128 MiB".into()); + return Err("--output-dir input custody exceeds 128 MiB; run on a smaller workspace, or drop --output-dir".into()); } *bytes_left -= bytes.len() as u64; let after = std::fs::symlink_metadata(path).map_err(|e| e.to_string())?; @@ -316,7 +316,7 @@ pub(super) fn publish( ); } if documents.iter().map(|(_, text)| text.len()).sum::() > MAX_OUTPUT_BYTES { - return Err("--output-dir rendered output exceeds 32 MiB".into()); + return Err("--output-dir rendered output exceeds 32 MiB; narrow the diff, or drop --output-dir to print the report instead".into()); } std::fs::create_dir(destination) .map_err(|e| format!("create new --output-dir {}: {e}", destination.display()))?; @@ -333,14 +333,14 @@ pub(super) fn publish( let member_bytes = documents.iter().map(|(_, text)| text.len()).sum::(); if bytes.len() > MAX_OUTPUT_BYTES.saturating_sub(member_bytes) { return Err( - "--output-dir members plus manifest exceed 32 MiB; output set is incomplete".into(), + "--output-dir members plus manifest exceed 32 MiB; output set is incomplete; narrow the diff, or drop --output-dir to print the report instead".into(), ); } let pending = destination.join("manifest.pending"); write_new(&pending, &bytes)?; final_check()?; std::fs::rename(&pending, destination.join("manifest.json")) - .map_err(|e| format!("publish manifest: {e}; output set is incomplete")) + .map_err(|e| format!("publish manifest: {e}; output set is incomplete; narrow the diff, or drop --output-dir to print the report instead")) } fn write_new(path: &Path, bytes: &[u8]) -> Result<(), String> { @@ -350,7 +350,7 @@ fn write_new(path: &Path, bytes: &[u8]) -> Result<(), String> { .open(path) .map_err(|e| { format!( - "create output {}: {e}; output set is incomplete", + "create output {}: {e}; output set is incomplete; narrow the diff, or drop --output-dir to print the report instead", path.display() ) })?; @@ -358,7 +358,7 @@ fn write_new(path: &Path, bytes: &[u8]) -> Result<(), String> { .and_then(|()| file.flush()) .map_err(|e| { format!( - "write output {}: {e}; output set is incomplete", + "write output {}: {e}; output set is incomplete; narrow the diff, or drop --output-dir to print the report instead", path.display() ) }) diff --git a/crates/ripr/src/cli/commands/ci_packet.rs b/crates/ripr/src/cli/commands/ci_packet.rs index 1a53c74bed0..ff2119ead61 100644 --- a/crates/ripr/src/cli/commands/ci_packet.rs +++ b/crates/ripr/src/cli/commands/ci_packet.rs @@ -78,7 +78,7 @@ pub(super) fn ci_packet(args: &[String]) -> Result<(), String> { let options = parse_ci_packet_options(args)?; crate::atomic_file::ensure_report_output_contained(&options.root)?; let exe = std::env::current_exe() - .map_err(|err| format!("{COMMAND} cannot locate the running ripr binary: {err}"))?; + .map_err(|err| format!("{COMMAND} cannot locate the running ripr binary: {err}; install ripr again, or run it by its full path"))?; let settings = CiSettings::from_env()?; let mut run = PacketRun { root: options.root, @@ -99,7 +99,7 @@ pub(super) fn ci_packet(args: &[String]) -> Result<(), String> { .collect::>(); if !unknown.is_empty() { return Err(format!( - "{COMMAND}: unknown --step {}; the steps are: {}", + "{COMMAND}: unknown --step {}; the steps are: {}; pass one of those names to --step", unknown.join(", "), run.seen .iter() @@ -204,10 +204,10 @@ impl CiSettings { Ok(Value::Null) } else { fs::read(&event_path) - .map_err(|err| format!("cannot read GITHUB_EVENT_PATH {event_path}: {err}")) + .map_err(|err| format!("cannot read GITHUB_EVENT_PATH {event_path}: {err}; run inside a GitHub Actions pull_request job, or unset GITHUB_EVENT_PATH")) .and_then(|bytes| { serde_json::from_slice::(&bytes) - .map_err(|err| format!("GITHUB_EVENT_PATH {event_path} is not JSON: {err}")) + .map_err(|err| format!("GITHUB_EVENT_PATH {event_path} is not JSON: {err}; point GITHUB_EVENT_PATH at the event payload file GitHub Actions provides")) }) }; let mut settings = Self::from_event(event.as_ref().unwrap_or(&Value::Null)); @@ -241,7 +241,7 @@ impl CiSettings { .map(|label| match label { Value::Object(map) => Ok(map.get("name").cloned().unwrap_or(Value::Null)), Value::Null => Ok(Value::Null), - _ => Err("a pull_request label is not an object".to_string()), + _ => Err("a pull_request label is not an object; check GITHUB_EVENT_PATH points at an unmodified pull_request event payload".to_string()), }) .collect(), Some(Value::Object(map)) => Ok(map @@ -285,7 +285,7 @@ fn parse_pilot_timeout_ms(value: &str) -> Result, String> { match value.parse::() { Ok(ms) if ms > 0 => Ok(Some(ms)), _ => Err(format!( - "{COMMAND}: RIPR_PILOT_TIMEOUT_MS must be a positive integer of milliseconds; got {value:?}" + "{COMMAND}: RIPR_PILOT_TIMEOUT_MS must be a positive integer of milliseconds; got {value:?}; set it to whole milliseconds such as 600000, or unset it" )), } } @@ -362,22 +362,22 @@ impl PacketRun { fn mkdir(&self, relative: &str) -> StageResult { fs::create_dir_all(self.path(relative)) - .map_err(|err| format!("cannot create {relative}: {err}")) + .map_err(|err| format!("cannot create {relative}: {err}; check you can write under the output directory, then rerun")) } fn copy(&self, from: &str, to: &str) -> StageResult { // Read, then write through the symlink-refusing advisory writer: a // plain `fs::copy` follows a planted destination link. let bytes = fs::read(self.path(from)) - .map_err(|err| format!("cannot copy {from} to {to}: {err}"))?; + .map_err(|err| format!("cannot copy {from} to {to}: {err}; check the source exists and the destination is writable, then rerun"))?; crate::output::file_write::write(&self.path(to), &bytes) - .map_err(|err| format!("cannot copy {from} to {to}: {err}"))?; + .map_err(|err| format!("cannot copy {from} to {to}: {err}; check the source exists and the destination is writable, then rerun"))?; // `fs::copy` carried the source's permission bits; so does this. let permissions = fs::metadata(self.path(from)) - .map_err(|err| format!("cannot copy {from} to {to}: {err}"))? + .map_err(|err| format!("cannot copy {from} to {to}: {err}; check the source exists and the destination is writable, then rerun"))? .permissions(); fs::set_permissions(self.path(to), permissions) - .map_err(|err| format!("cannot copy {from} to {to}: {err}")) + .map_err(|err| format!("cannot copy {from} to {to}: {err}; check the source exists and the destination is writable, then rerun")) } fn stage( @@ -447,19 +447,24 @@ impl PacketRun { // Same symlink-refusing owner as every other advisory write: refuse a // planted link or non-regular leaf, then truncate by replacing the // regular file with an exclusive no-follow create. - crate::output::file_write::validate_destination(&target) - .map_err(|err| format!("cannot write {out}: {err}"))?; + crate::output::file_write::validate_destination(&target).map_err(|err| { + format!("cannot write {out}: {err}; check you can write to that path, then rerun") + })?; // `File::create` kept an existing file's mode; keep it across the // replace too. let previous_permissions = fs::metadata(&target).ok().map(|meta| meta.permissions()); if target.exists() { - fs::remove_file(&target).map_err(|err| format!("cannot write {out}: {err}"))?; + fs::remove_file(&target).map_err(|err| { + format!("cannot write {out}: {err}; check you can write to that path, then rerun") + })?; } - let file = crate::output::file_write::create_exclusive(&target) - .map_err(|err| format!("cannot write {out}: {err}"))?; + let file = crate::output::file_write::create_exclusive(&target).map_err(|err| { + format!("cannot write {out}: {err}; check you can write to that path, then rerun") + })?; if let Some(permissions) = previous_permissions { - file.set_permissions(permissions) - .map_err(|err| format!("cannot write {out}: {err}"))?; + file.set_permissions(permissions).map_err(|err| { + format!("cannot write {out}: {err}; check you can write to that path, then rerun") + })?; } if let Some(recorded) = &self.recorded { let prefix = env @@ -517,7 +522,11 @@ impl PacketRun { let shown = format!("ripr {}", args.join(" ")); let status = OwnedProcess::spawn(command) .and_then(|mut child| child.wait()) - .map_err(|err| format!("`{shown}` could not run: {err}"))?; + .map_err(|err| { + format!( + "`{shown}` could not run: {err}; check that command is installed and on PATH" + ) + })?; Ok(status.code()) } @@ -1279,7 +1288,7 @@ impl PacketRun { self.path(&pending), self.path(WORKFLOW_AGENT_PACKET_ARTIFACT), ) - .map_err(|err| format!("cannot move the agent packet into place: {err}"))?; + .map_err(|err| format!("cannot move the agent packet into place: {err}; check you can write under target/ripr, then rerun"))?; self.copy(WORKFLOW_AGENT_PACKET_ARTIFACT, EDITOR_AGENT_PACKET_ARTIFACT)?; self.copy(WORKFLOW_AGENT_BRIEF_ARTIFACT, EDITOR_AGENT_BRIEF_ARTIFACT) } @@ -1303,7 +1312,7 @@ impl PacketRun { ) .map_err(|err| unresolved_base_message(&self.root, &base_ref, &err.to_string()))?; let head_sha = crate::git::run_git(&self.root, &["rev-parse", "--verify", "HEAD^{commit}"]) - .map_err(|err| format!("ripr: cannot resolve HEAD: {err}"))?; + .map_err(|err| format!("ripr: cannot resolve HEAD: {err}; run inside a git checkout that has at least one commit"))?; let range = format!("{base_sha}...{head_sha}"); let diff = git_bytes( &self.root, @@ -1325,9 +1334,9 @@ impl PacketRun { &range, ], ) - .map_err(|err| format!("ripr: git diff failed for {range}: {err}"))?; + .map_err(|err| format!("ripr: git diff failed for {range}: {err}; fetch the base ref (in CI, check out with full history), then rerun"))?; crate::output::file_write::write(&self.path("target/ripr/reports/pr.diff"), &diff) - .map_err(|err| format!("cannot write target/ripr/reports/pr.diff: {err}"))?; + .map_err(|err| format!("cannot write target/ripr/reports/pr.diff: {err}; check you can write under target/ripr, then rerun"))?; let receipt = DiffReceipt { tool: "ripr", kind: "pr-diff-receipt", @@ -1338,13 +1347,13 @@ impl PacketRun { sha256: &hex(&Sha256::digest(&diff)), }; let mut json = serde_json::to_string_pretty(&receipt) - .map_err(|err| format!("cannot render the diff receipt: {err}"))?; + .map_err(|err| format!("cannot render the diff receipt: {err}; report this as a ripr bug with the command you ran"))?; json.push('\n'); crate::output::file_write::write( &self.path("target/ripr/reports/pr-diff.receipt.json"), json.as_bytes(), ) - .map_err(|err| format!("cannot write target/ripr/reports/pr-diff.receipt.json: {err}"))?; + .map_err(|err| format!("cannot write target/ripr/reports/pr-diff.receipt.json: {err}; check you can write under target/ripr, then rerun"))?; if diff.is_empty() { let names = git_bytes( &self.root, @@ -1358,11 +1367,11 @@ impl PacketRun { &range, ], ) - .map_err(|err| format!("ripr: git diff --name-only failed for {range}: {err}"))?; + .map_err(|err| format!("ripr: git diff --name-only failed for {range}: {err}; fetch the base ref (in CI, check out with full history), then rerun"))?; let changed = names.iter().filter(|byte| **byte == 0).count(); if changed != 0 { return Err(format!( - "ripr: empty patch but {changed} changed path(s); refusing an absent result" + "ripr: empty patch but {changed} changed path(s); refusing an absent result; fetch full git history and rerun, or report this as a ripr bug with the command you ran" )); } } @@ -1456,10 +1465,13 @@ impl PacketRun { self.mkdir("target/ci")?; let labels = self.settings.labels.clone()?; let mut json = serde_json::to_string(&serde_json::json!({ "labels": labels })) - .map_err(|err| format!("cannot render the labels: {err}"))?; + .map_err(|err| format!("cannot render the labels: {err}; report this as a ripr bug with the command you ran"))?; json.push('\n'); - crate::output::file_write::write(&self.path(LABELS_JSON), json.as_bytes()) - .map_err(|err| format!("cannot write {LABELS_JSON}: {err}")) + crate::output::file_write::write(&self.path(LABELS_JSON), json.as_bytes()).map_err(|err| { + format!( + "cannot write {LABELS_JSON}: {err}; check you can write under target/ci, then rerun" + ) + }) } fn evaluate_gate(&mut self) -> StageResult { @@ -1760,9 +1772,12 @@ impl PacketRun { fn emit_annotations(&mut self) -> StageResult { let bytes = fs::read(self.path(COMMENTS_JSON)) - .map_err(|err| format!("cannot read {COMMENTS_JSON}: {err}"))?; - let document = serde_json::from_slice::(&bytes) - .map_err(|err| format!("{COMMENTS_JSON} is not JSON: {err}"))?; + .map_err(|err| format!("cannot read {COMMENTS_JSON}: {err}; run the review-comments step that writes it first, then rerun"))?; + let document = serde_json::from_slice::(&bytes).map_err(|err| { + format!( + "{COMMENTS_JSON} is not JSON: {err}; rerun the review-comments step that writes it" + ) + })?; let (printed, result) = match render_workflow_annotations(&document) { Ok(lines) => (lines, Ok(())), Err((lines, err)) => (lines, Err(err)), diff --git a/crates/ripr/src/cli/commands/ci_summary.rs b/crates/ripr/src/cli/commands/ci_summary.rs index 73a36fd3e6d..f1ae32fe963 100644 --- a/crates/ripr/src/cli/commands/ci_summary.rs +++ b/crates/ripr/src/cli/commands/ci_summary.rs @@ -40,7 +40,7 @@ pub(super) fn ci_summary(args: &[String]) -> Result<(), String> { stdout .write_all(&summary) .and_then(|()| stdout.flush()) - .map_err(|err| format!("{COMMAND} could not write the summary: {err}")) + .map_err(|err| format!("{COMMAND} could not write the summary: {err}; check you can write to the summary path, then rerun")) } /// `RIPR_GATE_MODE` counts as set when it is non-empty, read raw as @@ -217,7 +217,9 @@ mod tests { assert!(parse(&[flag, "v"], &settings).is_ok(), "{flag}"); assert_eq!( parse(&[flag], &settings), - Err(format!("missing value for {flag}")) + Err(format!( + "missing value for {flag}; pass a value right after it" + )) ); } } diff --git a/crates/ripr/src/cli/commands/config.rs b/crates/ripr/src/cli/commands/config.rs index e321a379cba..f0f2ae9a1e7 100644 --- a/crates/ripr/src/cli/commands/config.rs +++ b/crates/ripr/src/cli/commands/config.rs @@ -31,10 +31,12 @@ pub(in crate::cli) fn config(args: &[String]) -> Result<(), String> { fn parse_validate_root(args: &[String]) -> Result { match args { [] => Ok(PathBuf::from(".")), - [flag] if flag == "--root" => Err("missing value for --root".to_string()), + [flag] if flag == "--root" => { + Err("missing value for --root; pass a value right after it".to_string()) + } // `--root` is an option token here; `./--root` names the literal path. [flag, value, ..] if flag == "--root" && value == "--root" => { - Err("missing value for --root".to_string()) + Err("missing value for --root; pass a value right after it".to_string()) } [flag, value] if flag == "--root" => Ok(PathBuf::from(value)), [flag, _value, extra, ..] if flag == "--root" => { @@ -333,7 +335,7 @@ path = ".ripr/suppressions\u0000.toml" let cases = [ ( args(&["validate", "--root"]), - "missing value for --root".to_string(), + "missing value for --root; pass a value right after it".to_string(), ), ( args(&["validate", "--wat"]), diff --git a/crates/ripr/src/cli/commands/context.rs b/crates/ripr/src/cli/commands/context.rs index 4397051da3f..1d5423c75e9 100644 --- a/crates/ripr/src/cli/commands/context.rs +++ b/crates/ripr/src/cli/commands/context.rs @@ -507,7 +507,7 @@ mod tests { ); assert_eq!( context(&args(&["--root"])), - Err("missing value for --root".to_string()) + Err("missing value for --root; pass a value right after it".to_string()) ); assert_eq!( context(&args(&["--perl-facts"])), diff --git a/crates/ripr/src/cli/commands/doctor.rs b/crates/ripr/src/cli/commands/doctor.rs index 6bccd80a5c5..cf5b5dd1d1c 100644 --- a/crates/ripr/src/cli/commands/doctor.rs +++ b/crates/ripr/src/cli/commands/doctor.rs @@ -46,7 +46,7 @@ pub(in crate::cli) fn doctor(args: &[String]) -> Result<(), CommandError> { } None => { return Err(CommandError::from( - "missing value for --profile".to_string(), + "missing value for --profile; pass a value right after it".to_string(), )); } }; @@ -59,10 +59,16 @@ pub(in crate::cli) fn doctor(args: &[String]) -> Result<(), CommandError> { // pre-#4318 parser answered `missing value for --root` // here. Other dash-prefixed paths stay legitimate values. Some("--help" | "-h" | "--json" | "--timings" | "--profile" | "--root") => { - return Err(CommandError::from("missing value for --root".to_string())); + return Err(CommandError::from( + "missing value for --root; pass a value right after it".to_string(), + )); } Some(value) => value, - None => return Err(CommandError::from("missing value for --root".to_string())), + None => { + return Err(CommandError::from( + "missing value for --root; pass a value right after it".to_string(), + )); + } }; // #4318: a repeated documented flag is a usage mistake with a // name of its own; accusing `--root` of being unknown sends @@ -7449,7 +7455,7 @@ mod tests { assert_eq!( doctor(&args(&["--root"])), Err(CommandError::Failure( - "missing value for --root".to_string() + "missing value for --root; pass a value right after it".to_string() )) ); } @@ -7683,7 +7689,7 @@ mod tests { assert_eq!( doctor(&args(&["--root", flag])), Err(CommandError::Failure( - "missing value for --root".to_string() + "missing value for --root; pass a value right after it".to_string() )), "a known flag cannot be the --root value: {flag}" ); diff --git a/crates/ripr/src/cli/commands/feedback.rs b/crates/ripr/src/cli/commands/feedback.rs index ffa890d9238..d0caadeb77d 100644 --- a/crates/ripr/src/cli/commands/feedback.rs +++ b/crates/ripr/src/cli/commands/feedback.rs @@ -160,7 +160,7 @@ pub(in crate::cli) fn parse_record_options( "--json" => json = true, "--file" | "--line" => { return Err( - "feedback identity is --snapshot and optional --item, not file/line; a current file/line cannot attach an old judgment to a new result" + "feedback identity is --snapshot and optional --item, not file/line; a current file/line cannot attach an old judgment to a new result; pass `--snapshot ` (and `--item ` if needed) instead" .to_string(), ); } @@ -171,7 +171,9 @@ pub(in crate::cli) fn parse_record_options( let snapshot_id = snapshot_id.ok_or_else(|| { "feedback record requires --snapshot; file and line are not a result identity".to_string() })?; - let reason = reason.ok_or_else(|| "feedback record requires --reason".to_string())?; + let reason = reason.ok_or_else(|| { + "feedback record requires --reason; add `--reason` to the command".to_string() + })?; let payload = FeedbackPayload { identity: ResultIdentity { snapshot_id, diff --git a/crates/ripr/src/cli/commands/gate.rs b/crates/ripr/src/cli/commands/gate.rs index 2277db56c01..79590bb45b1 100644 --- a/crates/ripr/src/cli/commands/gate.rs +++ b/crates/ripr/src/cli/commands/gate.rs @@ -224,9 +224,9 @@ fn parse_gate_options(args: &[String]) -> Result { // relative/absolute spellings without traversing the filesystem, then use // the shared native lexical comparison (no symlink/case-folding guarantee). let absolute_out = - std::path::absolute(&out).map_err(|err| format!("gate could not resolve --out: {err}"))?; + std::path::absolute(&out).map_err(|err| format!("gate could not resolve --out: {err}; pass a path whose directory exists, such as `--out target/ripr/gate.json`"))?; let absolute_out_md = std::path::absolute(&out_md) - .map_err(|err| format!("gate could not resolve --out-md: {err}"))?; + .map_err(|err| format!("gate could not resolve --out-md: {err}; pass a path whose directory exists, such as `--out-md target/ripr/gate.md`"))?; if output::path::same_output_leaf(&absolute_out, &absolute_out_md) { return Err( "gate --out and --out-md must not be the same path; choose distinct JSON and Markdown destinations" diff --git a/crates/ripr/src/cli/commands/init.rs b/crates/ripr/src/cli/commands/init.rs index 509ccff48d1..9fa97084673 100644 --- a/crates/ripr/src/cli/commands/init.rs +++ b/crates/ripr/src/cli/commands/init.rs @@ -353,8 +353,11 @@ fn ripr_mcp_server_entry() -> serde_json::Value { fn plan_mcp_target(path: PathBuf, force: bool) -> Result { let shown = output::path::human_path(&path); let render = |document: &serde_json::Value| { - let mut body = serde_json::to_string_pretty(document) - .map_err(|err| format!("render {shown} failed: {err}"))?; + let mut body = serde_json::to_string_pretty(document).map_err(|err| { + format!( + "render {shown} failed: {err}; report this as a ripr bug with the command you ran" + ) + })?; body.push('\n'); Ok::(body) }; @@ -380,8 +383,9 @@ fn plan_mcp_target(path: PathBuf, force: bool) -> Result { "existing {shown} is a symlink; add the `ripr` server to its target by hand, nothing was written" )); } - let text = std::fs::read_to_string(&path) - .map_err(|err| format!("cannot read existing {shown}: {err}"))?; + let text = std::fs::read_to_string(&path).map_err(|err| { + format!("cannot read existing {shown}: {err}; check you can read that file, then rerun") + })?; let mut document: serde_json::Value = serde_json::from_str(&text).map_err(|err| { format!( "existing {shown} is not valid JSON ({err}); fix it or remove it, nothing was written" @@ -389,13 +393,13 @@ fn plan_mcp_target(path: PathBuf, force: bool) -> Result { })?; let servers = document .as_object_mut() - .ok_or_else(|| format!("existing {shown} is not a JSON object; nothing was written"))? + .ok_or_else(|| format!("existing {shown} is not a JSON object; nothing was written; fix the file so it is a JSON object, or move it aside, then rerun"))? .entry("mcpServers") .or_insert_with(|| serde_json::json!({})) .as_object_mut() .ok_or_else(|| { format!( - "existing {shown} has a `mcpServers` that is not an object; nothing was written" + "existing {shown} has a `mcpServers` that is not an object; nothing was written; fix that key so it is an object, then rerun" ) })?; if servers.contains_key(MCP_SERVER_NAME) && !force { @@ -517,7 +521,10 @@ fn path_is_occupied(path: &Path) -> Result { match std::fs::symlink_metadata(path) { Ok(_) => Ok(true), Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(false), - Err(err) => Err(format!("cannot inspect {}: {err}", path.display())), + Err(err) => Err(format!( + "cannot inspect {}: {err}; check permissions on that path, then rerun", + path.display() + )), } } @@ -539,7 +546,7 @@ fn ensure_creatable_parent(path: &Path) -> Result<(), String> { Ok(metadata) if metadata.is_dir() => return Ok(()), Ok(_) => { return Err(format!( - "cannot write {}: {} exists and is not a directory", + "cannot write {}: {} exists and is not a directory; move or remove it, then rerun", path.display(), ancestor.display() )); @@ -691,8 +698,12 @@ fn write_init_target(target: &InitTarget) -> Result<(), String> { .parent() .filter(|parent| !parent.as_os_str().is_empty()) { - std::fs::create_dir_all(parent) - .map_err(|err| format!("create {} failed: {err}", parent.display()))?; + std::fs::create_dir_all(parent).map_err(|err| { + format!( + "create {} failed: {err}; check you can create directories there, then rerun", + parent.display() + ) + })?; } if matches!(target.action, InitAction::Overwrite | InitAction::Update) { // --force replaces the config atomically (#4883): the old file stays @@ -715,7 +726,10 @@ fn write_init_target(target: &InitTarget) -> Result<(), String> { write_new_file_in_place(&target.path, target.body.as_bytes())?; } Err(CreateNewError::Staging(err) | CreateNewError::Link(err)) => { - return Err(format!("write {} failed: {err}", target.path.display())); + return Err(format!( + "write {} failed: {err}; check you can write there, then rerun", + target.path.display() + )); } } println!("Wrote {}", output::path::human_path(&target.path)); @@ -731,13 +745,21 @@ fn write_new_file_in_place(path: &std::path::Path, body: &[u8]) -> Result<(), St .write(true) .create_new(true) .open(path) - .map_err(|err| format!("write {} failed: {err}", path.display()))?; + .map_err(|err| { + format!( + "write {} failed: {err}; check you can write there, then rerun", + path.display() + ) + })?; if let Err(err) = file.write_all(body).and_then(|()| file.sync_all()) { // Remove the file this call created rather than leave a truncated // config (#4883). Unlike the staged path, this unlinks by name. drop(file); return Err(match std::fs::remove_file(path) { - Ok(()) => format!("write {} failed: {err}", path.display()), + Ok(()) => format!( + "write {} failed: {err}; check you can write there, then rerun", + path.display() + ), Err(cleanup) => format!( "write {} failed: {err}; removing the partial file also failed: {cleanup}", path.display() @@ -1751,7 +1773,8 @@ mod tests { Ok(_) => return Err("an uncreatable parent must block".to_string()), Err(message) => { assert!( - message.contains("exists and is not a directory"), + message + .contains("exists and is not a directory; move or remove it, then rerun"), "{message}" ); assert!( diff --git a/crates/ripr/src/cli/commands/pilot.rs b/crates/ripr/src/cli/commands/pilot.rs index f3d39769f9b..a6d654edb00 100644 --- a/crates/ripr/src/cli/commands/pilot.rs +++ b/crates/ripr/src/cli/commands/pilot.rs @@ -681,7 +681,7 @@ fn classify_change_past_seam_limit( ) { Ok(PilotAnalysisResult::Complete(classified)) => Ok(classified), Ok(PilotAnalysisResult::TimedOut) => { - Err("it did not finish within pilot's deadline".to_string()) + Err("it did not finish within pilot's deadline; raise `--timeout-ms`, or narrow the change".to_string()) } Err(error) => Err(error), }, @@ -1063,8 +1063,12 @@ fn pilot_artifacts(out_dir: &Path) -> output::pilot::PilotArtifacts { /// Pilot artifacts default under the analyzed repository, which may commit a /// symlink at an artifact path; never write through it. fn write_pilot_file(path: &Path, contents: impl AsRef<[u8]>) -> Result<(), String> { - output::file_write::write(path, contents.as_ref()) - .map_err(|err| format!("write output {} failed: {err}", path.display())) + output::file_write::write(path, contents.as_ref()).map_err(|err| { + format!( + "write output {} failed: {err}; check you can write to that path, then rerun", + path.display() + ) + }) } /// Drop leftover complete-run siblings so a timeout packet cannot be read as @@ -1083,16 +1087,16 @@ fn remove_timeout_packet_sibling(path: &Path) -> Result<(), String> { match std::fs::symlink_metadata(path) { Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(()), Err(error) => Err(format!( - "inspect leftover timeout packet file {} failed: {error}", + "inspect leftover timeout packet file {} failed: {error}; check permissions on that path, then rerun", path.display() )), Ok(metadata) if metadata.file_type().is_dir() => Err(format!( - "leftover timeout packet path {} is a directory; refusing to leave it as if it were this run's output", + "leftover timeout packet path {} is a directory; refusing to leave it as if it were this run's output; remove that directory, then rerun", path.display() )), Ok(_) => std::fs::remove_file(path).map_err(|error| { format!( - "remove leftover timeout packet file {} failed: {error}", + "remove leftover timeout packet file {} failed: {error}; check you can write to that path, then rerun", path.display() ) }), @@ -1396,7 +1400,7 @@ mod tests { fn pilot_requires_values_for_value_flags() { assert_eq!( pilot(&args(&["--root"])), - Err("missing value for --root".to_string()) + Err("missing value for --root; pass a value right after it".to_string()) ); assert_eq!( pilot(&args(&["--out"])), @@ -1432,7 +1436,7 @@ mod tests { fn pilot_rejects_non_positive_max_seams() { assert_eq!( parse_pilot_options(&args(&["--max-seams", "0"])), - Err("--max-seams requires a positive integer; got \"0\"".to_string()) + Err("--max-seams requires a positive integer; pass a whole number of 1 or more, got \"0\"".to_string()) ); } @@ -1440,7 +1444,7 @@ mod tests { fn pilot_rejects_non_positive_timeout() { assert_eq!( parse_pilot_options(&args(&["--timeout-ms", "0"])), - Err("--timeout-ms requires a positive integer; got \"0\"".to_string()) + Err("--timeout-ms requires a positive integer; pass a whole number of 1 or more, got \"0\"".to_string()) ); } diff --git a/crates/ripr/src/cli/commands/policy/parse.rs b/crates/ripr/src/cli/commands/policy/parse.rs index c3b897ec339..63ddcff089b 100644 --- a/crates/ripr/src/cli/commands/policy/parse.rs +++ b/crates/ripr/src/cli/commands/policy/parse.rs @@ -235,7 +235,7 @@ pub(crate) fn parse_policy_operations_options( } let policy_readiness = policy_readiness - .ok_or_else(|| "policy operations requires --policy-readiness ".to_string())?; + .ok_or_else(|| "policy operations requires --policy-readiness ; add `--policy-readiness ` to the command".to_string())?; Ok(PolicyOperationsOptions { root, @@ -314,7 +314,10 @@ pub(crate) fn parse_policy_history_options( i += 1; } - let current = current.ok_or_else(|| "policy history requires --current ".to_string())?; + let current = current.ok_or_else(|| { + "policy history requires --current ; add `--current ` to the command" + .to_string() + })?; if let Some(jsonl) = out_jsonl.as_ref() && (crate::output::path::same_output_leaf(jsonl, &out) || crate::output::path::same_output_leaf(jsonl, &out_md) @@ -385,8 +388,9 @@ pub(crate) fn parse_policy_promotion_options( i += 1; } - let target_mode = - target_mode.ok_or_else(|| "policy promote requires --to ".to_string())?; + let target_mode = target_mode.ok_or_else(|| { + "policy promote requires --to ; add `--to ` to the command".to_string() + })?; if !output::policy_promotion::is_supported_target_mode(&target_mode) { return Err(unknown_value( "policy promotion target", @@ -399,8 +403,10 @@ pub(crate) fn parse_policy_promotion_options( ], )); } - let operations = - operations.ok_or_else(|| "policy promote requires --operations ".to_string())?; + let operations = operations.ok_or_else(|| { + "policy promote requires --operations ; add `--operations ` to the command" + .to_string() + })?; let out = out.unwrap_or_else(|| { PathBuf::from(output::policy_promotion::default_policy_promotion_out( &target_mode, @@ -492,7 +498,7 @@ pub(crate) fn parse_policy_preview_promotion_options( } let language = language - .ok_or_else(|| "policy preview-promote requires --language ".to_string())?; + .ok_or_else(|| "policy preview-promote requires --language ; add `--language ` to the command".to_string())?; if !output::policy_preview_promotion::is_supported_language(&language) { return Err(unknown_value( "preview promotion language", @@ -500,8 +506,10 @@ pub(crate) fn parse_policy_preview_promotion_options( &["typescript", "python"], )); } - let candidate_class = candidate_class - .ok_or_else(|| "policy preview-promote requires --class ".to_string())?; + let candidate_class = candidate_class.ok_or_else(|| { + "policy preview-promote requires --class ; add `--class ` to the command" + .to_string() + })?; let out = out.unwrap_or_else(|| { PathBuf::from( output::policy_preview_promotion::default_preview_promotion_out( diff --git a/crates/ripr/src/cli/commands/policy/reports.rs b/crates/ripr/src/cli/commands/policy/reports.rs index 52fdbd7c3af..53f7340ae72 100644 --- a/crates/ripr/src/cli/commands/policy/reports.rs +++ b/crates/ripr/src/cli/commands/policy/reports.rs @@ -221,7 +221,7 @@ pub(crate) fn policy_history(args: &[String]) -> Result<(), String> { && !output::policy_history::policy_history_current_is_durable(&report) { return Err( - "policy history --out-jsonl refuses to append when current policy operations are unavailable or malformed" + "policy history --out-jsonl refuses to append when current policy operations are unavailable or malformed; regenerate them with `ripr policy operations`, then rerun" .to_string(), ); } diff --git a/crates/ripr/src/cli/commands/pr_comments_github.rs b/crates/ripr/src/cli/commands/pr_comments_github.rs index fb0df480295..09ce811de77 100644 --- a/crates/ripr/src/cli/commands/pr_comments_github.rs +++ b/crates/ripr/src/cli/commands/pr_comments_github.rs @@ -68,10 +68,10 @@ fn store_raw_copy(root: &Path, bytes: &[u8]) -> Result<(), String> { let raw_copy = root.join(DEFAULT_RAW); if let Some(parent) = raw_copy.parent() { fs::create_dir_all(parent) - .map_err(|err| format!("{EXISTING} could not create {}: {err}", parent.display()))?; + .map_err(|err| format!("{EXISTING} could not create {}: {err}; check the path exists and you can access it, then rerun", parent.display()))?; } crate::output::file_write::write(&raw_copy, bytes) - .map_err(|err| format!("{EXISTING} could not write {}: {err}", raw_copy.display())) + .map_err(|err| format!("{EXISTING} could not write {}: {err}; check the path exists and you can access it, then rerun", raw_copy.display())) } pub(super) fn pr_comments_existing(args: &[String]) -> Result<(), String> { @@ -82,10 +82,10 @@ pub(super) fn pr_comments_existing(args: &[String]) -> Result<(), String> { // the normalized file so the uploaded artifact still shows them. let mut bytes = Vec::new(); std::io::Read::read_to_end(&mut std::io::stdin(), &mut bytes) - .map_err(|err| format!("{EXISTING} could not read standard input: {err}"))?; + .map_err(|err| format!("{EXISTING} could not read standard input: {err}; pipe the JSON into the command, or check the step that produces it ran"))?; store_raw_copy(&options.root, &bytes)?; serde_json::from_slice(&bytes) - .map_err(|err| format!("{EXISTING}: standard input is not JSON: {err}"))? + .map_err(|err| format!("{EXISTING}: standard input is not JSON: {err}; pass the JSON the earlier step wrote on standard input"))? } else { read_json(&options.root.join(&options.raw), EXISTING)? }; @@ -181,13 +181,13 @@ fn is_relative_inside_root(path: &Path) -> bool { fn validate_out_dir_for(command: &str, out_dir: &Path) -> Result<(), String> { if !is_relative_inside_root(out_dir) { return Err(format!( - "{command} --out-dir must be a relative directory inside --root (got {}); the run replaces its request files", + "{command} --out-dir must be a relative directory inside --root (got {}); the run replaces its request files; pass a relative `--out-dir` under the root", out_dir.display() )); } if out_dir.to_string_lossy().contains(['\t', '\r', '\n']) { return Err(format!( - "{command} --out-dir cannot contain a tab or line break: the request manifest is tab-separated" + "{command} --out-dir cannot contain a tab or line break: the request manifest is tab-separated; use a plain relative path without tabs or line breaks" )); } Ok(()) @@ -198,13 +198,13 @@ fn validate_out_dir_for(command: &str, out_dir: &Path) -> Result<(), String> { fn validate_out_file(out: &Path) -> Result<(), String> { if !is_relative_inside_root(out) { return Err(format!( - "{EXISTING} --out must be a relative file path inside --root (got {})", + "{EXISTING} --out must be a relative file path inside --root (got {}); pass a relative `--out` path under the root", out.display() )); } if out.to_string_lossy().contains(['\t', '\r', '\n']) { return Err(format!( - "{EXISTING} --out cannot contain a tab or line break" + "{EXISTING} --out cannot contain a tab or line break; use a plain relative path without tabs or line breaks" )); } Ok(()) @@ -223,10 +223,10 @@ pub(super) fn pr_comments_requests(args: &[String]) -> Result<(), String> { // lose anything else. if out_dir.is_dir() { let entries = fs::read_dir(&out_dir) - .map_err(|err| format!("{REQUESTS} could not read {}: {err}", out_dir.display()))?; + .map_err(|err| format!("{REQUESTS} could not read {}: {err}; check the path exists and you can access it, then rerun", out_dir.display()))?; for entry in entries { let path = entry - .map_err(|err| format!("{REQUESTS} could not read {}: {err}", out_dir.display()))? + .map_err(|err| format!("{REQUESTS} could not read {}: {err}; check the path exists and you can access it, then rerun", out_dir.display()))? .path(); let owned = path .file_name() @@ -238,13 +238,13 @@ pub(super) fn pr_comments_requests(args: &[String]) -> Result<(), String> { fs::symlink_metadata(&path).is_ok_and(|metadata| !metadata.file_type().is_dir()); if owned && removable { fs::remove_file(&path).map_err(|err| { - format!("{REQUESTS} could not remove {}: {err}", path.display()) + format!("{REQUESTS} could not remove {}: {err}; check the path exists and you can access it, then rerun", path.display()) })?; } } } fs::create_dir_all(&out_dir) - .map_err(|err| format!("{REQUESTS} could not create {}: {err}", out_dir.display()))?; + .map_err(|err| format!("{REQUESTS} could not create {}: {err}; check the path exists and you can access it, then rerun", out_dir.display()))?; let mut manifest = String::new(); for (index, request) in planned.requests.iter().enumerate() { let file = options.out_dir.join(format!( @@ -340,9 +340,9 @@ pub(super) fn pr_comments_summary(args: &[String]) -> Result<(), String> { Some(raw) if raw.as_os_str() == "-" => { let mut bytes = Vec::new(); std::io::Read::read_to_end(&mut std::io::stdin(), &mut bytes) - .map_err(|err| format!("{SUMMARY} could not read standard input: {err}"))?; + .map_err(|err| format!("{SUMMARY} could not read standard input: {err}; pipe the JSON into the command, or check the step that produces it ran"))?; serde_json::from_slice(&bytes) - .map_err(|err| format!("{SUMMARY}: standard input is not JSON: {err}"))? + .map_err(|err| format!("{SUMMARY}: standard input is not JSON: {err}; pass the JSON the earlier step wrote on standard input"))? } Some(raw) => read_json(&options.root.join(raw), SUMMARY)?, }; @@ -357,13 +357,13 @@ pub(super) fn pr_comments_summary(args: &[String]) -> Result<(), String> { refuse_linked_out_dir(&options.root, &options.out_dir)?; let out_dir = options.root.join(&options.out_dir); fs::create_dir_all(&out_dir) - .map_err(|err| format!("{SUMMARY} could not create {}: {err}", out_dir.display()))?; + .map_err(|err| format!("{SUMMARY} could not create {}: {err}; check the path exists and you can access it, then rerun", out_dir.display()))?; // An earlier run's request must never be replayed. for name in [SUMMARY_MANIFEST, "summary-request.json"] { let path = out_dir.join(name); if fs::symlink_metadata(&path).is_ok_and(|metadata| !metadata.file_type().is_dir()) { fs::remove_file(&path) - .map_err(|err| format!("{SUMMARY} could not remove {}: {err}", path.display()))?; + .map_err(|err| format!("{SUMMARY} could not remove {}: {err}; check the path exists and you can access it, then rerun", path.display()))?; } } let manifest_path = out_dir.join(SUMMARY_MANIFEST); @@ -387,7 +387,7 @@ pub(super) fn pr_comments_summary(args: &[String]) -> Result<(), String> { /// Write a request manifest through the symlink-refusing advisory writer. fn write_manifest(path: &Path, text: &str, command: &str) -> Result<(), String> { crate::output::file_write::write(path, text.as_bytes()) - .map_err(|err| format!("{command} could not write {}: {err}", path.display())) + .map_err(|err| format!("{command} could not write {}: {err}; check the path exists and you can access it, then rerun", path.display())) } /// The lexical check in the parser keeps `--out-dir` under `--root` only if @@ -429,14 +429,14 @@ fn refuse_linked_path( Err(err) if err.kind() == std::io::ErrorKind::NotFound => return Ok(()), Err(err) => { return Err(format!( - "{command} could not inspect {}: {err}", + "{command} could not inspect {}: {err}; check the path exists and you can access it, then rerun", current.display() )); } }; if metadata.file_type().is_symlink() || is_reparse_point(&metadata) { return Err(format!( - "{command} {flag} cannot pass through a link ({} is one); {why}", + "{command} {flag} cannot pass through a link ({} is one); {why}; replace the link with a real file or directory", current.display() )); } @@ -475,21 +475,25 @@ fn manifest_field(text: &str) -> String { fn read_json(path: &Path, command: &str) -> Result { let bytes = fs::read(path) - .map_err(|err| format!("{command} could not read {}: {err}", path.display()))?; - serde_json::from_slice(&bytes) - .map_err(|err| format!("{command}: {} is not JSON: {err}", path.display())) + .map_err(|err| format!("{command} could not read {}: {err}; check the path exists and you can access it, then rerun", path.display()))?; + serde_json::from_slice(&bytes).map_err(|err| { + format!( + "{command}: {} is not JSON: {err}; pass the JSON the earlier step wrote", + path.display() + ) + }) } fn write_json(path: &Path, value: &Value, command: &str) -> Result<(), String> { if let Some(parent) = path.parent() { fs::create_dir_all(parent) - .map_err(|err| format!("{command} could not create {}: {err}", parent.display()))?; + .map_err(|err| format!("{command} could not create {}: {err}; check the path exists and you can access it, then rerun", parent.display()))?; } let mut text = serde_json::to_string_pretty(value) - .map_err(|err| format!("{command} could not render {}: {err}", path.display()))?; + .map_err(|err| format!("{command} could not render {}: {err}; check the path exists and you can access it, then rerun", path.display()))?; text.push('\n'); crate::output::file_write::write(path, text.as_bytes()) - .map_err(|err| format!("{command} could not write {}: {err}", path.display())) + .map_err(|err| format!("{command} could not write {}: {err}; check the path exists and you can access it, then rerun", path.display())) } #[cfg(test)] diff --git a/crates/ripr/src/cli/commands/receipt.rs b/crates/ripr/src/cli/commands/receipt.rs index 52e16b130ef..f1af70eaf33 100644 --- a/crates/ripr/src/cli/commands/receipt.rs +++ b/crates/ripr/src/cli/commands/receipt.rs @@ -56,7 +56,7 @@ fn run_receipt_write(args: &[String]) -> Result<(), String> { if let Some(parent) = path.parent().filter(|p| !p.as_os_str().is_empty()) { std::fs::create_dir_all(parent) - .map_err(|err| format!("create {} failed: {err}", parent.display()))?; + .map_err(|err| format!("create {} failed: {err}; check that you can write there, or pass a different `--out` path", parent.display()))?; } crate::atomic_file::write(&path, rendered.as_bytes(), "receipt").map_err(|err| { @@ -94,7 +94,7 @@ fn run_receipt_check(args: &[String]) -> Result<(), String> { // (orphan_receipt or receipt_gap_mismatch). if cross_ref.is_error() { return Err(format!( - "receipt cross-reference failed: {}", + "receipt cross-reference failed: {}; regenerate the receipt with `ripr receipt write` against the current gap ledger, or pass the matching `--gap`", cross_ref.as_str() )); } @@ -150,7 +150,7 @@ pub(in crate::cli) fn parse_receipt_write_options( i += 1; let value = expect_value(args, i, "--packet")?; if value.trim().is_empty() { - return Err("receipt write --packet requires a non-empty packet ID".to_string()); + return Err("receipt write --packet requires a non-empty packet ID; pass a value right after --packet".to_string()); } packet_id = Some(value.to_string()); } @@ -158,7 +158,7 @@ pub(in crate::cli) fn parse_receipt_write_options( i += 1; let value = expect_value(args, i, "--verify-command")?; if value.trim().is_empty() { - return Err("receipt write requires --verify-command".to_string()); + return Err("receipt write requires --verify-command; add `--verify-command` to the command".to_string()); } verify_command = Some(value.to_string()); } @@ -177,7 +177,7 @@ pub(in crate::cli) fn parse_receipt_write_options( i += 1; let value = expect_value(args, i, "--out")?; if value.trim().is_empty() { - return Err("receipt write --out requires a non-empty path".to_string()); + return Err("receipt write --out requires a non-empty path; pass a value right after --out".to_string()); } out = Some(PathBuf::from(value)); } @@ -194,10 +194,11 @@ pub(in crate::cli) fn parse_receipt_write_options( let canonical_gap_id = canonical_gap_id.ok_or_else(|| { "receipt write requires a canonical_gap_id; re-run with --gap".to_string() })?; - let verify_command = - verify_command.ok_or_else(|| "receipt write requires --verify-command".to_string())?; + let verify_command = verify_command.ok_or_else(|| { + "receipt write requires --verify-command; add `--verify-command` to the command".to_string() + })?; let verify_status = verify_status - .ok_or_else(|| "receipt requires --status (passed|failed|not_run|unknown)".to_string())?; + .ok_or_else(|| "receipt requires --status (passed|failed|not_run|unknown); pass one of those values, such as `--status passed`".to_string())?; Ok(ReceiptWriteOptions { canonical_gap_id, @@ -227,7 +228,7 @@ pub(in crate::cli) fn parse_receipt_check_options( let value = expect_value(args, i, "--gap")?; if value.trim().is_empty() { return Err( - "receipt check --gap requires a non-empty canonical_gap_id".to_string() + "receipt check --gap requires a non-empty canonical_gap_id; pass a value right after --gap".to_string() ); } gap = Some(value.to_string()); @@ -236,7 +237,7 @@ pub(in crate::cli) fn parse_receipt_check_options( i += 1; let value = expect_value(args, i, "--path")?; if value.trim().is_empty() { - return Err("receipt check --path requires a non-empty path".to_string()); + return Err("receipt check --path requires a non-empty path; pass a value right after --path".to_string()); } path = Some(PathBuf::from(value)); } @@ -245,7 +246,7 @@ pub(in crate::cli) fn parse_receipt_check_options( let value = expect_value(args, i, "--ledger")?; if value.trim().is_empty() { return Err( - "receipt check --ledger requires a non-empty path to a gap-decision-ledger JSON file".to_string() + "receipt check --ledger requires a non-empty path to a gap-decision-ledger JSON file; pass a value right after --ledger".to_string() ); } ledger = Some(PathBuf::from(value)); diff --git a/crates/ripr/src/cli/commands/review_comments.rs b/crates/ripr/src/cli/commands/review_comments.rs index 51f3e855979..1097c29b53c 100644 --- a/crates/ripr/src/cli/commands/review_comments.rs +++ b/crates/ripr/src/cli/commands/review_comments.rs @@ -160,14 +160,18 @@ fn positive_u64_limit_from_env( let parsed = raw .trim() .parse::() - .map_err(|err| format!("{env_name} must be a positive integer: {err}"))?; + .map_err(|err| format!("{env_name} must be a positive integer: {err}; set it to a whole number of 1 or more, or unset it"))?; if parsed == 0 { - return Err(format!("{env_name} must be a positive integer")); + return Err(format!( + "{env_name} must be a positive integer; set it to a whole number of 1 or more, or unset it" + )); } Ok(parsed) } Err(std::env::VarError::NotPresent) => Ok(default), - Err(std::env::VarError::NotUnicode(_)) => Err(format!("{env_name} must be valid UTF-8")), + Err(std::env::VarError::NotUnicode(_)) => Err(format!( + "{env_name} must be valid UTF-8; set it to plain digits, or unset it" + )), } } @@ -305,7 +309,7 @@ fn load_review_comments_analysis_outcome( })?; if value.get("tool").and_then(serde_json::Value::as_str) != Some("ripr") { return Err(format!( - "review-comments --check-output {} is invalid: producer tool must be ripr", + "review-comments --check-output {} is invalid: producer tool must be ripr; rerun `ripr check --json` for the same root, base and diff, then pass its output to `--check-output`", path.display() )); } @@ -316,7 +320,7 @@ fn load_review_comments_analysis_outcome( .is_none() { return Err(format!( - "review-comments --check-output {} is invalid: producer envelope is missing string field {field}", + "review-comments --check-output {} is invalid: producer envelope is missing string field {field}; rerun `ripr check --json` for the same root, base and diff, then pass its output to `--check-output`", path.display() )); } @@ -325,13 +329,13 @@ fn load_review_comments_analysis_outcome( != Some(output::outcome::display_path(root).as_str()) { return Err(format!( - "review-comments --check-output {} is invalid: producer root does not match requested root", + "review-comments --check-output {} is invalid: producer root does not match requested root; rerun `ripr check --json` for the same root, base and diff, then pass its output to `--check-output`", path.display() )); } if value.get("base").and_then(serde_json::Value::as_str) != Some(base) { return Err(format!( - "review-comments --check-output {} is invalid: producer base does not match requested base", + "review-comments --check-output {} is invalid: producer base does not match requested base; rerun `ripr check --json` for the same root, base and diff, then pass its output to `--check-output`", path.display() )); } @@ -343,7 +347,7 @@ fn load_review_comments_analysis_outcome( .is_some_and(serde_json::Value::is_array) { return Err(format!( - "review-comments --check-output {} is invalid: producer envelope requires summary and findings", + "review-comments --check-output {} is invalid: producer envelope requires summary and findings; rerun `ripr check --json` for the same root, base and diff, then pass its output to `--check-output`", path.display() )); } @@ -371,13 +375,13 @@ fn load_review_comments_analysis_outcome( return Err(review_comments_refusal_error(path, &refusal)); } return Err(format!( - "review-comments --check-output {} is invalid: missing analysis_outcome", + "review-comments --check-output {} is invalid: missing analysis_outcome; rerun `ripr check --json` for the same root, base and diff, then pass its output to `--check-output`", path.display() )); }; if envelope.is_null() { return Err(format!( - "review-comments --check-output {} is invalid: analysis_outcome is null", + "review-comments --check-output {} is invalid: analysis_outcome is null; rerun `ripr check --json` for the same root, base and diff, then pass its output to `--check-output`", path.display() )); } @@ -412,7 +416,7 @@ fn load_review_comments_analysis_outcome( ); if outcome.identity.input_identity.as_deref() != Some(expected_input_identity.as_str()) { return Err(format!( - "review-comments --check-output {} is invalid: producer input identity does not match the requested diff", + "review-comments --check-output {} is invalid: producer input identity does not match the requested diff; rerun `ripr check --json` for the same root, base and diff, then pass its output to `--check-output`", path.display() )); } @@ -423,13 +427,13 @@ fn load_review_comments_analysis_outcome( .is_some_and(|revision| revision != base) { return Err(format!( - "review-comments --check-output {} is invalid: typed outcome base revision does not match requested base", + "review-comments --check-output {} is invalid: typed outcome base revision does not match requested base; rerun `ripr check --json` for the same root, base and diff, then pass its output to `--check-output`", path.display() )); } if declared_complete != outcome.kind.is_complete() { return Err(format!( - "review-comments --check-output {} is invalid: analysis_complete does not match typed outcome kind", + "review-comments --check-output {} is invalid: analysis_complete does not match typed outcome kind; rerun `ripr check --json` for the same root, base and diff, then pass its output to `--check-output`", path.display() )); } diff --git a/crates/ripr/src/cli/commands/swarm/ingest.rs b/crates/ripr/src/cli/commands/swarm/ingest.rs index a96e9dd3246..e59008abfa8 100644 --- a/crates/ripr/src/cli/commands/swarm/ingest.rs +++ b/crates/ripr/src/cli/commands/swarm/ingest.rs @@ -21,7 +21,7 @@ pub(super) fn parse_options(args: &[String]) -> Result { i += 1; let value = expect_value(args, i, "--root")?; if value.trim().is_empty() { - return Err("swarm ingest --root requires a non-empty path".to_string()); + return Err("swarm ingest --root requires a non-empty path; pass a value right after --root".to_string()); } root = PathBuf::from(value); } @@ -29,7 +29,7 @@ pub(super) fn parse_options(args: &[String]) -> Result { i += 1; let value = expect_value(args, i, "--result")?; if value.trim().is_empty() { - return Err("swarm ingest --result requires a non-empty path".to_string()); + return Err("swarm ingest --result requires a non-empty path; pass a value right after --result".to_string()); } result = Some(PathBuf::from(value)); } @@ -48,7 +48,10 @@ pub(super) fn parse_options(args: &[String]) -> Result { Ok(Options { root, - result: result.ok_or_else(|| "swarm ingest requires --result ".to_string())?, + result: result.ok_or_else(|| { + "swarm ingest requires --result ; add `--result ` to the command" + .to_string() + })?, }) } @@ -93,7 +96,7 @@ fn validate_result_path(root: &Path, path: &Path) -> Result { if !candidate.starts_with(root) { return Err(format!( - "swarm ingest --result {} must stay under root {}", + "swarm ingest --result {} must stay under root {}; pass a path inside that root, or change `--root`", crate::output::path::human_path(path), crate::output::path::human_path(root) )); @@ -139,7 +142,10 @@ mod tests { ); assert_eq!( parse_options(&args(&[])), - Err("swarm ingest requires --result ".to_string()) + Err( + "swarm ingest requires --result ; add `--result ` to the command" + .to_string() + ) ); } @@ -189,7 +195,7 @@ mod tests { ); assert_eq!( parse(&["--result", "r.json", "--root"]), - Err("missing value for --root".to_string()) + Err("missing value for --root; pass a value right after it".to_string()) ); assert_eq!( parse(&["--result", "r.json", "--format"]), @@ -205,15 +211,21 @@ mod tests { ); assert_eq!( parse(&["--root", " ", "--result", "r.json"]), - Err("swarm ingest --root requires a non-empty path".to_string()) + Err( + "swarm ingest --root requires a non-empty path; pass a value right after --root" + .to_string() + ) ); assert_eq!( parse(&["--root", ""]), - Err("swarm ingest --root requires a non-empty path".to_string()) + Err( + "swarm ingest --root requires a non-empty path; pass a value right after --root" + .to_string() + ) ); assert_eq!( parse(&["--result", " \t"]), - Err("swarm ingest --result requires a non-empty path".to_string()) + Err("swarm ingest --result requires a non-empty path; pass a value right after --result".to_string()) ); } @@ -296,7 +308,7 @@ mod tests { assert_eq!( message, format!( - "swarm ingest --result {} must stay under root {}", + "swarm ingest --result {} must stay under root {}; pass a path inside that root, or change `--root`", crate::output::path::human_path(&outside), crate::output::path::human_path(&root) ) diff --git a/crates/ripr/src/cli/commands/swarm/queue.rs b/crates/ripr/src/cli/commands/swarm/queue.rs index 17330b99e09..6cbc77a2ad8 100644 --- a/crates/ripr/src/cli/commands/swarm/queue.rs +++ b/crates/ripr/src/cli/commands/swarm/queue.rs @@ -26,7 +26,7 @@ pub(super) fn parse_options(args: &[String]) -> Result { i += 1; let value = expect_value(args, i, "--root")?; if value.trim().is_empty() { - return Err("swarm queue --root requires a non-empty path".to_string()); + return Err("swarm queue --root requires a non-empty path; pass a value right after --root".to_string()); } root = PathBuf::from(value); } @@ -34,7 +34,7 @@ pub(super) fn parse_options(args: &[String]) -> Result { i += 1; let value = expect_value(args, i, "--gap-ledger")?; if value.trim().is_empty() { - return Err("swarm queue --gap-ledger requires a non-empty path".to_string()); + return Err("swarm queue --gap-ledger requires a non-empty path; pass a value right after --gap-ledger".to_string()); } gap_ledger = PathBuf::from(value); } @@ -42,7 +42,7 @@ pub(super) fn parse_options(args: &[String]) -> Result { i += 1; let value = expect_value(args, i, "--language")?; if value.trim().is_empty() { - return Err("swarm queue --language requires a non-empty language".to_string()); + return Err("swarm queue --language requires a non-empty language; pass a value right after --language".to_string()); } language = value.to_string(); } @@ -261,7 +261,7 @@ mod tests { ); assert_eq!( parse_options(&args(&["--top", "0"])), - Err("swarm queue --top requires a positive integer; got \"0\"".to_string()) + Err("swarm queue --top requires a positive integer; pass a whole number of 1 or more, got \"0\"".to_string()) ); } diff --git a/crates/ripr/src/cli/commands/task_first.rs b/crates/ripr/src/cli/commands/task_first.rs index 484bd67eae8..0a60cbe0a8a 100644 --- a/crates/ripr/src/cli/commands/task_first.rs +++ b/crates/ripr/src/cli/commands/task_first.rs @@ -181,7 +181,10 @@ pub(super) fn parse_repair_args(args: &[String]) -> Result Result { if other.trim().is_empty() { - return Err("repair requires a non-empty item".to_string()); + return Err( + "repair requires a non-empty item; pass the finding or seam ID to repair" + .to_string(), + ); } if item.is_some() { return Err(format!( @@ -236,7 +242,7 @@ pub(super) fn parse_continue_args(args: &[String]) -> Result Result Result, Strin Ok(text) => Ok(Some(config_fingerprint(&text))), Err(err) if err.kind() == std::io::ErrorKind::NotFound => { if crate::config::config_present_at_root(root) { - Err(format!("read {} failed: {err}", path.display())) + Err(format!( + "read {} failed: {err}; check the path exists and you can read it, then rerun", + path.display() + )) } else { Ok(None) } } - Err(err) => Err(format!("read {} failed: {err}", path.display())), + Err(err) => Err(format!( + "read {} failed: {err}; check the path exists and you can read it, then rerun", + path.display() + )), } } fn agent_receipt_generated_at() -> Result { let millis = SystemTime::now() .duration_since(UNIX_EPOCH) - .map_err(|err| format!("system clock before unix epoch: {err}"))? + .map_err(|err| format!("system clock before unix epoch: {err}; set the system clock to the current time, then rerun"))? .as_millis(); Ok(format!("unix_ms:{millis}")) } @@ -229,7 +235,7 @@ pub(super) fn validate_agent_verify_snapshot_path( if !candidate.starts_with(&root) { return Err(format!( - "agent verify {flag} {} must stay under root {}", + "agent verify {flag} {} must stay under root {}; pass a path inside that root, or change `--root`", crate::output::path::human_path(path), crate::output::path::human_path(&root) )); @@ -322,7 +328,7 @@ fn validate_agent_brief_diff_path(root: &Path, path: &Path) -> Result Result { return Err(format!( - "agent brief --files {} must stay under root {}", + "agent brief --files {} must stay under root {}; pass a path inside that root, or change `--root`", crate::output::path::human_path(path), crate::output::path::human_path(root) )); diff --git a/crates/ripr/src/cli/commands_context.rs b/crates/ripr/src/cli/commands_context.rs index 079239952d0..a72ffc28e73 100644 --- a/crates/ripr/src/cli/commands_context.rs +++ b/crates/ripr/src/cli/commands_context.rs @@ -242,11 +242,11 @@ pub(super) fn write_stdout_chunked(text: &str) -> Result<(), String> { for chunk in text.as_bytes().chunks(CHUNK) { handle .write_all(chunk) - .map_err(|err| format!("write to stdout failed: {err}"))?; + .map_err(|err| format!("write to stdout failed: {err}; check the reader of ripr's output is still open, then rerun"))?; } handle .flush() - .map_err(|err| format!("flush stdout failed: {err}")) + .map_err(|err| format!("flush stdout failed: {err}; check the reader of ripr's output is still open, then rerun")) } /// Typed refusal for a [`load_for_root`] failure (#6834, shared #7331). diff --git a/crates/ripr/src/cli/commands_numeric.rs b/crates/ripr/src/cli/commands_numeric.rs index e1695f18112..269b17026d0 100644 --- a/crates/ripr/src/cli/commands_numeric.rs +++ b/crates/ripr/src/cli/commands_numeric.rs @@ -10,11 +10,15 @@ fn parse_positive_integer(value: &str, flag: &str) -> Result where T: std::str::FromStr + Eq + From, { - let parsed = value - .parse::() - .map_err(|_parse_err| format!("{flag} requires a positive integer; got {value:?}"))?; + let parsed = value.parse::().map_err(|_parse_err| { + format!( + "{flag} requires a positive integer; pass a whole number of 1 or more, got {value:?}" + ) + })?; if parsed == T::from(0) { - return Err(format!("{flag} requires a positive integer; got {value:?}")); + return Err(format!( + "{flag} requires a positive integer; pass a whole number of 1 or more, got {value:?}" + )); } Ok(parsed) } @@ -33,7 +37,7 @@ pub(super) fn parse_positive_usize(value: &str, flag: &str) -> Result Result { value .parse::() - .map_err(|_parse_err| format!("{flag} requires a non-negative integer; got {value:?}")) + .map_err(|_parse_err| format!("{flag} requires a non-negative integer; pass a whole number of 0 or more, got {value:?}")) } pub(super) fn parse_positive_u64(value: &str, flag: &str) -> Result { diff --git a/crates/ripr/src/cli/commands_timestamps.rs b/crates/ripr/src/cli/commands_timestamps.rs index 1c094c6b8c0..518dff69cf4 100644 --- a/crates/ripr/src/cli/commands_timestamps.rs +++ b/crates/ripr/src/cli/commands_timestamps.rs @@ -3,7 +3,7 @@ use std::time::{SystemTime, UNIX_EPOCH}; pub(crate) fn generated_at_unix_ms() -> Result { let millis = SystemTime::now() .duration_since(UNIX_EPOCH) - .map_err(|err| format!("system clock before unix epoch: {err}"))? + .map_err(|err| format!("system clock before unix epoch: {err}; set the system clock to the current time, then rerun"))? .as_millis(); Ok(format!("unix_ms:{millis}")) } diff --git a/crates/ripr/src/cli/execute.rs b/crates/ripr/src/cli/execute.rs index 83218703339..32e1a0188bd 100644 --- a/crates/ripr/src/cli/execute.rs +++ b/crates/ripr/src/cli/execute.rs @@ -96,7 +96,7 @@ mod tests { assert_eq!( execute(CliCommand::Rerun(Vec::new())), Err(CommandError::Failure( - "rerun requires --changed-test or --gap --gap-ledger " + "rerun requires --changed-test or --gap --gap-ledger ; pass one selector, for example `--changed-test tests/a.rs`" .to_string() )) ); @@ -114,7 +114,7 @@ mod tests { assert_eq!( execute(CliCommand::Doctor(args(&["--root"]))), Err(CommandError::Failure( - "missing value for --root".to_string() + "missing value for --root; pass a value right after it".to_string() )) ); assert_eq!( @@ -126,13 +126,13 @@ mod tests { assert_eq!( execute(CliCommand::Init(args(&["--root"]))), Err(CommandError::Failure( - "missing value for --root".to_string() + "missing value for --root; pass a value right after it".to_string() )) ); assert_eq!( execute(CliCommand::Config(args(&["validate", "--root"]))), Err(CommandError::Failure( - "missing value for --root".to_string() + "missing value for --root; pass a value right after it".to_string() )) ); assert_eq!( @@ -145,7 +145,7 @@ mod tests { assert_eq!( execute(CliCommand::Pilot(args(&["--max-seams", "0"]))), Err(CommandError::Failure( - "--max-seams requires a positive integer; got \"0\"".to_string() + "--max-seams requires a positive integer; pass a whole number of 1 or more, got \"0\"".to_string() )) ); assert_eq!( @@ -157,7 +157,7 @@ mod tests { assert_eq!( execute(CliCommand::EvidenceHealth(args(&["--root"]))), Err(CommandError::Failure( - "missing value for --root".to_string() + "missing value for --root; pass a value right after it".to_string() )) ); assert_eq!( @@ -259,7 +259,7 @@ mod tests { assert_eq!( execute(CliCommand::Swarm(args(&["queue", "--top", "0"]))), Err(CommandError::Failure( - "swarm queue --top requires a positive integer; got \"0\"".to_string() + "swarm queue --top requires a positive integer; pass a whole number of 1 or more, got \"0\"".to_string() )) ); assert_eq!( diff --git a/crates/ripr/src/cli/help/overview.rs b/crates/ripr/src/cli/help/overview.rs index 5c8f9293890..593bbd20a3c 100644 --- a/crates/ripr/src/cli/help/overview.rs +++ b/crates/ripr/src/cli/help/overview.rs @@ -76,7 +76,7 @@ pub(super) const HELP_ALL: &str = r#"ripr — complete command reference. Task-oriented overview: ripr --help Options for one command: ripr help -Machine catalog: ripr help --json (this route accepts no other arguments) +Machine catalog: ripr help --json (this route accepts no other arguments); drop the extra arguments, or run `ripr --help` to list commands Global flags (accepted in any position, before or after the command, except on ripr help --json): -v, --verbose Extra pipeline diagnostics on stderr: analyzed languages, diff --git a/crates/ripr/src/cli/help_json.rs b/crates/ripr/src/cli/help_json.rs index d15ebac9d91..c6056320ee6 100644 --- a/crates/ripr/src/cli/help_json.rs +++ b/crates/ripr/src/cli/help_json.rs @@ -456,7 +456,7 @@ fn build_document( let violations = document_violations(entries, command_rows, workflows); if !violations.is_empty() { return Err(format!( - "help --json catalog integrity failed: {violations:?}" + "help --json catalog integrity failed: {violations:?}; report this as a ripr bug with the command you ran" )); } @@ -517,7 +517,7 @@ fn catalog_digest(document: &HelpJsonDocument) -> Result { workflows: &document.workflows, }; let serialized = serde_json::to_string(&input) - .map_err(|error| format!("help --json digest serialization failed: {error}"))?; + .map_err(|error| format!("help --json digest serialization failed: {error}; report this as a ripr bug with the command you ran"))?; Ok(sha256_hex(serialized.as_bytes())) } @@ -540,7 +540,7 @@ fn sha256_hex(bytes: &[u8]) -> String { pub(crate) fn render_help_json() -> Result { let document = build_document(catalog(), metadata(), workflow_catalog())?; serde_json::to_string(&document) - .map_err(|error| format!("help --json serialization failed: {error}")) + .map_err(|error| format!("help --json serialization failed: {error}; report this as a ripr bug with the command you ran")) } /// `ripr help --json`: emit the document on stdout. The document is built in diff --git a/crates/ripr/src/cli/interrupt.rs b/crates/ripr/src/cli/interrupt.rs index f250ee06653..387149b616d 100644 --- a/crates/ripr/src/cli/interrupt.rs +++ b/crates/ripr/src/cli/interrupt.rs @@ -42,11 +42,11 @@ impl ServerInterrupts { signal, Arc::clone(®istration.interrupted), ) - .map_err(|error| format!("cannot preserve native signal {signal}: {error}"))?; + .map_err(|error| format!("cannot preserve native signal {signal}: {error}; check the process may install signal handlers, or report this as a ripr bug with the command you ran"))?; registration.registrations.push(native); let cancellation = signal_hook::flag::register(signal, Arc::clone(®istration.interrupted)) - .map_err(|error| format!("cannot observe signal {signal}: {error}"))?; + .map_err(|error| format!("cannot observe signal {signal}: {error}; check the process may install signal handlers, or report this as a ripr bug with the command you ran"))?; registration.registrations.push(cancellation); } Ok(registration) @@ -166,11 +166,13 @@ impl SignalRegistration { // Order matters: publication's store/checkpoint handshake relies on // cancellation being stored before the conditional native-action read. let cancellation = signal_hook::flag::register(signal, interrupted) - .map_err(|error| format!("check: cannot observe SIGINT: {error}"))?; + .map_err(|error| format!("check: cannot observe SIGINT: {error}; check the process may install signal handlers, or report this as a ripr bug with the command you ran"))?; if let Err(error) = signal_hook::flag::register_conditional_default(signal, native.clone()) { signal_hook::low_level::unregister(cancellation); - return Err(format!("check: cannot preserve native SIGINT: {error}")); + return Err(format!( + "check: cannot preserve native SIGINT: {error}; check the process may install signal handlers, or report this as a ripr bug with the command you ran" + )); } // A second signal can escape blocked analysis I/O or stalled cleanup. // The first still requests cooperative settlement before arming this. @@ -183,7 +185,9 @@ impl SignalRegistration { Err(error) => { native.store(true, std::sync::atomic::Ordering::SeqCst); signal_hook::low_level::unregister(cancellation); - Err(format!("check: cannot arm forced SIGINT: {error}")) + Err(format!( + "check: cannot arm forced SIGINT: {error}; check the process may install signal handlers, or report this as a ripr bug with the command you ran" + )) } } } @@ -201,7 +205,8 @@ impl Drop for SignalRegistration { } } -#[cfg(all(test, unix))] +#[cfg(test)] +#[cfg(unix)] mod tests { use super::{ InterruptFlags, SignalRegistration, check, install_server_interrupts, diff --git a/crates/ripr/src/cli/mod.rs b/crates/ripr/src/cli/mod.rs index 7cc95671c8a..aec6d909870 100644 --- a/crates/ripr/src/cli/mod.rs +++ b/crates/ripr/src/cli/mod.rs @@ -144,7 +144,7 @@ fn run_command(mut args: Vec, interrupt_handling: bool) -> Result<(), Co && args.get(2).is_some_and(|arg| arg == "--json") { return Err(CommandError::from( - "usage: ripr help --json (this route accepts no other arguments)".to_string(), + "usage: ripr help --json (this route accepts no other arguments); drop the extra arguments, or run `ripr --help` to list commands".to_string(), )); } eprintln!("ripr: verbose mode enabled"); @@ -222,10 +222,18 @@ fn gap_binding_from_snapshot( base: &str, snapshot: &std::path::Path, ) -> Result { - let raw = std::fs::read_to_string(snapshot) - .map_err(|error| format!("read {} failed: {error}", snapshot.display()))?; - let document: serde_json::Value = serde_json::from_str(&raw) - .map_err(|error| format!("parse {} failed: {error}", snapshot.display()))?; + let raw = std::fs::read_to_string(snapshot).map_err(|error| { + format!( + "read {} failed: {error}; check the file exists and you can read it, then rerun", + snapshot.display() + ) + })?; + let document: serde_json::Value = serde_json::from_str(&raw).map_err(|error| { + format!( + "parse {} failed: {error}; regenerate it with `ripr check --json`, then rerun", + snapshot.display() + ) + })?; let base_commit = document .pointer("/artifact/analysis/base_revision") .and_then(serde_json::Value::as_str) @@ -274,7 +282,7 @@ fn drive_before_phase_inner( let seam_id = options .seam_id .as_deref() - .ok_or_else(|| "before-phase repair attempt is missing its seam identity".to_string())?; + .ok_or_else(|| "before-phase repair attempt is missing its seam identity; report this as a ripr bug with the command you ran".to_string())?; let identity = crate::app::repair_attempt::BeforeRepairAttemptIdentity::prepare(&options.root, seam_id)?; // #9103: remember the shared gap-bound workflow artifacts as this @@ -301,7 +309,7 @@ fn drive_before_phase_inner( BeforePhaseError::Other(error) => error.message().to_owned(), }; return Err(BeforePhaseError::Other(CommandError::Failure(format!( - "{original}; failed to restore prior workflow artifacts: {restore_error}" + "{original}; failed to restore prior workflow artifacts: {restore_error}; remove target/ripr/workflow by hand, then rerun the repair command" )))); } return Err(error); @@ -385,13 +393,20 @@ fn lock_repair_workflow(root: &Path) -> Result { let git_dir = crate::agent::artifact::git_output(root, &["rev-parse", "--absolute-git-dir"])?; let git_dir = Path::new(git_dir.trim()); let lock_path = git_dir.join("ripr-repair-workflow.lock"); - let lock = crate::output::file_write::open_lock(&lock_path) - .map_err(|error| format!("create {} failed: {error}", lock_path.display()))?; + let lock = crate::output::file_write::open_lock(&lock_path).map_err(|error| { + format!( + "create {} failed: {error}; check you can write under the git directory, then rerun", + lock_path.display() + ) + })?; if let Err(error) = lock.try_lock() { if matches!(error, std::fs::TryLockError::WouldBlock) { return Err("another repair phase is using the shared workflow artifacts; retry after it finishes".to_string()); } - return Err(format!("lock {} failed: {error}", lock_path.display())); + return Err(format!( + "lock {} failed: {error}; wait for any other ripr repair to finish, then rerun", + lock_path.display() + )); } Ok(lock) } @@ -405,20 +420,33 @@ fn lock_repair_workflow(root: &Path) -> Result { /// process exit and cannot go stale. fn lock_before_repair_attempt(root: &Path) -> Result { let directory = root.join(crate::app::repair_attempt::REPAIR_ATTEMPT_DIRECTORY); - std::fs::create_dir_all(&directory) - .map_err(|error| format!("create {} failed: {error}", directory.display()))?; + std::fs::create_dir_all(&directory).map_err(|error| { + format!( + "create {} failed: {error}; check you can write under target/ripr, then rerun", + directory.display() + ) + })?; let lock_path = directory.join(".before.lock"); // Refuse a planted symlink or other non-file, and never truncate: the // no-follow writer's Windows share mode would turn a held lock into a // sharing violation before `try_lock` could name it. - crate::output::file_write::validate_destination(&lock_path) - .map_err(|error| format!("create {} failed: {error}", lock_path.display()))?; + crate::output::file_write::validate_destination(&lock_path).map_err(|error| { + format!( + "create {} failed: {error}; remove that path if it is not a plain file, then rerun", + lock_path.display() + ) + })?; let lock = std::fs::OpenOptions::new() .write(true) .create(true) .truncate(false) .open(&lock_path) - .map_err(|error| format!("create {} failed: {error}", lock_path.display()))?; + .map_err(|error| { + format!( + "create {} failed: {error}; check you can write under target/ripr, then rerun", + lock_path.display() + ) + })?; if let Err(error) = lock.try_lock() { if matches!(error, std::fs::TryLockError::WouldBlock) { return Err( @@ -426,7 +454,10 @@ fn lock_before_repair_attempt(root: &Path) -> Result { .to_string(), ); } - return Err(format!("lock {} failed: {error}", lock_path.display())); + return Err(format!( + "lock {} failed: {error}; wait for any other ripr repair to finish, then rerun", + lock_path.display() + )); } Ok(lock) } @@ -481,7 +512,7 @@ fn persist_before_repair_attempt( let seam_id = options .seam_id .as_deref() - .ok_or_else(|| "before-phase repair attempt is missing its seam identity".to_string())?; + .ok_or_else(|| "before-phase repair attempt is missing its seam identity; report this as a ripr bug with the command you ran".to_string())?; let workflow_manifest = root.join(WORKFLOW_MANIFEST_ARTIFACT); let commands_markdown = root.join(WORKFLOW_COMMANDS_MARKDOWN_ARTIFACT); let agent_brief = root.join(WORKFLOW_AGENT_BRIEF_ARTIFACT); @@ -491,10 +522,17 @@ fn persist_before_repair_attempt( } else { root.join(WORKFLOW_AGENT_PACKET_ARTIFACT) }; - let packet_bytes = crate::bounded_input::read(&agent_packet) - .map_err(|error| format!("read {} failed: {error}", agent_packet.display()))?; - let packet_text = String::from_utf8(packet_bytes.clone()) - .map_err(|error| format!("agent packet is not UTF-8: {error}"))?; + let packet_bytes = crate::bounded_input::read(&agent_packet).map_err(|error| { + format!( + "read {} failed: {error}; rerun the before phase to regenerate the packet", + agent_packet.display() + ) + })?; + let packet_text = String::from_utf8(packet_bytes.clone()).map_err(|error| { + format!( + "agent packet is not UTF-8: {error}; rerun the before phase to regenerate the packet" + ) + })?; let mut policy = crate::app::repair_attempt::edit_cage_policy_from_packet(&packet_text, seam_id)?; crate::app::repair_attempt::include_explicit_store_operational_write( @@ -505,7 +543,7 @@ fn persist_before_repair_attempt( // Recheck immediately before baseline capture so ignore-rule drift observed // during preparation refuses attempt publication. crate::edit_cage::validate_build_output_precondition(root, &policy) - .map_err(|error| format!("{error} No repair attempt was started."))?; + .map_err(|error| format!("{error} No repair attempt was started. Fix the cause above and rerun the repair command."))?; let edit_cage_baseline = root.join("target/ripr/workflow/attempt-baseline.json"); crate::app::repair_attempt::write_edit_cage_baseline(root, &edit_cage_baseline, &policy)?; @@ -1063,7 +1101,7 @@ mod tests { assert_eq!( run(args(&["ripr", "doctor", "--root"])), Err(CommandError::Failure( - "missing value for --root".to_string() + "missing value for --root; pass a value right after it".to_string() )) ); } @@ -1073,7 +1111,7 @@ mod tests { assert_eq!( run(args(&["ripr", "init", "--root"])), Err(CommandError::Failure( - "missing value for --root".to_string() + "missing value for --root; pass a value right after it".to_string() )) ); } @@ -1176,7 +1214,7 @@ mod tests { assert_eq!( run(argv), Err(CommandError::Failure( - "usage: ripr help --json (this route accepts no other arguments)".to_string() + "usage: ripr help --json (this route accepts no other arguments); drop the extra arguments, or run `ripr --help` to list commands".to_string() )) ); } diff --git a/crates/ripr/src/cli/parse/value.rs b/crates/ripr/src/cli/parse/value.rs index 470b46f094e..e247858f242 100644 --- a/crates/ripr/src/cli/parse/value.rs +++ b/crates/ripr/src/cli/parse/value.rs @@ -5,5 +5,5 @@ pub(crate) fn expect_value<'a>( ) -> Result<&'a str, String> { args.get(idx) .map(|s| s.as_str()) - .ok_or_else(|| format!("missing value for {flag}")) + .ok_or_else(|| format!("missing value for {flag}; pass a value right after it")) } diff --git a/crates/ripr/src/cli/rerun.rs b/crates/ripr/src/cli/rerun.rs index ccb3a16df2d..0808042d682 100644 --- a/crates/ripr/src/cli/rerun.rs +++ b/crates/ripr/src/cli/rerun.rs @@ -527,7 +527,9 @@ fn parse_options(args: &[String]) -> Result { RerunSelector::ChangedTest { file, node } } (Some(_), None, Some(_)) => { - return Err("rerun --gap-ledger requires --gap".to_string()); + return Err( + "rerun --gap-ledger requires --gap; add `--gap` to the command".to_string(), + ); } (None, Some(canonical_gap_id), Some(gap_ledger)) => RerunSelector::Gap { canonical_gap_id, @@ -545,10 +547,12 @@ fn parse_options(args: &[String]) -> Result { )); } (None, None, Some(_)) => { - return Err("rerun --gap-ledger requires --gap".to_string()); + return Err( + "rerun --gap-ledger requires --gap; add `--gap` to the command".to_string(), + ); } (None, None, None) => { - return Err("rerun requires --changed-test or --gap --gap-ledger ".to_string()); + return Err("rerun requires --changed-test or --gap --gap-ledger ; pass one selector, for example `--changed-test tests/a.rs`".to_string()); } (Some(_), Some(_), _) => return Err("rerun accepts exactly one selector".to_string()), }; @@ -1949,14 +1953,17 @@ fn parse_changed_test_selector(selector: &str) -> Result<(PathBuf, Option::`, or `--changed-test ` alone".to_string()); } Ok((PathBuf::from(file), node)) } @@ -1979,10 +1986,14 @@ fn write_text_file(path: &Path, rendered: &str) -> Result<(), String> { .filter(|parent| !parent.as_os_str().is_empty()) { std::fs::create_dir_all(parent) - .map_err(|err| format!("create {} failed: {err}", parent.display()))?; + .map_err(|err| format!("create {} failed: {err}; check you can create directories there, or pass a different `--out`", parent.display()))?; } - crate::output::file_write::write(path, rendered.as_bytes()) - .map_err(|err| format!("write {} failed: {err}", path.display())) + crate::output::file_write::write(path, rendered.as_bytes()).map_err(|err| { + format!( + "write {} failed: {err}; check you can write there, or pass a different `--out`", + path.display() + ) + }) } fn render_human(report: &TargetedRerunReport) -> String { @@ -2667,7 +2678,7 @@ mod tests { assert_eq!( parse_options(&[]), Err( - "rerun requires --changed-test or --gap --gap-ledger " + "rerun requires --changed-test or --gap --gap-ledger ; pass one selector, for example `--changed-test tests/a.rs`" .to_string() ) ); @@ -4038,7 +4049,9 @@ mod tests { ] { assert_eq!( parse_options(&args(&[flag])), - Err(format!("missing value for {flag}")), + Err(format!( + "missing value for {flag}; pass a value right after it" + )), "{flag} without a value must name the flag" ); } @@ -4074,7 +4087,7 @@ mod tests { Err(conflict) ); // A ledger needs a gap, with or without a changed-test selector. - let orphan = "rerun --gap-ledger requires --gap".to_string(); + let orphan = "rerun --gap-ledger requires --gap; add `--gap` to the command".to_string(); assert_eq!( parse_options(&args(&["--gap-ledger", "ledger.json"])), Err(orphan.clone()) @@ -4105,16 +4118,16 @@ mod tests { fn rerun_changed_test_selector_requires_a_file_and_trims_the_node() -> Result<(), String> { assert_eq!( parse_options(&args(&["--changed-test", " "])), - Err("rerun --changed-test requires a file path".to_string()) + Err("rerun --changed-test requires a file path; pass the path right after --changed-test".to_string()) ); assert_eq!( parse_options(&args(&["--changed-test", "::case"])), - Err("rerun --changed-test requires a file path".to_string()) + Err("rerun --changed-test requires a file path; pass the path right after --changed-test".to_string()) ); // A whitespace-only node is empty, like no node after the separator. assert_eq!( parse_options(&args(&["--changed-test", "tests/a.rs:: "])), - Err("rerun --changed-test test node must not be empty".to_string()) + Err("rerun --changed-test test node must not be empty; pass `--changed-test ::`, or `--changed-test ` alone".to_string()) ); let options = parse_options(&args(&["--changed-test", "tests/a.rs:: case "]))?; if options.selector diff --git a/crates/ripr/tests/cli_help_hierarchy.rs b/crates/ripr/tests/cli_help_hierarchy.rs index c3e2ff8286d..95970348869 100644 --- a/crates/ripr/tests/cli_help_hierarchy.rs +++ b/crates/ripr/tests/cli_help_hierarchy.rs @@ -1053,7 +1053,7 @@ fn help_all_rejects_trailing_arguments() -> Result<(), String> { assert_contains( "ripr help --all trailing-argument error", &String::from_utf8_lossy(&output.stderr), - "usage: ripr help --all (this route accepts no other arguments)", + "usage: ripr help --all (this route accepts no other arguments); drop the extra arguments, or run `ripr --help` to list commands", )?; } // The bare selector is unchanged on both spellings. diff --git a/crates/ripr/tests/cli_smoke.rs b/crates/ripr/tests/cli_smoke.rs index 3f22215bbb0..13e102b1e2a 100644 --- a/crates/ripr/tests/cli_smoke.rs +++ b/crates/ripr/tests/cli_smoke.rs @@ -10864,12 +10864,18 @@ fn agent_receipt_attempt_flag_selects_one_attempt_and_refusals_name_ids() ); std::fs::remove_file(&out)?; for (omitted, diagnostic) in [ - ("all", "agent receipt requires --verify-json "), + ( + "all", + "agent receipt requires --verify-json ; add `--verify-json ` to the command", + ), ( "--verify-json", - "agent receipt requires --verify-json ", + "agent receipt requires --verify-json ; add `--verify-json ` to the command", + ), + ( + "--seam-id", + "agent receipt requires --seam-id; add `--seam-id` to the command", ), - ("--seam-id", "agent receipt requires --seam-id"), ( "--json", "agent receipt requires --json (the supported output for this subcommand); add --json to the command", @@ -17251,7 +17257,7 @@ fn baseline_update_removes_resolved_without_adopting_new_debt() -> Result<(), St assert_failure(&no_mode); let stderr = String::from_utf8_lossy(&no_mode.stderr); assert!(stderr.contains("--remove-resolved")); - assert!(stderr.contains("adopting new debt is not supported")); + assert!(stderr.contains("adopting new debt is not supported; pass `--remove-resolved` or `--migrate-legacy-identities`")); ignore_remove_dir_all(&workspace); Ok(()) diff --git a/crates/ripr/tests/cli_smoke/baseline_path_values.rs b/crates/ripr/tests/cli_smoke/baseline_path_values.rs index 8f99c02aaf4..aca22be9184 100644 --- a/crates/ripr/tests/cli_smoke/baseline_path_values.rs +++ b/crates/ripr/tests/cli_smoke/baseline_path_values.rs @@ -52,7 +52,9 @@ fn missing_path_values_refuse_option_tokens_before_writing_reports() -> Result<( let stderr = String::from_utf8_lossy(&output.stderr); assert_eq!(output.status.code(), Some(2), "flag={flag}; {output:?}"); assert!( - stderr.contains(&format!("missing value for {flag}")), + stderr.contains(&format!( + "missing value for {flag}; pass a value right after it" + )), "flag={flag}; {stderr}" ); assert!( @@ -79,9 +81,9 @@ fn missing_path_values_refuse_option_tokens_before_writing_reports() -> Result<( Some(2), "trailing flag={flag}; {output:?}" ); - assert!( - String::from_utf8_lossy(&output.stderr).contains(&format!("missing value for {flag}")) - ); + assert!(String::from_utf8_lossy(&output.stderr).contains(&format!( + "missing value for {flag}; pass a value right after it" + ))); } ignore_remove_dir_all(&root); Ok(()) diff --git a/crates/ripr/tests/cli_smoke/cli_value_contracts.rs b/crates/ripr/tests/cli_smoke/cli_value_contracts.rs index 52d4bc09162..fe361797192 100644 --- a/crates/ripr/tests/cli_smoke/cli_value_contracts.rs +++ b/crates/ripr/tests/cli_smoke/cli_value_contracts.rs @@ -63,7 +63,7 @@ fn pilot_format_help_agrees_with_accepted_values() { for value in ["human", "json"] { assert_usage_error( run_ripr(&["pilot", "--format", value, "--max-seams", "0"]), - "--max-seams requires a positive integer; got \"0\"", + "--max-seams requires a positive integer; pass a whole number of 1 or more, got \"0\"", ); } assert_usage_error( @@ -91,7 +91,7 @@ fn doctor_profile_help_agrees_with_accepted_values() { for value in ["analysis", "source-build"] { assert_usage_error( run_ripr(&["doctor", "--profile", value, "--root"]), - "missing value for --root", + "missing value for --root; pass a value right after it", ); } assert_usage_error( @@ -100,6 +100,6 @@ fn doctor_profile_help_agrees_with_accepted_values() { ); assert_usage_error( run_ripr(&["doctor", "--profile"]), - "missing value for --profile", + "missing value for --profile; pass a value right after it", ); } diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__agent.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__agent.rs.txt deleted file mode 100644 index 53bda7d883b..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__agent.rs.txt +++ /dev/null @@ -1,46 +0,0 @@ -crates/ripr/src/cli/agent.rs|agent brief --files requires non-empty paths -crates/ripr/src/cli/agent.rs|agent card --seam-id requires a non-empty ID -crates/ripr/src/cli/agent.rs|agent card requires --seam-id -crates/ripr/src/cli/agent.rs|agent packet --gap-id requires --gap-ledger -crates/ripr/src/cli/agent.rs|agent packet --gap-id requires a non-empty ID -crates/ripr/src/cli/agent.rs|agent packet --gap-ledger requires --gap-id -crates/ripr/src/cli/agent.rs|agent packet --gap-ledger requires a non-empty path -crates/ripr/src/cli/agent.rs|agent packet --seam-id requires a non-empty ID -crates/ripr/src/cli/agent.rs|agent packet requires --seam-id or --gap-ledger with --gap-id -crates/ripr/src/cli/agent.rs|agent receipt --attempt requires a non-empty ID -crates/ripr/src/cli/agent.rs|agent receipt --command requires a non-empty value -crates/ripr/src/cli/agent.rs|agent receipt --seam-id requires a non-empty ID -crates/ripr/src/cli/agent.rs|agent receipt --test requires a non-empty value -crates/ripr/src/cli/agent.rs|agent receipt requires --seam-id -crates/ripr/src/cli/agent.rs|agent receipt requires --verify-json -crates/ripr/src/cli/agent.rs|agent repair --attempt requires a non-empty ID -crates/ripr/src/cli/agent.rs|agent repair --base requires a non-empty ref -crates/ripr/src/cli/agent.rs|agent repair --edit-authority requires --edit-authorized; the driver accepts only the explicit pair -crates/ripr/src/cli/agent.rs|agent repair --edit-authority requires a non-empty operator or agent identity -crates/ripr/src/cli/agent.rs|agent repair --edit-authorized requires --edit-authority ; the driver never authorizes an edit autom -crates/ripr/src/cli/agent.rs|agent repair --edit-authorized/--edit-authority require --python-repair-trust-manifest and --python-repair-tru -crates/ripr/src/cli/agent.rs|agent repair --gap-id does not take the Python repair-trust flags; a gap-bound start carries no Python trust b -crates/ripr/src/cli/agent.rs|agent repair --gap-id requires --base ; the gap's findings are diff-scoped, so the base the check ran aga -crates/ripr/src/cli/agent.rs|agent repair --gap-id requires a non-empty ID -crates/ripr/src/cli/agent.rs|agent repair --phase after requires --attempt or --seam-id -crates/ripr/src/cli/agent.rs|agent repair --phase verify requires --attempt -crates/ripr/src/cli/agent.rs|agent repair --python-repair-trust-attempt requires --python-repair-trust-manifest -crates/ripr/src/cli/agent.rs|agent repair --python-repair-trust-attempt requires a non-empty attempt identity -crates/ripr/src/cli/agent.rs|agent repair --python-repair-trust-manifest requires --python-repair-trust-attempt -crates/ripr/src/cli/agent.rs|agent repair --python-repair-trust-manifest requires a non-empty path -crates/ripr/src/cli/agent.rs|agent repair --seam-id requires a non-empty ID -crates/ripr/src/cli/agent.rs|agent repair --store requires a non-empty path -crates/ripr/src/cli/agent.rs|agent repair --verify-authority requires --verify-authorized; the driver accepts only the explicit pair -crates/ripr/src/cli/agent.rs|agent repair --verify-authority requires a non-empty operator or agent identity -crates/ripr/src/cli/agent.rs|agent repair --verify-authorized requires --verify-authority ; the driver never authorizes a verific -crates/ripr/src/cli/agent.rs|agent repair --verify-rollback requires --verify-authorized and --verify-authority -crates/ripr/src/cli/agent.rs|agent start --out requires a non-empty path -crates/ripr/src/cli/agent.rs|agent start --seam-id requires a non-empty ID -crates/ripr/src/cli/agent.rs|agent start requires --seam-id target/ripr/workflow . -crates/ripr/src/cli/agent.rs|agent status --attempt requires a non-empty repair attempt ID -crates/ripr/src/cli/agent.rs|agent status --store requires a non-empty path -crates/ripr/src/cli/agent.rs|agent stub {flag} requires a non-empty value -crates/ripr/src/cli/agent.rs|agent verify --gap-id requires a non-empty ID -crates/ripr/src/cli/agent.rs|agent verify-execute requires --packet agent verify-execute requires --result-json . -crates/ripr/src/cli/agent.rs|agent verify-execute requires --result-json . -crates/ripr/src/cli/agent.rs|invalid --max-seams: maximum is {AGENT_BRIEF_HARD_MAX_SEAMS} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__command.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__command.rs.txt deleted file mode 100644 index 956b2f3b6c8..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__command.rs.txt +++ /dev/null @@ -1,3 +0,0 @@ -crates/ripr/src/cli/command.rs|usage: ripr help --all (this route accepts no other arguments) -crates/ripr/src/cli/command.rs|usage: ripr help --json (this route accepts no other arguments) -crates/ripr/src/cli/command.rs|usage: ripr help workflow [] (this route accepts no flags) diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__agent.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__agent.rs.txt deleted file mode 100644 index 82b3cb7a3b1..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__agent.rs.txt +++ /dev/null @@ -1,33 +0,0 @@ -crates/ripr/src/cli/commands/agent.rs|agent repair --edit-authorized/--edit-authority require an attempt whose before phase recorded a python repair -crates/ripr/src/cli/commands/agent.rs|agent status --out {} is not supported: a symlink before `..` resolves to a different directory than its spell -crates/ripr/src/cli/commands/agent.rs|agent status --out {} is not supported: agent status reads the workflow artifacts under {} -crates/ripr/src/cli/commands/agent.rs|agent verify JSON is missing before_content_sha256 -crates/ripr/src/cli/commands/agent.rs|backup missing inspect backup permissions failed: {error} -crates/ripr/src/cli/commands/agent.rs|create {} failed: {err} -crates/ripr/src/cli/commands/agent.rs|inspect backup permissions failed: {error} -crates/ripr/src/cli/commands/agent.rs|inspect {} failed: {error} -crates/ripr/src/cli/commands/agent.rs|inspect {} failed: {error} workflow artifact {} is not a regular file -crates/ripr/src/cli/commands/agent.rs|open {} failed: {error} -crates/ripr/src/cli/commands/agent.rs|parse rendered agent receipt failed: {error} -crates/ripr/src/cli/commands/agent.rs|parse rendered agent status JSON failed: {error} -crates/ripr/src/cli/commands/agent.rs|parse rendered agent verify JSON failed: {error} -crates/ripr/src/cli/commands/agent.rs|prepared before identity requires the before phase -crates/ripr/src/cli/commands/agent.rs|publish {} failed: {error} -crates/ripr/src/cli/commands/agent.rs|publish {} failed: {error} could not read {} to summarize the result: {error} -crates/ripr/src/cli/commands/agent.rs|read {} failed: {error} -crates/ripr/src/cli/commands/agent.rs|reinspect {} failed: {error} -crates/ripr/src/cli/commands/agent.rs|remove {} failed: {error} -crates/ripr/src/cli/commands/agent.rs|repair attempt `{}` cannot finish: HEAD {current_head} does not descend from its before-phase head {} -crates/ripr/src/cli/commands/agent.rs|repair attempt `{}` has spent its after-phase retry budget ({} refusals) -crates/ripr/src/cli/commands/agent.rs|resolve agent receipt --out root failed: {err} -crates/ripr/src/cli/commands/agent.rs|resolve shared workflow artifacts failed: {error}{previous} -crates/ripr/src/cli/commands/agent.rs|retained repair packet is not UTF-8: {error} -crates/ripr/src/cli/commands/agent.rs|serialize after-phase failure document failed: {error} -crates/ripr/src/cli/commands/agent.rs|serialize after-phase refusal document failed: {error} -crates/ripr/src/cli/commands/agent.rs|serialize bound agent receipt failed: {error} \n -crates/ripr/src/cli/commands/agent.rs|workflow artifact {} exceeds the edit-cage capture limit -crates/ripr/src/cli/commands/agent.rs|workflow artifact {} exceeds the edit-cage capture limit; leave it in place and inspect it before retrying -crates/ripr/src/cli/commands/agent.rs|workflow artifact {} is not a regular file -crates/ripr/src/cli/commands/agent.rs|workflow output {} exceeds capture limit of {} bytes -crates/ripr/src/cli/commands/agent.rs|workflow tracking missing -crates/ripr/src/cli/commands/agent.rs|{error}; rolling the attempt back for a retry also failed: {restore_error} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__agent_card.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__agent_card.rs.txt deleted file mode 100644 index 5dc9a311827..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__agent_card.rs.txt +++ /dev/null @@ -1 +0,0 @@ -crates/ripr/src/cli/commands/agent_card.rs|serialize agent card refusal document failed: {error} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__baseline.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__baseline.rs.txt deleted file mode 100644 index 69f55295104..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__baseline.rs.txt +++ /dev/null @@ -1,7 +0,0 @@ -crates/ripr/src/cli/commands/baseline.rs|baseline create requires --from -crates/ripr/src/cli/commands/baseline.rs|baseline diff requires --baseline baseline diff requires --current -- missing value for {flag} -crates/ripr/src/cli/commands/baseline.rs|baseline diff requires --current -- missing value for {flag} -crates/ripr/src/cli/commands/baseline.rs|baseline update requires --baseline baseline update requires --current -crates/ripr/src/cli/commands/baseline.rs|baseline update requires --current -crates/ripr/src/cli/commands/baseline.rs|baseline update requires --remove-resolved or --migrate-legacy-identities; adopting new debt is not supported -crates/ripr/src/cli/commands/baseline.rs|missing value for {flag} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__cache.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__cache.rs.txt deleted file mode 100644 index f27aab89cd8..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__cache.rs.txt +++ /dev/null @@ -1,20 +0,0 @@ -crates/ripr/src/cli/commands/cache.rs|cache export {arg} requires a path -crates/ripr/src/cli/commands/cache.rs|cache root {} is not an existing directory -crates/ripr/src/cli/commands/cache.rs|failed to get current dir: {error} -crates/ripr/src/cli/commands/cache.rs|failed to inspect cache layer {}: {error}; no files were removed -crates/ripr/src/cli/commands/cache.rs|failed to inspect cache path component {}: {error}; no files were removed -crates/ripr/src/cli/commands/cache.rs|failed to inspect {display}: {error} ok refusing to clear {}: cache layer `{name}` inspection is {}; no files -crates/ripr/src/cli/commands/cache.rs|refusing to clear {display}: a cache root must sit at least two directories below the filesystem root -crates/ripr/src/cli/commands/cache.rs|refusing to clear {display}: it contains a `..` or `.` component; \ set {CACHE_DIR_ENV} to an abs -crates/ripr/src/cli/commands/cache.rs|refusing to clear {display}: it is not a directory failed to inspect {display}: {error} ok refusing to clear { -crates/ripr/src/cli/commands/cache.rs|refusing to clear {display}: {resolved}; no files were removed -crates/ripr/src/cli/commands/cache.rs|refusing to clear {}: cache layer `{name}` inspection is {}; no files were removed -crates/ripr/src/cli/commands/cache.rs|refusing to clear {}: cache layer `{}` became a symlink; no further files were removed refusing to clear {}: c -crates/ripr/src/cli/commands/cache.rs|refusing to clear {}: cache layer `{}` changed after inspection ({error}); no further files were removed -crates/ripr/src/cli/commands/cache.rs|refusing to clear {}: cache layer `{}` is no longer a directory; no further files were removed refusing to cle -crates/ripr/src/cli/commands/cache.rs|refusing to clear {}: path component {} is a symlink; no files were removed -crates/ripr/src/cli/commands/cache.rs|refusing to clear {}: recognized cache layer `{marker}` is a symlink; no files were removed -crates/ripr/src/cli/commands/cache.rs|refusing to clear {}: recognized cache layer `{marker}` is not a directory; no files were removed -crates/ripr/src/cli/commands/cache.rs|resolve cache root {} failed: {error} -crates/ripr/src/cli/commands/cache.rs|resolve cache root {} failed: {error} resolve cache root {} failed: {error} -crates/ripr/src/cli/commands/cache.rs|{command} --root requires a path diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__capabilities.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__capabilities.rs.txt deleted file mode 100644 index e49c924a129..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__capabilities.rs.txt +++ /dev/null @@ -1 +0,0 @@ -crates/ripr/src/cli/commands/capabilities.rs|missing value for --language diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__check.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__check.rs.txt deleted file mode 100644 index b6b646c8d58..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__check.rs.txt +++ /dev/null @@ -1,5 +0,0 @@ -crates/ripr/src/cli/commands/check.rs|--output-dir requires a named --diff file and cannot be combined with --format/--json, --worktree/--committed, -crates/ripr/src/cli/commands/check.rs|RIPR_CHECK_TIMEOUT must be valid UTF-8 -crates/ripr/src/cli/commands/check.rs|failed to read gap ledger {}: {err} -crates/ripr/src/cli/commands/check.rs|resolve current directory failed: {error} -crates/ripr/src/cli/commands/check.rs|{source} is too large for the platform deadline; got {secs} seconds diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__check_fanout.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__check_fanout.rs.txt deleted file mode 100644 index 38ea8963b2d..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__check_fanout.rs.txt +++ /dev/null @@ -1,12 +0,0 @@ -crates/ripr/src/cli/commands/check_fanout.rs|--output-dir cannot capture Cargo input identity RIPR_CHECK_FINDINGS_BYTES -crates/ripr/src/cli/commands/check_fanout.rs|--output-dir input ancestry exceeds depth 64 -crates/ripr/src/cli/commands/check_fanout.rs|--output-dir input custody exceeds 128 MiB -crates/ripr/src/cli/commands/check_fanout.rs|--output-dir input directory depth exceeds 64 -crates/ripr/src/cli/commands/check_fanout.rs|--output-dir input inventory exceeds 16384 entries -crates/ripr/src/cli/commands/check_fanout.rs|--output-dir input inventory including auxiliary paths exceeds 16384 entries -crates/ripr/src/cli/commands/check_fanout.rs|--output-dir members plus manifest exceed 32 MiB; output set is incomplete -crates/ripr/src/cli/commands/check_fanout.rs|--output-dir must name a new directory; existing output sets are never replaced -crates/ripr/src/cli/commands/check_fanout.rs|--output-dir parent: {e} --output-dir requires a new directory name -crates/ripr/src/cli/commands/check_fanout.rs|--output-dir rendered output exceeds 32 MiB -crates/ripr/src/cli/commands/check_fanout.rs|--output-dir requires a new directory name -crates/ripr/src/cli/commands/check_fanout.rs|--output-dir requires regular input files: {} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__ci_packet.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__ci_packet.rs.txt deleted file mode 100644 index 59b674659c0..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__ci_packet.rs.txt +++ /dev/null @@ -1,22 +0,0 @@ -crates/ripr/src/cli/commands/ci_packet.rs|GITHUB_EVENT_PATH {event_path} is not JSON: {err} -crates/ripr/src/cli/commands/ci_packet.rs|`{shown}` could not run: {err} -crates/ripr/src/cli/commands/ci_packet.rs|a pull_request label is not an object name -crates/ripr/src/cli/commands/ci_packet.rs|cannot copy {from} to {to}: {err} -crates/ripr/src/cli/commands/ci_packet.rs|cannot create {relative}: {err} cannot copy {from} to {to}: {err} -crates/ripr/src/cli/commands/ci_packet.rs|cannot move the agent packet into place: {err} -crates/ripr/src/cli/commands/ci_packet.rs|cannot read GITHUB_EVENT_PATH {event_path}: {err} GITHUB_EVENT_PATH {event_path} is not JSON: {err} -crates/ripr/src/cli/commands/ci_packet.rs|cannot read {COMMENTS_JSON}: {err} -crates/ripr/src/cli/commands/ci_packet.rs|cannot render the diff receipt: {err} -crates/ripr/src/cli/commands/ci_packet.rs|cannot render the labels: {err} -crates/ripr/src/cli/commands/ci_packet.rs|cannot write target/ripr/reports/pr-diff.receipt.json: {err} -crates/ripr/src/cli/commands/ci_packet.rs|cannot write target/ripr/reports/pr.diff: {err} -crates/ripr/src/cli/commands/ci_packet.rs|cannot write {LABELS_JSON}: {err} -crates/ripr/src/cli/commands/ci_packet.rs|cannot write {out}: {err} -crates/ripr/src/cli/commands/ci_packet.rs|ripr: cannot resolve HEAD: {err} -crates/ripr/src/cli/commands/ci_packet.rs|ripr: empty patch but {changed} changed path(s); refusing an absent result -crates/ripr/src/cli/commands/ci_packet.rs|ripr: git diff --name-only failed for {range}: {err} -crates/ripr/src/cli/commands/ci_packet.rs|ripr: git diff failed for {range}: {err} -crates/ripr/src/cli/commands/ci_packet.rs|{COMMAND} cannot locate the running ripr binary: {err} -crates/ripr/src/cli/commands/ci_packet.rs|{COMMAND}: RIPR_PILOT_TIMEOUT_MS must be a positive integer of milliseconds; got {value:?} pilot --root . --ou -crates/ripr/src/cli/commands/ci_packet.rs|{COMMAND}: unknown --step {}; the steps are: {} , , -crates/ripr/src/cli/commands/ci_packet.rs|{COMMENTS_JSON} is not JSON: {err} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__ci_summary.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__ci_summary.rs.txt deleted file mode 100644 index 07e6d0fbe4a..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__ci_summary.rs.txt +++ /dev/null @@ -1 +0,0 @@ -crates/ripr/src/cli/commands/ci_summary.rs|{COMMAND} could not write the summary: {err} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__config.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__config.rs.txt deleted file mode 100644 index 027a7b623c0..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__config.rs.txt +++ /dev/null @@ -1 +0,0 @@ -crates/ripr/src/cli/commands/config.rs|missing value for --root diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__doctor.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__doctor.rs.txt deleted file mode 100644 index 3ccc20c88d2..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__doctor.rs.txt +++ /dev/null @@ -1,2 +0,0 @@ -crates/ripr/src/cli/commands/doctor.rs|missing value for --profile -crates/ripr/src/cli/commands/doctor.rs|missing value for --root diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__feedback.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__feedback.rs.txt deleted file mode 100644 index c8c6e50ef45..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__feedback.rs.txt +++ /dev/null @@ -1,2 +0,0 @@ -crates/ripr/src/cli/commands/feedback.rs|feedback identity is --snapshot and optional --item, not file/line; a current file/line cannot attach an old j -crates/ripr/src/cli/commands/feedback.rs|feedback record requires --reason diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__gate.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__gate.rs.txt deleted file mode 100644 index e780624862e..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__gate.rs.txt +++ /dev/null @@ -1,2 +0,0 @@ -crates/ripr/src/cli/commands/gate.rs|gate could not resolve --out-md: {err} -crates/ripr/src/cli/commands/gate.rs|gate could not resolve --out: {err} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__init.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__init.rs.txt deleted file mode 100644 index fc2dea9bffa..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__init.rs.txt +++ /dev/null @@ -1,7 +0,0 @@ -crates/ripr/src/cli/commands/init.rs|cannot inspect {}: {err} -crates/ripr/src/cli/commands/init.rs|cannot read existing {shown}: {err} -crates/ripr/src/cli/commands/init.rs|cannot write {}: {} exists and is not a directory -crates/ripr/src/cli/commands/init.rs|create {} failed: {err} -crates/ripr/src/cli/commands/init.rs|existing {shown} is not a JSON object; nothing was written mcpServers existing {shown} has a `mcpServers` that -crates/ripr/src/cli/commands/init.rs|render {shown} failed: {err} -crates/ripr/src/cli/commands/init.rs|write {} failed: {err} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__pilot.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__pilot.rs.txt deleted file mode 100644 index dcfe360c3bb..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__pilot.rs.txt +++ /dev/null @@ -1,4 +0,0 @@ -crates/ripr/src/cli/commands/pilot.rs|inspect leftover timeout packet file {} failed: {error} leftover timeout packet path {} is a directory; refusi -crates/ripr/src/cli/commands/pilot.rs|it did not finish within pilot's deadline no seam pilot analyzed -crates/ripr/src/cli/commands/pilot.rs|leftover timeout packet path {} is a directory; refusing to leave it as if it were this run's output remove le -crates/ripr/src/cli/commands/pilot.rs|write output {} failed: {err} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__policy__parse.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__policy__parse.rs.txt deleted file mode 100644 index cbb9dc40031..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__policy__parse.rs.txt +++ /dev/null @@ -1,6 +0,0 @@ -crates/ripr/src/cli/commands/policy/parse.rs|policy history requires --current -crates/ripr/src/cli/commands/policy/parse.rs|policy operations requires --policy-readiness -crates/ripr/src/cli/commands/policy/parse.rs|policy preview-promote requires --class -crates/ripr/src/cli/commands/policy/parse.rs|policy preview-promote requires --language -crates/ripr/src/cli/commands/policy/parse.rs|policy promote requires --operations -crates/ripr/src/cli/commands/policy/parse.rs|policy promote requires --to diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__policy__reports.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__policy__reports.rs.txt deleted file mode 100644 index 10909d4dc51..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__policy__reports.rs.txt +++ /dev/null @@ -1 +0,0 @@ -crates/ripr/src/cli/commands/policy/reports.rs|policy history --out-jsonl refuses to append when current policy operations are unavailable or malformed diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__pr_comments_github.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__pr_comments_github.rs.txt deleted file mode 100644 index 70004b1659a..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__pr_comments_github.rs.txt +++ /dev/null @@ -1,22 +0,0 @@ -crates/ripr/src/cli/commands/pr_comments_github.rs|{EXISTING} --out cannot contain a tab or line break -crates/ripr/src/cli/commands/pr_comments_github.rs|{EXISTING} --out must be a relative file path inside --root (got {}) -crates/ripr/src/cli/commands/pr_comments_github.rs|{EXISTING} could not create {}: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{EXISTING} could not read standard input: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{EXISTING} could not write {}: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{EXISTING}: standard input is not JSON: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{REQUESTS} could not create {}: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{REQUESTS} could not read {}: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{SUMMARY} could not create {}: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{SUMMARY} could not read standard input: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{SUMMARY} could not remove {}: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{SUMMARY}: standard input is not JSON: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{command} --out-dir cannot contain a tab or line break: the request manifest is tab-separated -crates/ripr/src/cli/commands/pr_comments_github.rs|{command} --out-dir must be a relative directory inside --root (got {}); the run replaces its request files -crates/ripr/src/cli/commands/pr_comments_github.rs|{command} could not create {}: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{command} could not inspect {}: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{command} could not read {}: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{command} could not render {}: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{command} could not write {}: {err} -crates/ripr/src/cli/commands/pr_comments_github.rs|{command} could not write {}: {err} --out-dir the run replaces request files there -crates/ripr/src/cli/commands/pr_comments_github.rs|{command} {flag} cannot pass through a link ({} is one); {why} -crates/ripr/src/cli/commands/pr_comments_github.rs|{command}: {} is not JSON: {err} {command} could not create {}: {err} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__receipt.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__receipt.rs.txt deleted file mode 100644 index 39f1c165f37..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__receipt.rs.txt +++ /dev/null @@ -1,9 +0,0 @@ -crates/ripr/src/cli/commands/receipt.rs|create {} failed: {err} -crates/ripr/src/cli/commands/receipt.rs|receipt check --gap requires a non-empty canonical_gap_id -crates/ripr/src/cli/commands/receipt.rs|receipt check --ledger requires a non-empty path to a gap-decision-ledger JSON file -crates/ripr/src/cli/commands/receipt.rs|receipt check --path requires a non-empty path -crates/ripr/src/cli/commands/receipt.rs|receipt cross-reference failed: {} -crates/ripr/src/cli/commands/receipt.rs|receipt requires --status (passed|failed|not_run|unknown) -crates/ripr/src/cli/commands/receipt.rs|receipt write --out requires a non-empty path -crates/ripr/src/cli/commands/receipt.rs|receipt write --packet requires a non-empty packet ID -crates/ripr/src/cli/commands/receipt.rs|receipt write requires --verify-command diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__review_comments.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__review_comments.rs.txt deleted file mode 100644 index d0cfeef3826..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__review_comments.rs.txt +++ /dev/null @@ -1,13 +0,0 @@ -crates/ripr/src/cli/commands/review_comments.rs|review-comments --check-output {} is invalid: analysis_complete does not match typed outcome kind -crates/ripr/src/cli/commands/review_comments.rs|review-comments --check-output {} is invalid: analysis_outcome is null -crates/ripr/src/cli/commands/review_comments.rs|review-comments --check-output {} is invalid: missing analysis_outcome -crates/ripr/src/cli/commands/review_comments.rs|review-comments --check-output {} is invalid: producer base does not match requested base -crates/ripr/src/cli/commands/review_comments.rs|review-comments --check-output {} is invalid: producer envelope is missing string field {field} -crates/ripr/src/cli/commands/review_comments.rs|review-comments --check-output {} is invalid: producer envelope requires summary and findings -crates/ripr/src/cli/commands/review_comments.rs|review-comments --check-output {} is invalid: producer input identity does not match the requested diff -crates/ripr/src/cli/commands/review_comments.rs|review-comments --check-output {} is invalid: producer root does not match requested root -crates/ripr/src/cli/commands/review_comments.rs|review-comments --check-output {} is invalid: producer tool must be ripr -crates/ripr/src/cli/commands/review_comments.rs|review-comments --check-output {} is invalid: typed outcome base revision does not match requested base -crates/ripr/src/cli/commands/review_comments.rs|{env_name} must be a positive integer -crates/ripr/src/cli/commands/review_comments.rs|{env_name} must be a positive integer: {err} -crates/ripr/src/cli/commands/review_comments.rs|{env_name} must be valid UTF-8 diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__swarm__ingest.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__swarm__ingest.rs.txt deleted file mode 100644 index c3d1117e6b7..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__swarm__ingest.rs.txt +++ /dev/null @@ -1,4 +0,0 @@ -crates/ripr/src/cli/commands/swarm/ingest.rs|swarm ingest --result requires a non-empty path -crates/ripr/src/cli/commands/swarm/ingest.rs|swarm ingest --result {} must stay under root {} -crates/ripr/src/cli/commands/swarm/ingest.rs|swarm ingest --root requires a non-empty path -crates/ripr/src/cli/commands/swarm/ingest.rs|swarm ingest requires --result swarm ingest diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__swarm__queue.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__swarm__queue.rs.txt deleted file mode 100644 index 3e165cdbacc..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__swarm__queue.rs.txt +++ /dev/null @@ -1,3 +0,0 @@ -crates/ripr/src/cli/commands/swarm/queue.rs|swarm queue --gap-ledger requires a non-empty path -crates/ripr/src/cli/commands/swarm/queue.rs|swarm queue --language requires a non-empty language -crates/ripr/src/cli/commands/swarm/queue.rs|swarm queue --root requires a non-empty path diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__task_first.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands__task_first.rs.txt deleted file mode 100644 index 9a803fa9b5e..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands__task_first.rs.txt +++ /dev/null @@ -1,4 +0,0 @@ -crates/ripr/src/cli/commands/task_first.rs|continue --attempt requires a non-empty ID -crates/ripr/src/cli/commands/task_first.rs|repair requires a non-empty --base -crates/ripr/src/cli/commands/task_first.rs|repair requires a non-empty item -crates/ripr/src/cli/commands/task_first.rs|status --attempt requires a non-empty ID diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands_agent_support.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands_agent_support.rs.txt deleted file mode 100644 index b20e98d6d6b..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands_agent_support.rs.txt +++ /dev/null @@ -1,7 +0,0 @@ -crates/ripr/src/cli/commands_agent_support.rs|agent brief --diff {} must stay under root {} -crates/ripr/src/cli/commands_agent_support.rs|agent brief --files {} must stay under root {} -crates/ripr/src/cli/commands_agent_support.rs|agent receipt --verify-json {} must stay under root {} -crates/ripr/src/cli/commands_agent_support.rs|agent receipt {role} {} must stay under root {} -crates/ripr/src/cli/commands_agent_support.rs|agent verify {flag} {} must stay under root {} -crates/ripr/src/cli/commands_agent_support.rs|read {} failed: {err} read {} failed: {err} system clock before unix epoch: {err} -crates/ripr/src/cli/commands_agent_support.rs|read {} failed: {err} system clock before unix epoch: {err} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands_context.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands_context.rs.txt deleted file mode 100644 index ea9ed5fc42c..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands_context.rs.txt +++ /dev/null @@ -1,2 +0,0 @@ -crates/ripr/src/cli/commands_context.rs|flush stdout failed: {err} -crates/ripr/src/cli/commands_context.rs|write to stdout failed: {err} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__commands_numeric.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__commands_numeric.rs.txt deleted file mode 100644 index 70ba826e29d..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__commands_numeric.rs.txt +++ /dev/null @@ -1,2 +0,0 @@ -crates/ripr/src/cli/commands_numeric.rs|{flag} requires a non-negative integer; got {value:?} -crates/ripr/src/cli/commands_numeric.rs|{flag} requires a positive integer; got {value:?} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__help_json.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__help_json.rs.txt deleted file mode 100644 index 0c348c48226..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__help_json.rs.txt +++ /dev/null @@ -1,3 +0,0 @@ -crates/ripr/src/cli/help_json.rs|help --json catalog integrity failed: {violations:?} -crates/ripr/src/cli/help_json.rs|help --json digest serialization failed: {error} -crates/ripr/src/cli/help_json.rs|help --json serialization failed: {error} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__interrupt.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__interrupt.rs.txt deleted file mode 100644 index a89aa002ae3..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__interrupt.rs.txt +++ /dev/null @@ -1,18 +0,0 @@ -crates/ripr/src/cli/interrupt.rs|SIGINT after Drop unexpectedly returned first_sigint_requests_cancellation_then_arms_native_termination -crates/ripr/src/cli/interrupt.rs|cannot observe signal {signal}: {error} -crates/ripr/src/cli/interrupt.rs|cannot preserve native signal {signal}: {error} -crates/ripr/src/cli/interrupt.rs|check: cannot arm forced SIGINT: {error} -crates/ripr/src/cli/interrupt.rs|check: cannot observe SIGINT: {error} -crates/ripr/src/cli/interrupt.rs|check: cannot preserve native SIGINT: {error} -crates/ripr/src/cli/interrupt.rs|child {} poll failed: {error}; cleanup: {cleanup:?}; log {} -crates/ripr/src/cli/interrupt.rs|config_invalid -crates/ripr/src/cli/interrupt.rs|config_invalid cancelled config_invalid -crates/ripr/src/cli/interrupt.rs|mixed server signal repeat unexpectedly returned repeated_server_sigterm_takes_native_death -crates/ripr/src/cli/interrupt.rs|repeated SIGINT unexpectedly returned sigint_after_drop_takes_native_death -crates/ripr/src/cli/interrupt.rs|server SIGTERM repeat unexpectedly returned server_interrupt_install_is_idempotent_and_exposes_flags -crates/ripr/src/cli/interrupt.rs|server flag missing -crates/ripr/src/cli/interrupt.rs|server installer failed -crates/ripr/src/cli/interrupt.rs|signal child output exceeds {OUTPUT_LIMIT} bytes: {} -crates/ripr/src/cli/interrupt.rs|signal child {case}: status={}, timed_out={}, missing/wrong stage {stage}: {} -crates/ripr/src/cli/interrupt.rs|unknown flag must fail closed -crates/ripr/src/cli/interrupt.rs|unregistered SIGINT unexpectedly returned diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__mod.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__mod.rs.txt deleted file mode 100644 index 6297f1f074c..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__mod.rs.txt +++ /dev/null @@ -1,9 +0,0 @@ -crates/ripr/src/cli/mod.rs|agent packet is not UTF-8: {error} -crates/ripr/src/cli/mod.rs|before-phase repair attempt is missing its seam identity -crates/ripr/src/cli/mod.rs|create {} failed: {error} -crates/ripr/src/cli/mod.rs|lock {} failed: {error} -crates/ripr/src/cli/mod.rs|parse {} failed: {error} -crates/ripr/src/cli/mod.rs|read {} failed: {error} -crates/ripr/src/cli/mod.rs|usage: ripr help --json (this route accepts no other arguments) -crates/ripr/src/cli/mod.rs|{error} No repair attempt was started. -crates/ripr/src/cli/mod.rs|{original}; failed to restore prior workflow artifacts: {restore_error} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__parse__value.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__parse__value.rs.txt deleted file mode 100644 index a984888148c..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__parse__value.rs.txt +++ /dev/null @@ -1 +0,0 @@ -crates/ripr/src/cli/parse/value.rs|missing value for {flag} diff --git a/policy/refusal-next-step.d/crates__ripr__src__cli__rerun.rs.txt b/policy/refusal-next-step.d/crates__ripr__src__cli__rerun.rs.txt deleted file mode 100644 index dcd36da520c..00000000000 --- a/policy/refusal-next-step.d/crates__ripr__src__cli__rerun.rs.txt +++ /dev/null @@ -1,6 +0,0 @@ -crates/ripr/src/cli/rerun.rs|create {} failed: {err} -crates/ripr/src/cli/rerun.rs|rerun --changed-test requires a file path -crates/ripr/src/cli/rerun.rs|rerun --changed-test test node must not be empty -crates/ripr/src/cli/rerun.rs|rerun --gap-ledger requires --gap -crates/ripr/src/cli/rerun.rs|rerun requires --changed-test or --gap --gap-ledger -crates/ripr/src/cli/rerun.rs|write {} failed: {err} State: {} Selector: {} Selected tests: {} Direct call names: {} , File-fact cache: {} From 2f68f86b74158e66a02b9dcb67c0c43e24ac79a6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 31 Oct 2026 15:40:31 +0000 Subject: [PATCH 2/4] docs(changelog): add the CLI refusal fragment Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01SvmPmp1dk37XMDiDt4z11j --- changelog.d/11539-refusal-next-step-cli.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog.d/11539-refusal-next-step-cli.md diff --git a/changelog.d/11539-refusal-next-step-cli.md b/changelog.d/11539-refusal-next-step-cli.md new file mode 100644 index 00000000000..f3d5e4e1f9a --- /dev/null +++ b/changelog.d/11539-refusal-next-step-cli.md @@ -0,0 +1,2 @@ + +- CLI refusal and argument errors (agent, check, gate, baseline, cache, config, doctor, init, pilot, receipt, policy, swarm and related commands) now name the next step to take, and their baseline entries in `policy/refusal-next-step.d/` are removed (#11713). From 6268a7b3a4a88df3c4ecbd279a3fba912541e8ac Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 31 Oct 2026 19:49:57 +0000 Subject: [PATCH 3/4] test(cli): update exact-message assertions to the refusals that now name a next step (#11539) Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01SvmPmp1dk37XMDiDt4z11j --- crates/ripr/src/cli/agent.rs | 27 ++++++++++--------- crates/ripr/src/cli/commands.rs | 20 +++++++------- crates/ripr/src/cli/commands/check.rs | 8 +++--- .../cli/commands/check_argv_refusal_tests.rs | 7 ++--- crates/ripr/src/cli/commands/context.rs | 8 +++--- crates/ripr/src/cli/commands/pilot.rs | 10 +++---- .../ripr/src/cli/commands/review_comments.rs | 2 +- crates/ripr/src/cli/commands/swarm/ingest.rs | 4 +-- crates/ripr/src/cli/execute.rs | 22 +++++++-------- crates/ripr/src/cli/mod.rs | 8 +++--- crates/ripr/src/cli/parse.rs | 2 +- crates/ripr/tests/cli_help_hierarchy.rs | 14 +++++++--- crates/ripr/tests/cli_smoke.rs | 2 +- .../tests/cli_smoke/cli_value_contracts.rs | 2 +- 14 files changed, 73 insertions(+), 63 deletions(-) diff --git a/crates/ripr/src/cli/agent.rs b/crates/ripr/src/cli/agent.rs index be155cb2065..dc018f51adb 100644 --- a/crates/ripr/src/cli/agent.rs +++ b/crates/ripr/src/cli/agent.rs @@ -2318,11 +2318,11 @@ mod tests { ); assert_eq!( parse_agent_start_options(&args(&["--seam-id"])), - Err("missing value for --seam-id".to_string()) + Err("missing value for --seam-id; pass a value right after it".to_string()) ); assert_eq!( parse_agent_start_options(&args(&["--out"])), - Err("missing value for --out".to_string()) + Err("missing value for --out; pass a value right after it".to_string()) ); assert_eq!( parse_agent_start_options(&args(&["--seam-id", "abc", "--out", ""])), @@ -2468,23 +2468,23 @@ mod tests { ); assert_eq!( parse_agent_brief_options(&args(&["--diff"])), - Err("missing value for --diff".to_string()) + Err("missing value for --diff; pass a value right after it".to_string()) ); assert_eq!( parse_agent_brief_options(&args(&["--base"])), - Err("missing value for --base".to_string()) + Err("missing value for --base; pass a value right after it".to_string()) ); assert_eq!( parse_agent_brief_options(&args(&["--files"])), - Err("missing value for --files".to_string()) + Err("missing value for --files; pass a value right after it".to_string()) ); assert_eq!( parse_agent_brief_options(&args(&["--seam-id"])), - Err("missing value for --seam-id".to_string()) + Err("missing value for --seam-id; pass a value right after it".to_string()) ); assert_eq!( parse_agent_brief_options(&args(&["--max-seams"])), - Err("missing value for --max-seams".to_string()) + Err("missing value for --max-seams; pass a value right after it".to_string()) ); } @@ -2765,7 +2765,7 @@ mod tests { "--gap-id", ])) .map(|options| options.gap_id), - Err("missing value for --gap-id".to_string()) + Err("missing value for --gap-id; pass a value right after it".to_string()) ); } @@ -3201,19 +3201,22 @@ mod tests { fn agent_stub_rejects_blank_missing_and_malformed_selector_values() { assert_eq!( parse_agent_stub_options(&args(&["--seam-id", " "])), - Err("agent stub --seam-id requires a non-empty value".to_string()) + Err("agent stub --seam-id requires a non-empty value; pass a value right after --seam-id".to_string()) ); assert_eq!( parse_agent_stub_options(&args(&["--at", ""])), - Err("agent stub --at requires a non-empty value".to_string()) + Err( + "agent stub --at requires a non-empty value; pass a value right after --at" + .to_string() + ) ); assert_eq!( parse_agent_stub_options(&args(&["--at"])), - Err("missing value for --at".to_string()) + Err("missing value for --at; pass a value right after it".to_string()) ); assert_eq!( parse_agent_stub_options(&args(&["--kind"])), - Err("missing value for --kind".to_string()) + Err("missing value for --kind; pass a value right after it".to_string()) ); assert_eq!( parse_agent_stub_options(&args(&["--at", "src/lib.rs"])), diff --git a/crates/ripr/src/cli/commands.rs b/crates/ripr/src/cli/commands.rs index f5a82541eb9..eba9e8c56f4 100644 --- a/crates/ripr/src/cli/commands.rs +++ b/crates/ripr/src/cli/commands.rs @@ -3835,15 +3835,15 @@ mod tests { ); assert_eq!( reports(&args(&["gap-ledger", "--records"])), - Err("missing value for --records".to_string()) + Err("missing value for --records; pass a value right after it".to_string()) ); assert_eq!( reports(&args(&["gap-ledger", "--repo-exposure"])), - Err("missing value for --repo-exposure".to_string()) + Err("missing value for --repo-exposure; pass a value right after it".to_string()) ); assert_eq!( reports(&args(&["gap-ledger", "--check-output"])), - Err("missing value for --check-output".to_string()) + Err("missing value for --check-output; pass a value right after it".to_string()) ); assert_eq!( reports(&args(&[ @@ -3904,7 +3904,7 @@ mod tests { ); assert_eq!( reports(&args(&["ts-limitations", "--check-output"])), - Err("missing value for --check-output".to_string()) + Err("missing value for --check-output; pass a value right after it".to_string()) ); } @@ -3984,7 +3984,7 @@ mod tests { ); assert_eq!( reports(&args(&["ts-false-actionable", "--corpus"])), - Err("missing value for --corpus".to_string()) + Err("missing value for --corpus; pass a value right after it".to_string()) ); } @@ -7882,7 +7882,7 @@ language = "rust" ); assert_eq!( init(&args(&["--ci"])), - Err("missing value for --ci".to_string()) + Err("missing value for --ci; pass a value right after it".to_string()) ); } @@ -8962,19 +8962,19 @@ language = "rust" ); assert_eq!( explain(&args(&["--base"])), - Err("missing value for --base".to_string()) + Err("missing value for --base; pass a value right after it".to_string()) ); assert_eq!( explain(&args(&["--diff"])), - Err("missing value for --diff".to_string()) + Err("missing value for --diff; pass a value right after it".to_string()) ); assert_eq!( explain(&args(&["--perl-facts"])), - Err("missing value for --perl-facts".to_string()) + Err("missing value for --perl-facts; pass a value right after it".to_string()) ); assert_eq!( explain(&args(&["--suppression-policy"])), - Err("missing value for --suppression-policy".to_string()) + Err("missing value for --suppression-policy; pass a value right after it".to_string()) ); } diff --git a/crates/ripr/src/cli/commands/check.rs b/crates/ripr/src/cli/commands/check.rs index 44aa256b9d1..81b0c640174 100644 --- a/crates/ripr/src/cli/commands/check.rs +++ b/crates/ripr/src/cli/commands/check.rs @@ -3318,11 +3318,11 @@ mod tests { fn check_requires_values_for_value_flags() { assert_eq!( check(&args(&["--diff"])), - Err("missing value for --diff".to_string()) + Err("missing value for --diff; pass a value right after it".to_string()) ); assert_eq!( check(&args(&["--mode"])), - Err("missing value for --mode".to_string()) + Err("missing value for --mode; pass a value right after it".to_string()) ); } @@ -3415,11 +3415,11 @@ mod tests { ); assert_eq!( check(&args(&["--base"])), - Err("missing value for --base".to_string()) + Err("missing value for --base; pass a value right after it".to_string()) ); assert_eq!( check(&args(&["--format"])), - Err("missing value for --format".to_string()) + Err("missing value for --format; pass a value right after it".to_string()) ); } } diff --git a/crates/ripr/src/cli/commands/check_argv_refusal_tests.rs b/crates/ripr/src/cli/commands/check_argv_refusal_tests.rs index 6ef1e84c251..c78fdf2532c 100644 --- a/crates/ripr/src/cli/commands/check_argv_refusal_tests.rs +++ b/crates/ripr/src/cli/commands/check_argv_refusal_tests.rs @@ -93,7 +93,8 @@ fn output_dir_refuses_every_conflicting_interface_before_touching_disk() -> Resu }; let want = "--output-dir requires a named --diff file and cannot be combined with \ --format/--json, --worktree/--committed, --candidate-tree/--candidate-base, \ - --gap-ledger, --write-artifact or --suppression-policy"; + --gap-ledger, --write-artifact or --suppression-policy; pass a named `--diff ` \ + and drop the other flags"; if error != want { return Err(format!( "{extra:?} refusal must name the conflict, got {error}" @@ -459,7 +460,7 @@ fn check_timeout_environment_is_a_fallback_and_fails_closed() -> Result<(), Stri assert_eq!( error, format!( - "RIPR_CHECK_TIMEOUT is too large for the platform deadline; got {} seconds", + "RIPR_CHECK_TIMEOUT is too large for the platform deadline; got {} seconds; pass a smaller number of seconds", u64::MAX ) ); @@ -494,7 +495,7 @@ fn timeout_flags_name_their_own_source_when_refused() -> Result<(), String> { .ok_or("an overflowing --git-timeout must fail closed")?; assert_eq!( error, - "--git-timeout is too large for the platform deadline; got 18446744073709551615 seconds" + "--git-timeout is too large for the platform deadline; got 18446744073709551615 seconds; pass a smaller number of seconds" ); Ok(()) } diff --git a/crates/ripr/src/cli/commands/context.rs b/crates/ripr/src/cli/commands/context.rs index 5169a4a1a4a..2669c5a5210 100644 --- a/crates/ripr/src/cli/commands/context.rs +++ b/crates/ripr/src/cli/commands/context.rs @@ -499,11 +499,11 @@ mod tests { fn context_requires_values_for_value_flags() { assert_eq!( context(&args(&["--at"])), - Err("missing value for --at".to_string()) + Err("missing value for --at; pass a value right after it".to_string()) ); assert_eq!( context(&args(&["--finding"])), - Err("missing value for --finding".to_string()) + Err("missing value for --finding; pass a value right after it".to_string()) ); assert_eq!( context(&args(&["--root"])), @@ -511,11 +511,11 @@ mod tests { ); assert_eq!( context(&args(&["--perl-facts"])), - Err("missing value for --perl-facts".to_string()) + Err("missing value for --perl-facts; pass a value right after it".to_string()) ); assert_eq!( context(&args(&["--suppression-policy"])), - Err("missing value for --suppression-policy".to_string()) + Err("missing value for --suppression-policy; pass a value right after it".to_string()) ); } diff --git a/crates/ripr/src/cli/commands/pilot.rs b/crates/ripr/src/cli/commands/pilot.rs index ddf4e2e7c71..c9358019801 100644 --- a/crates/ripr/src/cli/commands/pilot.rs +++ b/crates/ripr/src/cli/commands/pilot.rs @@ -1404,23 +1404,23 @@ mod tests { ); assert_eq!( pilot(&args(&["--out"])), - Err("missing value for --out".to_string()) + Err("missing value for --out; pass a value right after it".to_string()) ); assert_eq!( pilot(&args(&["--mode"])), - Err("missing value for --mode".to_string()) + Err("missing value for --mode; pass a value right after it".to_string()) ); assert_eq!( pilot(&args(&["--max-seams"])), - Err("missing value for --max-seams".to_string()) + Err("missing value for --max-seams; pass a value right after it".to_string()) ); assert_eq!( pilot(&args(&["--timeout-ms"])), - Err("missing value for --timeout-ms".to_string()) + Err("missing value for --timeout-ms; pass a value right after it".to_string()) ); assert_eq!( pilot(&args(&["--format"])), - Err("missing value for --format".to_string()) + Err("missing value for --format; pass a value right after it".to_string()) ); } diff --git a/crates/ripr/src/cli/commands/review_comments.rs b/crates/ripr/src/cli/commands/review_comments.rs index 1097c29b53c..63ef198fb8d 100644 --- a/crates/ripr/src/cli/commands/review_comments.rs +++ b/crates/ripr/src/cli/commands/review_comments.rs @@ -1366,7 +1366,7 @@ mod tests { ); assert_eq!( parse_review_comments_options(&args(&["--base"])), - Err("missing value for --base".to_string()) + Err("missing value for --base; pass a value right after it".to_string()) ); } diff --git a/crates/ripr/src/cli/commands/swarm/ingest.rs b/crates/ripr/src/cli/commands/swarm/ingest.rs index e59008abfa8..5195b5dc7a0 100644 --- a/crates/ripr/src/cli/commands/swarm/ingest.rs +++ b/crates/ripr/src/cli/commands/swarm/ingest.rs @@ -191,7 +191,7 @@ mod tests { ); assert_eq!( parse(&["--result"]), - Err("missing value for --result".to_string()) + Err("missing value for --result; pass a value right after it".to_string()) ); assert_eq!( parse(&["--result", "r.json", "--root"]), @@ -199,7 +199,7 @@ mod tests { ); assert_eq!( parse(&["--result", "r.json", "--format"]), - Err("missing value for --format".to_string()) + Err("missing value for --format; pass a value right after it".to_string()) ); } diff --git a/crates/ripr/src/cli/execute.rs b/crates/ripr/src/cli/execute.rs index 32e1a0188bd..3e563004c56 100644 --- a/crates/ripr/src/cli/execute.rs +++ b/crates/ripr/src/cli/execute.rs @@ -163,7 +163,7 @@ mod tests { assert_eq!( execute(CliCommand::ReviewComments(args(&["--base"]))), Err(CommandError::Failure( - "missing value for --base".to_string() + "missing value for --base; pass a value right after it".to_string() )) ); assert_eq!( @@ -173,25 +173,25 @@ mod tests { assert_eq!( execute(CliCommand::Baseline(args(&["create", "--from"]))), Err(CommandError::Failure( - "missing value for --from".to_string() + "missing value for --from; pass a value right after it".to_string() )) ); assert_eq!( execute(CliCommand::Zero(args(&["status", "--delta"]))), Err(CommandError::Failure( - "missing value for --delta".to_string() + "missing value for --delta; pass a value right after it".to_string() )) ); assert_eq!( execute(CliCommand::PrLedger(args(&["record", "--pr-number"]))), Err(CommandError::Failure( - "missing value for --pr-number".to_string() + "missing value for --pr-number; pass a value right after it".to_string() )) ); assert_eq!( execute(CliCommand::PrComments(args(&["plan", "--mode"]))), Err(CommandError::Failure( - "missing value for --mode".to_string() + "missing value for --mode; pass a value right after it".to_string() )) ); assert_eq!( @@ -200,37 +200,37 @@ mod tests { "--first-action" ]))), Err(CommandError::Failure( - "missing value for --first-action".to_string() + "missing value for --first-action; pass a value right after it".to_string() )) ); assert_eq!( execute(CliCommand::CoverageGrip(args(&["frontier", "--ledger"]))), Err(CommandError::Failure( - "missing value for --ledger".to_string() + "missing value for --ledger; pass a value right after it".to_string() )) ); assert_eq!( execute(CliCommand::AssistantLoop(args(&["proof", "--pr-guidance"]))), Err(CommandError::Failure( - "missing value for --pr-guidance".to_string() + "missing value for --pr-guidance; pass a value right after it".to_string() )) ); assert_eq!( execute(CliCommand::FirstPr(args(&["--gap-ledger"]))), Err(CommandError::Failure( - "missing value for --gap-ledger".to_string() + "missing value for --gap-ledger; pass a value right after it".to_string() )) ); assert_eq!( execute(CliCommand::FirstAction(args(&["--pr-guidance"]))), Err(CommandError::Failure( - "missing value for --pr-guidance".to_string() + "missing value for --pr-guidance; pass a value right after it".to_string() )) ); assert_eq!( execute(CliCommand::Reports(args(&["index", "--reports-dir"]))), Err(CommandError::Failure( - "missing value for --reports-dir".to_string() + "missing value for --reports-dir; pass a value right after it".to_string() )) ); assert_eq!( diff --git a/crates/ripr/src/cli/mod.rs b/crates/ripr/src/cli/mod.rs index aec6d909870..6952cb41f91 100644 --- a/crates/ripr/src/cli/mod.rs +++ b/crates/ripr/src/cli/mod.rs @@ -1155,19 +1155,19 @@ mod tests { assert_eq!( run(args(&["ripr", "first-pr", "--gap-ledger"])), Err(CommandError::Failure( - "missing value for --gap-ledger".to_string() + "missing value for --gap-ledger; pass a value right after it".to_string() )) ); assert_eq!( run(args(&["ripr", "start-here", "--gap-ledger"])), Err(CommandError::Failure( - "missing value for --gap-ledger".to_string() + "missing value for --gap-ledger; pass a value right after it".to_string() )) ); assert_eq!( run(args(&["ripr", "first-action", "--assistant-proof"])), Err(CommandError::Failure( - "missing value for --assistant-proof".to_string() + "missing value for --assistant-proof; pass a value right after it".to_string() )) ); } @@ -1196,7 +1196,7 @@ mod tests { assert_eq!( run(args(&["ripr", "check", "--base", "-v"])), Err(CommandError::Failure( - "missing value for --base".to_string() + "missing value for --base; pass a value right after it".to_string() )) ); } diff --git a/crates/ripr/src/cli/parse.rs b/crates/ripr/src/cli/parse.rs index ec94db66ea9..d417f0dab85 100644 --- a/crates/ripr/src/cli/parse.rs +++ b/crates/ripr/src/cli/parse.rs @@ -411,7 +411,7 @@ mod tests { let when_value_is_missing = expect_value(&values, 2, "--diff"); assert_eq!( when_value_is_missing, - Err("missing value for --diff".to_string()) + Err("missing value for --diff; pass a value right after it".to_string()) ); } diff --git a/crates/ripr/tests/cli_help_hierarchy.rs b/crates/ripr/tests/cli_help_hierarchy.rs index 4215f0dba5b..4727b94a5f9 100644 --- a/crates/ripr/tests/cli_help_hierarchy.rs +++ b/crates/ripr/tests/cli_help_hierarchy.rs @@ -52,7 +52,7 @@ fn init_ci_provider_errors_recover_near_misses() -> Result<(), String> { assert!(missing.stdout.is_empty()); assert_eq!( String::from_utf8_lossy(&missing.stderr).replace("\r\n", "\n"), - "ripr: missing value for --ci\n" + "ripr: missing value for --ci; pass a value right after it\n" ); Ok(()) } @@ -112,7 +112,7 @@ fn agent_repair_phase_refusals_render_scoped_recovery_without_writes() -> Result assert!(missing.stdout.is_empty()); assert_eq!( String::from_utf8_lossy(&missing.stderr).replace("\r\n", "\n"), - "ripr: missing value for --phase\n" + "ripr: missing value for --phase; pass a value right after it\n" ); let help = run_ripr_in( &["agent", "repair", "--phase", "befor", "--help"], @@ -147,8 +147,14 @@ fn agent_repair_default_and_later_phase_selectors_match_help() -> Result<(), Str } assert_eq!(implicit.stderr, explicit.stderr); for (phase, expected) in [ - ("after", "requires --attempt or --seam-id "), - ("verify", "requires --attempt "), + ( + "after", + "requires --attempt or --seam-id ; pass the attempt ID the before phase printed, or the seam ID", + ), + ( + "verify", + "requires --attempt ; add `--attempt ` to the command", + ), ] { let output = run_ripr_in(&["agent", "repair", "--phase", phase], Some(root))?; assert_eq!(output.status.code(), Some(2), "{phase}: {output:?}"); diff --git a/crates/ripr/tests/cli_smoke.rs b/crates/ripr/tests/cli_smoke.rs index 361c77192b0..3b1e26a1212 100644 --- a/crates/ripr/tests/cli_smoke.rs +++ b/crates/ripr/tests/cli_smoke.rs @@ -13480,7 +13480,7 @@ fn config_validate_does_not_consume_root_flag_as_a_path() -> Result<(), String> assert!(output.stdout.is_empty(), "args: {args:?}"); assert_eq!( String::from_utf8_lossy(&output.stderr).trim(), - "ripr: missing value for --root", + "ripr: missing value for --root; pass a value right after it", "args: {args:?}" ); } diff --git a/crates/ripr/tests/cli_smoke/cli_value_contracts.rs b/crates/ripr/tests/cli_smoke/cli_value_contracts.rs index fe361797192..7fa11e78eb8 100644 --- a/crates/ripr/tests/cli_smoke/cli_value_contracts.rs +++ b/crates/ripr/tests/cli_smoke/cli_value_contracts.rs @@ -26,7 +26,7 @@ fn diff_format_errors_preserve_exit_and_suggestions() { } assert_usage_error( run_ripr(&["diff", "--format"]), - "missing value for --format", + "missing value for --format; pass a value right after it", ); } From a129c933b6a641e9f4673d989fd55d05f47e9d49 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 31 Oct 2026 20:11:39 +0000 Subject: [PATCH 4/4] test(cli): keep the first-pr --gap-ledger expectation on its own PR's wording (#11539) first-pr option errors are reworded in the output-layer PR, which updates these two expectations. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01SvmPmp1dk37XMDiDt4z11j --- crates/ripr/src/cli/execute.rs | 2 +- crates/ripr/src/cli/mod.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ripr/src/cli/execute.rs b/crates/ripr/src/cli/execute.rs index 3e563004c56..18bfbe29cc0 100644 --- a/crates/ripr/src/cli/execute.rs +++ b/crates/ripr/src/cli/execute.rs @@ -218,7 +218,7 @@ mod tests { assert_eq!( execute(CliCommand::FirstPr(args(&["--gap-ledger"]))), Err(CommandError::Failure( - "missing value for --gap-ledger; pass a value right after it".to_string() + "missing value for --gap-ledger".to_string() )) ); assert_eq!( diff --git a/crates/ripr/src/cli/mod.rs b/crates/ripr/src/cli/mod.rs index 6952cb41f91..a7c0e2bc2ee 100644 --- a/crates/ripr/src/cli/mod.rs +++ b/crates/ripr/src/cli/mod.rs @@ -1155,13 +1155,13 @@ mod tests { assert_eq!( run(args(&["ripr", "first-pr", "--gap-ledger"])), Err(CommandError::Failure( - "missing value for --gap-ledger; pass a value right after it".to_string() + "missing value for --gap-ledger".to_string() )) ); assert_eq!( run(args(&["ripr", "start-here", "--gap-ledger"])), Err(CommandError::Failure( - "missing value for --gap-ledger; pass a value right after it".to_string() + "missing value for --gap-ledger".to_string() )) ); assert_eq!(