Skip to content

usage-policy fold test has never passed: fold_tightened emitted when the spelling did not change the verdict #661

Description

@bgmcmullen

test/core/usage-policy-fold.test.js:387, "resolve emits a hashed usage_policy.fold_tightened only when folding changed the verdict", fails on master and has done since it was written.

expected: 0
actual:   1

The assertion is that resolving a path whose spelling matches the policy entry exactly emits no usage_policy.fold_tightened event, because nothing was folded. One is emitted.

It is not a regression

Checked out f457009 ("Usage-policy gate folds path spellings a volume treats as one directory", #484), the commit that introduced both the feature and the test: it fails there too, 22 pass / 1 fail. So this shipped broken rather than breaking later, and npm test has been red on master ever since.

Why it is worth fixing rather than muting

Either the resolver emits a tightening signal on a path it did not tighten, which is a false positive on a privacy-relevant hot path, or the test encodes the wrong expectation. Both are worth knowing, and neither is visible while the failure is treated as background noise.

The practical cost is already being paid: a permanently-red suite means a genuinely new failure has to be spotted by eye against an expected-failure count, which is exactly how a real regression gets waved through.

Repro

node --test test/core/usage-policy-fold.test.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions