Skip to content

fix(cli): refuse a mistyped --root in five more commands (#14548) - #14622

Closed
effortlessg41[bot] wants to merge 1 commit into
mainfrom
fix/14548-mistyped-root-five-commands
Closed

effortlessg41[bot] wants to merge 1 commit into
mainfrom
fix/14548-mistyped-root-five-commands

Conversation

@effortlessg41

@effortlessg41 effortlessg41 Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • policy readiness, policy waiver-aging, pr-comments plan, reports index and reports ci-summary now call the shared ensure_command_root validator immediately after option parsing, before any write.
  • A missing --root or a file --root is refused with exit 2 and the shared "<command> root <path> is not a directory" message instead of exiting 0 and creating a directory tree.
  • mistyped_root_is_refused_and_not_created is extended from 3 to 8 commands; it failed on all five before the fix and passes after.

Swarm / Source Boundary

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge, dependency, or repo-ops development for ripr-swarm
  • repair or follow-up for a same-repo swarm PR
  • swarm-only CI, runner, routing, source-of-truth, or agent-operating surface
  • other swarm-scoped work:

Source-of-truth Links

Proposal: n/a
Spec: n/a — no spec covers the #14222 root-validation contract; SPEC-0188 covers only Windows trailing-component disclosure and its entry-point list is already non-exhaustive
ADR: n/a
Plan item: n/a
Governing issue or accepted claim: #14548 (follow-up to #14222, fixed for three commands in #14322)
Acceptance delta (one sentence): the five named commands refuse a missing or file --root with exit 2, a message, and no filesystem change.

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): fix/14548-mistyped-root-five-commands
Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): n/a
Accepted winner and losing candidate disposition (when decided): n/a

Scope

Scope Classification

This PR is scoped by:

  • One production behavior
  • One public contract
  • One architectural seam
  • Docs/spec/test-only evidence package
  • Other:

Production delta:

Evidence/support delta:

  • crates/ripr/tests/cli_smoke.rs::mistyped_root_is_refused_and_not_created covers 8 commands (was 3).
  • changelog.d/14548-mistyped-root-five-commands.md.

Single acceptance criterion:

  • For each of the five commands, a missing nested root and a file root both exit 2 with the shared refusal, create nothing, and leave the file untouched.

Non-goals:

  • No change to ensure_command_root itself, to the other commands that already use it, or to the Windows trailing-component wording.
  • No spec edit: the contract is already carried by the shared validator and its existing tests.

Support-tier Impact

  • none
  • updates docs/status/SUPPORT_TIERS.md
  • changes a README, release, docs, CLI, JSON, editor, CI, or package claim

Claim/proof notes:

  • The CLI behavior change is a refusal where the command previously succeeded silently. It is recorded in the changelog fragment; no support-tier claim changes.

Policy Impact

  • none
  • doc artifacts
  • CI lane
  • package boundary
  • lint / Clippy
  • no-panic
  • file policy
  • generated artifact
  • dependency
  • process/network

Ledger or exception notes:

  • None.

Proof

# red before the fix (test extended to 8 commands, fix reverted)
cargo +1.95.0-x86_64-pc-windows-gnu test -p ripr --test cli_smoke mistyped_root_is_refused_and_not_created
# green after, on the rebased head
cargo +1.95.0-x86_64-pc-windows-gnu test -p ripr --test cli_smoke mistyped_root_is_refused_and_not_created
cargo +1.95.0-x86_64-pc-windows-gnu check -p ripr
rustfmt +1.95.0-x86_64-pc-windows-gnu --check --edition 2024 <five changed files>

Result, failures, or skipped proof:

  • Red: all five commands exited 0 with empty stderr for both the missing nested root and the file root.
  • Green: 1 passed; 0 failed, exit 0, on head 4f9305df96fe91a7f278a9649b96f0b4d3dd3890 rebased onto e9f76b76.
  • cargo check -p ripr exit 0 with 5 pre-existing lsp/backend.rs dead-code warnings.
  • rustfmt --check exit 0 on the five changed files. cargo fmt --check itself fails on this box with OS error 206 (path too long), so rustfmt was run directly.
  • Not run: the workspace-wide gates in the checklist below, and MSVC. This box builds with the GNU stopgap toolchain (+1.95.0-x86_64-pc-windows-gnu); CI's MSVC lanes are authoritative for anything toolchain-sensitive.

