Skip to content

Add zipper-type property tests: same_trie, seeded ring algebra, long-path serialization#48

Open
MesTTo wants to merge 3 commits into
Adam-Vandervorst:masterfrom
MesTTo:pr/pathmap-zipper-types-property-tests
Open

Add zipper-type property tests: same_trie, seeded ring algebra, long-path serialization#48
MesTTo wants to merge 3 commits into
Adam-Vandervorst:masterfrom
MesTTo:pr/pathmap-zipper-types-property-tests

Conversation

@MesTTo

@MesTTo MesTTo commented Jun 23, 2026

Copy link
Copy Markdown

Summary

Three additive test/API commits, no internals changed:

  • PathMap::same_trie — an O(1) copy-on-write root-identity staleness
    check (compares the root node pointer, no traversal).
  • Seeded ring algebra property tests — implements the fuzz test the
    trailing TODO in ring.rs described: seeded pseudorandom HashSet and
    nested-HashMap lattices checked against plain set oracles across
    pjoin/pmeet/psubtract/join_into, asserting both results and the
    identity/element status masks. Also covers the empty-subset-collapse case
    and the HashMap psubtract case the inline notes flagged as untested. Only
    the now-resolved TODO notes are removed; the still-open ones (Vec
    SetLattice, LatticeCounter/LatticeBitfield traits) are left in place.
  • Long-path serialization coverage — answers the note at the top of
    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_serialization individually

@MesTTo MesTTo marked this pull request as ready for review June 23, 2026 10:23
MesTTo and others added 3 commits July 5, 2026 04:18
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.
@MesTTo MesTTo force-pushed the pr/pathmap-zipper-types-property-tests branch from 828d66f to 257c7da Compare July 4, 2026 18:19
@MesTTo MesTTo changed the base branch from zipper_maj to master July 4, 2026 18:53
@MesTTo MesTTo changed the title Add zipper algebra policy tests Add zipper-type property tests: same_trie, seeded ring algebra, long-path serialization Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant