Found by @dduugg while reviewing #45. Pre-existing and unrelated to that PR.
src/packs/checker/privacy.rs:64 has a live dbg! that writes to stderr on every privacy check for a pack configured with private_constants, including in released builds:
dbg!(constant_is_private, constant_is_in_private_namespace);
Repro
A minimal app with private_constants on the defining pack:
packwerk.yml cache: false
packs/foo/package.yml enforce_privacy: true
packs/bar/package.yml enforce_privacy: true
private_constants:
- "::Bar"
with packs/foo/app/services/foo.rb referencing Bar:
$ pks --project-root . check 2>stderr.txt
$ cat stderr.txt
[src/packs/checker/privacy.rs:64:13] constant_is_private = true
[src/packs/checker/privacy.rs:64:13] constant_is_in_private_namespace = false
It fires once per checked reference, so on a large tree using private_constants it is a lot of stderr noise, and it leaks internal file and line numbers into user-facing output.
Why it survived
No fixture in tests/fixtures/ configures private_constants, so nothing in the suite exercises this branch. grep -rl private_constants tests/fixtures/ returns nothing, against three hits under src/. Worth a fixture alongside the removal, since the surrounding logic (constant_is_private versus constant_is_in_private_namespace) is currently untested too.
Fix
Delete the line. Happy to send a PR with a fixture that covers the branch if that would be useful.
Sent with Claude Code
Found by @dduugg while reviewing #45. Pre-existing and unrelated to that PR.
src/packs/checker/privacy.rs:64has a livedbg!that writes to stderr on every privacy check for a pack configured withprivate_constants, including in released builds:Repro
A minimal app with
private_constantson the defining pack:with
packs/foo/app/services/foo.rbreferencingBar:It fires once per checked reference, so on a large tree using
private_constantsit is a lot of stderr noise, and it leaks internal file and line numbers into user-facing output.Why it survived
No fixture in
tests/fixtures/configuresprivate_constants, so nothing in the suite exercises this branch.grep -rl private_constants tests/fixtures/returns nothing, against three hits undersrc/. Worth a fixture alongside the removal, since the surrounding logic (constant_is_privateversusconstant_is_in_private_namespace) is currently untested too.Fix
Delete the line. Happy to send a PR with a fixture that covers the branch if that would be useful.
Sent with Claude Code