Repository navigation
test(guards): name both crate paths when the styling guards report a violation - #3888
Merged
Merged
Conversation
…violation The stderr guard's failure message says to write `worktrunk::styling::eprintln!(…)`. That path resolves only in the binary's modules. Pasted into a library module it produces code that cannot compile, and neither guard can tell: both accept any call prefixed with `styling::`, so the scan passes and the compiler is what fails, one CI round later.
This was referenced Aug 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
check_stderr_macros_come_from_stylingtells a contributor to writeworktrunk::styling::eprintln!(…). That path resolves in the binary's modules and nowhere else, so pasted into a library module it produces code that cannot compile — and the guard can't catch that, because its scan only checks the call is prefixed withstyling::, which both forms satisfy. The compiler is what fails, one CI round later.The messages now name both paths, from one
STYLING_PATH_BY_CRATEconst the stdout guard shares.check_no_unexpected_stdout_writescarried the same single-path instruction and gets the same treatment; the module docstring and theSTD_STDERR_ALLOWED_PATHSdoc follow. Thewriting-user-outputsskill is the other place the guidance lives, and it also named onlyworktrunk::styling— one paragraph there now states the split and that the guards accept either form, so the compiler is the only thing that tells you the path is wrong for the file.This came out of #3884, where the guard fired on
src/git/repository/mod.rs, the fix was applied literally, andtest (linux)andtest (macos)both went red on it.Verification
src/lib.rsdeclarescache,command_log,config,copy,docs,git,path,priority,progress,remove_dir,shell,shell_exec,signal_forwarder,styling,sync,trace,utils,testing.src/main.rsdeclarescli,commands,completion,diagnostic,display,help,invocation,llm,log_files,logging,md_help,output,pager,summary. Both trees are undersrc/, and both guards scan all of it.Each message was read by tripping its guard from a library module (a temporary
eprintln!/println!insrc/priority.rs, reverted):cargo test --test integration -- output_system_guard5 passed,cargo fmt --checkandcargo clippy --tests --features shell-integration-testsclean.#3878 also touches
tests/integration_tests/output_system_guard.rsand is green and merge-ready, so this went to its own branch rather than folding in — the two edit different hunks and whichever merges second may want a trivial rebase.