Remove stray dbg! from the privacy checker - #50
Merged
Conversation
`privacy.rs` carried a live `dbg!` on the `private_constants` branch, so any pack configured with `private_constants` emitted two lines to stderr per checked reference, in released builds as well as debug. It also leaked internal file and line numbers into user-facing output. No fixture configured `private_constants`, so nothing exercised the branch. Add `tests/fixtures/privacy_violations_with_private_constants`, covering all three combinations of the two flags the `dbg!` was printing: ::Bar listed in private_constants -> violation ::Bar::Inner inside the private namespace -> violation ::SomeConcern absent from the list -> no violation The last case is the one that had no coverage: a non-empty `private_constants` list narrows privacy to that list, leaving everything else in the pack public. `test_check_with_private_constants` asserts those outcomes and that stderr is empty, so the `dbg!` cannot come back unnoticed. Fixes #49
perryqh
approved these changes
Aug 19, 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.
Fixes #49.
The bug
src/packs/checker/privacy.rs:64carried a livedbg!:It fired once per reference checked against a pack's
private_constants, in released builds as well as debug, writing two lines to stderr each time and leaking internal file and line numbers into user-facing output.The fix is deleting the line.
src/now contains nodbg!at all.Why it survived
Nothing in the suite reached the branch — no fixture configured
private_constants. Onmain,grep -rl private_constants tests/fixtures/returned nothing, against three hits undersrc/.So this adds
tests/fixtures/privacy_violations_with_private_constants, exercising all three combinations of the two flags thedbg!was printing:::Barconstant_is_private::Bar::Innerconstant_is_in_private_namespace::SomeConcernThe third row is the one worth having. A non-empty
private_constantslist narrows privacy to that list, so anything in the pack but absent from it stays public — behaviour that previously had no coverage.test_check_with_private_constantsasserts those three outcomes and that stderr is empty, so thedbg!can't return unnoticed.Verification
I checked the test actually guards the regression rather than merely passing: with the
dbg!reinstated it fails on the stderr assertion, reporting all 6 noise lines; with the line removed it passes.Note on the
auditcheckThe failing
auditjob is unrelated to this change and pre-dates it.actions-rs/audit-check@v1cannot compilecargo-audit: the pinned toolchain is rustc 1.92.0 andkstring@2.0.4now requires 1.96.0. That action has been unmaintained for years (it targets Node 12 and the workflow still pinsactions/checkout@v2), and the workflow has never completed successfully on this repo — every earlier run isaction_required. This diff touches noCargo.tomlorCargo.lock, so it cannot affect that job. Being addressed separately.Sent with Claude Code