Add zipper-type property tests: same_trie, seeded ring algebra, long-path serialization#48
Open
MesTTo wants to merge 3 commits into
Open
Conversation
Whether two maps share the same root node by pointer. Because PathMap is copy-on-write, a map and a clone of it stay same_trie until one is mutated (any insert/removal replaces the root node), so a true result proves the node structure is unchanged relative to the other. Holding the other map (a cheap COW clone snapshot) alive prevents ABA pointer reuse. This is the O(1) staleness signal a content-keyed cache needs -- val_count is O(n) and uncached at arbitrary paths (measured 47ms over 1M facts), which defeats any per-query cache. Tested for clone-sharing, insert, remove, distinct-but-equal maps, and empty maps.
Implements the fuzz test the trailing TEST TODO in ring.rs described: seeded pseudorandom HashSet and nested-HashMap lattices checked against plain set oracles across pjoin / pmeet / psubtract / join_into, 64 seeds each, asserting both the results and the identity/element status masks. Also gives the empty sub-set collapse case the coverage its inline TODO asked for, and covers the HashMap psubtract the notes flagged as untested. The resolved TODO notes are removed; the unresolved ones (Vec SetLattice, LatticeCounter/LatticeBitfield traits) stay.
Answers the note at the top of paths_serialization.rs: round-trips deterministic xorshift paths of 7 / 2049 / 4097 / 24000 bytes, so the input spans the internal 4096-byte compression CHUNK, asserting path counts on both directions, per-path containment after the round-trip, and that nothing extra appears. No behavior change; the resolved note is removed.
828d66f to
257c7da
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.
Summary
Three additive test/API commits, no internals changed:
PathMap::same_trie— an O(1) copy-on-write root-identity stalenesscheck (compares the root node pointer, no traversal).
trailing TODO in
ring.rsdescribed: seeded pseudorandom HashSet andnested-HashMap lattices checked against plain set oracles across
pjoin/pmeet/psubtract/join_into, asserting both results and theidentity/element status masks. Also covers the empty-subset-collapse case
and the HashMap
psubtractcase the inline notes flagged as untested. Onlythe now-resolved TODO notes are removed; the still-open ones (
VecSetLattice,LatticeCounter/LatticeBitfieldtraits) are left in place.paths_serialization.rs: round-trips deterministic paths of 7 / 2049 /4097 / 24000 bytes, so the input spans the internal 4096-byte compression
chunk, checked in both directions.
Test plan
cargo test --release --lib(664/0, up from the 660/0/1 baseline)cargo test --release --lib same_trie/seeded/paths_serializationindividually