Claim Boundary

What may be claimed after this PR? What must not be claimed yet?

  • May claim: the five commands refuse a mistyped --root on the tested platform, with a regression test.
  • Must not claim: MSVC/CI parity, or that every remaining command validates its root.

Rollback

How can this PR be reverted safely?

  • Revert the squash commit. The change is additive at five call sites plus a test extension; no data or schema migration.

Spec-Test-Code Traceability

  • Spec: none (see Source-of-truth Links)
  • Tests: crates/ripr/tests/cli_smoke.rs::mistyped_root_is_refused_and_not_created
  • Code: crates/ripr/src/cli/commands.rs, commands/reports.rs, commands/ci_summary.rs, commands/policy/reports.rs
  • Golden outputs: none
  • Metrics: none
  • ADR/learning: none

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.
  • Unknowns include stop reasons where applicable.

CI Economics

  • LEM impact: n/a
  • Workflows touched: none
  • Branch protection impact: none
  • Failure mode caught: a mistyped --root silently creating a directory tree or writing into the wrong place
  • Cheaper signal considered: the existing cli_smoke regression, extended in place
  • Required lanes affected: none beyond the normal Rust lanes
  • Advisory lanes affected: none
  • On-demand/release lanes affected: none
  • Labels that alter behavior: none
  • Artifact families affected: none
  • Rollback path: revert the squash commit

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.
  • New non-Rust programming files are allowlisted with owner, surface, and reason. (none added)
  • New generated, dependency, process-spawn, or network surfaces are allowlisted with owner and reason. (none added)
  • Errors are reported with actionable context.
  • Public JSON/schema changes are documented. (none)

Gates

Not run locally on this box (GNU stopgap, one heavy build at a time); CI is authoritative.

  • cargo fmt --check
  • cargo check --workspace --all-targets
  • cargo test --workspace
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo doc --workspace --no-deps
  • cargo package -p ripr --list
  • cargo publish -p ripr --dry-run
  • cargo xtask check-static-language
  • cargo xtask check-doc-artifacts
  • cargo xtask check-support-tiers
  • cargo xtask check-no-panic-family
  • cargo xtask check-allow-attributes
  • cargo xtask check-local-context
  • cargo xtask check-file-policy
  • cargo xtask check-covered-by
  • cargo xtask check-executable-files
  • cargo xtask check-workflows
  • cargo xtask check-spec-format
  • cargo xtask check-spec-numbering
  • cargo xtask check-fixture-contracts
  • cargo xtask check-generated
  • cargo xtask check-badge-diff-policy
  • cargo xtask check-generated-clean
  • cargo xtask check-dependencies
  • cargo xtask check-process-policy
  • cargo xtask check-network-policy

Extension changes: n/a

Closes #14548

policy readiness, policy waiver-aging, pr-comments plan, reports index and reports ci-summary now call the shared ensure_command_root validator right after option parsing, so a missing or file --root exits 2 instead of being created or written through. Extends mistyped_root_is_refused_and_not_created to all eight commands.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 55f36378-186e-4d82-911d-5813ac8cd38b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SOURCE_REVIEW_READY
VERDICT: APPROVE 4f9305d — no blocking findings on this head.
reviewed_head_sha: 4f9305d
base: e9f76b7

Duplicate candidate (non-blocking, for the orchestrator)

