Skip to content

test(approval): fix stale comment and add CLI-layer regression test for #440 - #588

Merged
vladimirrott merged 4 commits into
lacs-project:mainfrom
atanishka308:fix-440-dangerously-skip-approval-docs
Oct 24, 2026
Merged

vladimirrott merged 4 commits into
lacs-project:mainfrom
atanishka308:fix-440-dangerously-skip-approval-docs

Conversation

@atanishka308

@atanishka308 atanishka308 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes #440.

cli.rs's --help doc comment and docs/cli.md were already corrected in a prior PR — --dangerously-skip-approval only raises the --yes auto-approval ceiling from MEDIUM to HIGH and implies nothing else. This PR finishes the remaining scope from the issue:

  • approval.rs: fixes the comment inside the_override_is_inert_without_yes, which claimed the flag "implies --yes at the CLI layer" — that was never true and the binary never did it. The assertion itself was always correct; only the comment was wrong.

  • main.rs: adds dangerously_skip_approval_wiring_tests, a new regression test that pins the contract one layer up from the existing policy-level test — through real CLI parsing and build_run_opts, not a hand-built ApprovalPolicy. It asserts both that the flag actually parsed (cli.dangerously_skip_approval) and that parsing it alone grants nothing (decide_step returns RequiresPrompt), in the same test, so the two assertions can't silently drift apart if a future default_value_if changes one but not the other.

Verified: cargo nextest run --workspace --locked — 1937 passed, 6
skipped, 0 failed.

@vladimirrott vladimirrott 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.

Reviewed at fa52fc93. Two mechanical items block it, and the test itself is good.

The test parses the real argv through Cli::try_parse_from and then goes through build_run_opts, so it checks the layer where a default_value_if or a yes: cli.yes || ... would slip in. That layer had no test before. Keeping the "did it parse" and "did it grant anything" assertions in one function was the right call; the comment you added says why.

I did not run the branch on my machine. In a --network=none container I broke the wiring the test guards, making the flag imply --yes:

mutation: s/yes: cli.yes,/yes: cli.yes || cli.dangerously_skip_approval,/   (apps/sysknife-cli/src/main.rs:190)
unmutated: dangerously_skip_approval_wiring_tests::dangerously_skip_approval_alone_does_not_imply_yes_max_risk_or_non_interactive ... ok
mutated:   test dangerously_skip_approval_wiring_tests::dangerously_skip_approval_alone_does_not_imply_yes_max_risk_or_non_interactive ... FAILED (rc=101)

Blocking, both mechanical:

  1. cargo fmt --all --check fails, which is why rust is red (run 37598756598):

    Diff in /home/runner/work/sysknife/sysknife/apps/sysknife-cli/src/main.rs:198:
         }
     }
     
    -
     #[cfg(test)]
     mod dangerously_skip_approval_wiring_tests {
    

    One blank line too many before #[cfg(test)]. cargo fmt --all fixes it.

  2. The test count. CI stopped at fmt, so scripts/test_baseline.sh never ran, and it will fail next. main is at 1,943 now (your body's 1,937 was right for the base you started from). With your one test it becomes 1,944, in four places: tests/evidence/workspace-tests.json, README.md:354, docs/introduction.md:147 and docs/distro-support.md:94. Rebase onto main first, since #572 and #586 landed since you branched.

Optional: opts.skip_approval comes from UnattendedConsent::from_env, so the assert!(!opts.skip_approval) line holds only while SYSKNIFE_I_ACCEPT_UNATTENDED_ROOT is unset where the tests run. That's true in CI. The case where both keys are present and --yes is absent is covered one layer down by the_override_is_inert_without_yes, so nothing is missing.

When you push those two fixes, I'll merge if the push changes nothing beyond the formatting, the count and the rebase, the mutation above still fails, and the board is green; I'll approve at the new head once those hold.

@vladimirrott

Copy link
Copy Markdown
Member

Checking in, with nothing attached to it, @atanishka308. The test here is good, and the two items left are mechanical: one blank line that cargo fmt --all removes, and moving the test count with UPDATE_TEST_BASELINE=1 scripts/test_baseline.sh plus the three doc figures. Main has moved since, so the count to expect after a rebase is 1,993 plus however many tests this PR adds.

If you'd rather not spend time on that, say so and I'll push both fixes to this branch myself. You allowed maintainer edits, and the commit stays yours. Either way #440 is still yours, and dropping it costs nothing.

vladimirrott and others added 2 commits October 24, 2026 10:48
The two mechanical items from the review: `cargo fmt` removes one blank
line before the test module, and the new test moves the count from
1,995 to 1,996. Committed with --no-verify after check_no_secrets.sh
--staged and cargo fmt --all --check; CI's baseline confirms the count.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01UpyrhbDTW1gBwzGAC44GYU

@vladimirrott vladimirrott 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.

Approved at 841d8424, @atanishka308. I pushed the two mechanical fixes as offered: cargo fmt dropped the blank line, and the count moved to 1,996 for your test. Your branch also has main merged in, which brings the ctutils bump from #641. That bump fixed the security-audit failure you'd have seen this week, which came from main and had nothing to do with your change.

Your test and comment are unchanged from fa52fc93. I re-ran the mutation from my first review at this head:

mutation: s/yes: cli.yes,/yes: cli.yes || cli.dangerously_skip_approval,/
unmutated: pass    mutated: FAILED

I'll merge once CI finishes. #440 closes with it.

If you want another one in the same area, #474 is free: the plan summary an operator approves goes through two sanitised paths and one that isn't. The scope update on that issue says which path is still open. I'll hold it for you if you say so there.

@vladimirrott
vladimirrott merged commit 97d180d into lacs-project:main Oct 24, 2026
13 checks passed
@vladimirrott

Copy link
Copy Markdown
Member

Merged as 97d180de. Thank you, @atanishka308. I pushed the cargo fmt blank line and the test-count bump onto your branch so it could land without another round trip. Your wiring test checks #440 through the real CLI argument parsing, one layer above the policy test that was there before.

If you want another: #474 runs the other way from your #385. You sanitised the distro string on its way into the prompt; #474 is model-authored plan text on its way out to the operator. I've left a note there.

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.

The unattended flag implies nothing: --help and docs/cli.md both promise --yes, --max-risk high and --non-interactive

2 participants