Repository navigation
test(minimal): gate the debug-only command assertion on debug builds - #3684
Conversation
The function that decides whether a command prints the native-boxes notice named the spinner run and the answerer aid in its pattern. Both commands exist in debug builds only, so a release build of the crate stopped at "no variant named Spin" and "no variant named DebugAnswererCommand". The other uses of the two names carry the debug gate already. The two names move into a debug-only early return, which keeps the debug behaviour as it was. One test named the answerer aid without the gate as well, which stopped a release build of the tests; it has the gate now. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Reviewed: no findings; approval withheld, 1 thread unresolved at APPROVE withheld: 1 unresolved thread — norrietaylor crates/minimal/src/cmd/mod.rs. Resolving the last thread releases the approval on this head. Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required. Clobber: none seen. |
Main gates the two debug-only commands in cmd/mod.rs now (#3682). This branch keeps main's form there and carries only the gate on the one test assertion that names DebugAnswererCommand. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
There was a problem hiding this comment.
Scope matches the title. The diff touches two files, and each hunk gates a use of a #[cfg(debug_assertions)] variant of cli::Command.
Clobber none. git log on both files shows #3644 as the last change to shows_native_boxes_notice, and the diff keeps its behaviour.
Correctness The change is good. In a debug build, Spin and DebugAnswererCommand return false before and after the change. In a release build, the two names are absent from the function. rg finds no other use of the two variants without the gate in crates/minimal. leaves_the_notice_visible does not name them. The two comments that the diff adds explain the code.
One low finding: no check in the repository compiles this crate with debug assertions off, so the same defect can return. The PR body says this.
Not checked I did not compile. The claim that the release build completes is from the PR body.
| Some(Command::Spin(_) | Command::DebugAnswererCommand) | ||
| ) { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
low · The fix has no guard against the same defect. No just recipe compiles the minimal crate with debug assertions off, so the next ungated use of Command::Spin or Command::DebugAnswererCommand passes every required check again. The existing #[cfg(not(debug_assertions))] test spin_absent_in_release at crates/minimal/src/tests.rs:1624 also never runs. The PR body says a release-profile check is not added here. Add a just recipe that checks the release profile, or link a follow-up issue from the PR. The ungated use itself is local: rg finds no other instance.
There was a problem hiding this comment.
Right, nothing stops the next one. Since this review, #3682 landed the gate in cmd/mod.rs, so this PR now carries only the gate on the one test assertion, and neither PR adds the guard. I will open a follow-up PR with a just recipe that checks the minimal crate with debug assertions off and runs the #[cfg(not(debug_assertions))] tests (spin_absent_in_release among them), and link it here.
|
5a468ac merges main. #3682 gates the two debug-only commands in cmd/mod.rs, so this branch keeps main's form there and now carries only the gate on the one test assertion that names DebugAnswererCommand (two lines in update_check/tests.rs). The title says more than the change does now; I will retitle it. |
What
maindoes not compile in release mode since #3644. A release build of theminimalcrate stops at:shows_native_boxes_noticeincrates/minimal/src/cmd/mod.rsnamesCommand::SpinandCommand::DebugAnswererCommandin its pattern. Both variants are#[cfg(debug_assertions)], so a release build has no such names. Every other use of the two in that file carries the gate already.The change
The two names move into a debug-only early return at the top of the function. A debug build behaves as before (neither command prints the notice); a release build compiles.
One test in
crates/minimal/src/update_check/tests.rsnamedDebugAnswererCommandwithout the gate as well. That stopped a release build of the tests, and has since #2650. That one assertion has the gate now.15 lines added, 6 removed. No behaviour change in either build mode.
How it was found, and checked
A release build of two unrelated branches failed on this error after they took today's
main. Branches based onmainfrom before #3644 build.With this change: format, clippy, the workspace tests, doctests and the native e2e pass, and the release build of the workspace completes.
Why CI did not catch it
No required check compiles the
minimalcrate with debug assertions off: the CI lanes build the dev profile. The release workflow buildsminwith--release, so the next release or nightly build is the first thing that would hit it. Acheckof the release profile in CI would catch this class of mistake; that is not added here.🤖 Generated with Claude Code
Summary by CodeRabbit