Repository navigation
policy-fingerprint-order: fix X-12 - #43
Merged
Merged
Conversation
kridaydave
force-pushed
the
fix/pr-19-policy-fingerprint-order
branch
from
November 8, 2026 18:07
ac6d2f7 to
049176e
Compare
…X-12) Sort list fields and include every visibility-policy field in the canonical fingerprint inputs so semantically identical policies (e.g. reordered private_paths) produce the same key everywhere. Before, court sorted lists but store filter keys and visibility audit keys joined in file order and field coverage differed, so a no-op reorder wiped the export cache while the court/docket policy key stayed unchanged. Stored fingerprints change format: the export cache marker will mismatch once and trigger a safe full rebuild; persisted dockets/adjudication log entries keep their old keys as append-only history (no validation rejects them).
kridaydave
force-pushed
the
fix/pr-19-policy-fingerprint-order
branch
from
November 8, 2026 18:55
e4b90c8 to
c3130c1
Compare
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.
Bugs
What was wrong
src/court.rs:187-211(policy_key/push_list): sorted visibility lists before hashing, but only includedprivate_paths,private_branches,embargo_until(notresign_key_id/embargo_recipients).src/store.rs:1099-1108: exportfilter_keyjoinedprivate_paths/private_branchesin file order and omittedembargo_recipients, so reordering a no-op list changed the key and wiped the export cache.src/visibility.rs:66-77(audit_key): joinedembargo_recipients/private_paths/private_branchesin file order and omittedresign_key_id. Reorderingprivate_paths(semantically a no-op) therefore changed store/audit fingerprints while the court key stayed identical.Fix
VisibilityPolicy::canonical_fields()(and shared sorted list canonicalization) covering every visibility-policy field with list fields sorted, so semantically identical policies hash identically regardless of file order.visibility::audit_key()now hashescanonical_fields().court::policy_key()now includes all meaning-policy fields plusvisibility.canonical_fields(), keeping list canonicalization and aligning visibility field coverage.filter_keynow usespolicy.canonical_fields()(with a comment explaining cache semantics).visibility::tests::test_visibility_fingerprint_canonicalizes_list_orderandcourt::tests::test_policy_key_canonicalizes_list_order.Persisted fingerprints / stored data: fingerprint format changes. The export cache marker (
.oot/export/policy-key) will not match once andreset_export_cache_if_policy_changedtriggers a safe full export rebuild, then writes the new canonical key. Persisted dockets and.oot/adjudications.jsonlkeep their oldpolicy_keyvalues as append-only history; nothing validates or rejects old records, so reads remain fine but old/new key strings will differ (honest after the format/coverage fix).Verification
CI green (fmt, clippy, tests, release build, adjudication) + the regression tests added (
cargo fmt --all -- --checkclean locally; no local build/test per swarm instructions)