fix(tests): point the leak guard at the shipping schema - #317
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe recycler credential access test now builds its battery policy from the catalog’s current schema version instead of a fixed ChangesBattery policy test
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The test now uses the registered 2.7.0 schema and checks its disclosure classifications without an established merge-blocking risk. 🚥 Pre-merge checks | ✅ 7✅ Passed checks (7 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Found by the pre-publish audit for #293, by mutation-testing the gates rather
than running them.
The guard stopped covering what ships
recycler_credential_unlocks_professional_battery_fieldsis the end-to-endcheck that a public view of a battery passport does not carry Annex XIII
point 2 and point 4 content — state of health among them. It built its policy
from a literal:
2.6.0was current when the test was written. #295 added v2.7.0, and theliteral was not updated. So every leak assertion in that test — including
assert!(public.filtered_data.get("sohMethodology").is_none())— has beenevaluated against a schema that no longer ships.
Demonstrated rather than argued: flipping
sohMethodology'sx-disclosurefromrestrictedtopublicin v2.7.0 left the test green. After this changethe same mutation fails it.
There is no live leak
I diffed the classification across both versions before claiming anything.
v2.6.0 and v2.7.0 carry the same 15 non-public fields with the same classes —
sohMethodology: restricted,stateOfHealth: individual,stateOfHealthPct: individual, and the rest. Nothing is currently misclassified, and nothing hasbeen exposed.
What was lost is the guard, not the classification. 🚨 This project has already
shipped a state-of-health public leak once, in ≤0.10.0.
The fix, and why it is shaped this way
The policy now reads the catalog's current schema version rather than a
literal, so the guard follows the version it guards and cannot silently age
again. That is the same defect class as the schema
$idheaders corrected in#300 — a version literal that stays plausible while becoming wrong — and the
same remedy: derive it.
Scope
Deliberately narrow. Two things I did not do:
this one by mutating battery; a sweep for pinned versions across the test tier
is worth doing, but it is a different change and should not ride in behind a
one-line fix.
divergence, and caught my first mutation. It is not a substitute: it compares
the two records of the classification against each other, so a change applied
to both passes it. The end-to-end guard is the one that asks what actually
comes out of the filter.
Summary by CodeRabbit