Skip to content

Remove stray dbg! from the privacy checker - #50

Merged
dduugg merged 1 commit into
mainfrom
remove-stray-dbg-in-privacy-checker
Aug 19, 2026
Merged

Remove stray dbg! from the privacy checker#50
dduugg merged 1 commit into
mainfrom
remove-stray-dbg-in-privacy-checker

Conversation

@dduugg

@dduugg dduugg commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #49.

The bug

src/packs/checker/privacy.rs:64 carried a live dbg!:

dbg!(constant_is_private, constant_is_in_private_namespace);

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 no dbg! at all.

Why it survived

Nothing in the suite reached the branch — no fixture configured private_constants. On main, grep -rl private_constants tests/fixtures/ returned nothing, against three hits under src/.

So this adds tests/fixtures/privacy_violations_with_private_constants, exercising all three combinations of the two flags the dbg! was printing:

Reference Flags Expected
::Bar constant_is_private violation
::Bar::Inner constant_is_in_private_namespace violation
::SomeConcern neither no violation

The third row is the one worth having. A non-empty private_constants list 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_constants asserts those three outcomes and that stderr is empty, so the dbg! 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.

cargo fmt --all -- --check                  clean
cargo clippy --all-targets --all-features   clean
cargo test --test check_test                26 passed

Note on the audit check

The failing audit job is unrelated to this change and pre-dates it. actions-rs/audit-check@v1 cannot compile cargo-audit: the pinned toolchain is rustc 1.92.0 and kstring@2.0.4 now requires 1.96.0. That action has been unmaintained for years (it targets Node 12 and the workflow still pins actions/checkout@v2), and the workflow has never completed successfully on this repo — every earlier run is action_required. This diff touches no Cargo.toml or Cargo.lock, so it cannot affect that job. Being addressed separately.

Sent with Claude Code

`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
@dduugg
dduugg requested a review from a team as a code owner August 19, 2026 18:20
@github-project-automation github-project-automation Bot moved this to Triage in Modularity Aug 19, 2026
@dduugg
dduugg enabled auto-merge (squash) August 19, 2026 18:31
@dduugg
dduugg merged commit 8250ba5 into main Aug 19, 2026
11 of 12 checks passed
@dduugg
dduugg deleted the remove-stray-dbg-in-privacy-checker branch August 19, 2026 18:41
@github-project-automation github-project-automation Bot moved this from Triage to Done in Modularity Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Live dbg! in privacy.rs writes to stderr in released builds when private_constants is configured

2 participants