This head is the same production change as open #14616 at 517511fa8f31e2ab3665c0a2a095c9251ba74100: both add ensure_command_root to policy readiness, policy waiver-aging, pr-comments plan, reports index and reports ci-summary at the same call sites, and both extend mistyped_root_is_refused_and_not_created to eight commands. The body's "five more commands" and "Proposed replacement of PR: none" are inaccurate; these are the same five commands named in #14548, already covered by #14616. #14616's test is stronger: it runs each command with current_dir = scratch and asserts no target/ was written, while this head uses run_ripr (inherits the harness CWD) and only checks the mistyped root. The orchestrator should pick one vehicle; if this app-authored head is the intended native-approval mirror, the body should say so.

What I inspected

  • Diff at 4f9305df: five call sites, each after option parsing and before the first read or write — crates/ripr/src/cli/commands.rs:637 (pr-comments plan), crates/ripr/src/cli/commands/ci_summary.rs:30 (reports ci-summary), crates/ripr/src/cli/commands/policy/reports.rs:31 (policy readiness) and :323 (policy waiver-aging), crates/ripr/src/cli/commands/reports.rs:53 (reports index).
  • ensure_command_root in crates/ripr/src/cli/commands_context.rs: the generic refusal is "{command_name} root {path} is not a directory; pass the directory that contains the workspace ...", so the test's "{name} root {path} is not a directory" substring matches and exit 2 is the existing Err path. The Windows stripped-component branches are unchanged.
  • The five parsers (policy/parse.rs, commands_options.rs, commands.rs, reports.rs, ci_summary.rs) only format paths; CiSettings::from_env reads env and GITHUB_EVENT_PATH only. No write precedes the gate.
  • crates/ripr/tests/cli_smoke.rs: the test now covers eight commands, both a missing nested root and a file root, asserts exit 2 and the exact message, and checks the file content is untouched.
  • Issue #14548: the five commands and the acceptance match the issue.
  • Checks at this head: CodeRabbit, GitGuardian and Graphite only; no hosted Rust gate.

Not checked

No build or test run (read-only beat); the red/green claim is the author's local GNU-toolchain evidence. MSVC/CI parity and the workspace-wide gates are not established on this head. I did not verify whether the duplicate is intentional.

No checkout, no label, no branch change.

@effortlessg41

effortlessg41 Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #14616.

#14616 is the intended landing for #14548. It predates this PR (opened 20:45Z, this one 21:2x), covers the same five call sites with the same ensure_command_root placement, and its regression is stronger: it runs each command with current_dir set to a scratch directory and asserts that a refused command wrote nothing under the CWD, which is the actual failure mode (the bad root is ignored and the report lands in the CWD-relative target/ripr/...). This PR's test only asserts the mistyped root was not created, which passes on the buggy code.

#14616 is also the only one of the two that can be admitted: it is authored by a MEMBER account and carries SOURCE_REVIEW_READY on its head 517511fa8f, so admission passed and its qualification run is in flight. This PR is App-authored (author_association: NONE), and review_disposition.py trusts only OWNER/MEMBER/COLLABORATOR, so it could never satisfy the review gate on its own.

Not armed, no merge-ready label, no qualification run requested. The branch is left in place rather than deleted.

One difference worth carrying over: this PR adds changelog.d/14548-mistyped-root-five-commands.md, which #14616 does not have. CONTRIBUTING.md:542 asks for a changelog.d/ fragment for a user-visible fix; nothing in routed-rust.yml enforces it, so it is a convention gap, not a gate. The fragment is in this branch if its author wants it.

@effortlessg41 effortlessg41 Bot closed this Nov 13, 2026
@EffortlessSteven

Copy link
Copy Markdown
Member

Closing as a duplicate of #14616.

#14616 (head 517511fa, authored 20:45Z) is the vehicle for this change and is already in the native merge queue at position 77. It covers the same five commands and the same call sites, and its test is stronger: it runs with current_dir = scratch and asserts no target/ was written, where this PR uses run_ripr (inheriting CWD) and only checks the mistyped root.

Two corrections to this PR's description, for the record:

Review 5898248749 approved this head and found the production change correct, so the work is not lost; it lands through #14616. Reopen if #14616 is withdrawn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refuse a mistyped --root in five more commands (policy readiness, policy waiver-aging, pr-comments plan, reports index, reports ci-summary)

1 participant