python-math #22: feat(math): Clojure hash-map iteration order for the in-conv greedy tie-break (legacy) - #2650
Draft
jucor wants to merge 1 commit into
Draft
python-math #22: feat(math): Clojure hash-map iteration order for the in-conv greedy tie-break (legacy)#2650jucor wants to merge 1 commit into
jucor wants to merge 1 commit into
Conversation
This was referenced Jul 22, 2026
Draft
Draft
Draft
This was referenced Jul 27, 2026
Draft
Draft
python-math #43: docs(delphi): s7 goal state + journal — mode collapse executed, battery 20/20
#2672
Draft
Draft
Draft
This was referenced Jul 28, 2026
Draft
… in-conv greedy tie-break (legacy) ## What The greedy floor (conversation.clj:259-268) — the legacy rule that admits the top voters into in-conv (the set of participants included in clustering) when too few meet the vote threshold — sorts the user-vote-counts hash-map with a STABLE sort by count descending, so equal-count ties follow Clojure's PersistentHashMap ITERATION ORDER. That order is deterministic: keys sort by successive 5-bit chunks (low first) of Murmur3 hashLong (Clojure's hasheq for Long keys). Validated against three recorded-blob oracles (the raw key order of user-vote-counts: vw front-loaded6 n=18, vw uniform8 n=30, biodiversity n=98 — all exact). ## Why The PR-E port (#2623) assumed this order was non-deterministic and substituted matrix row order. On vw front-loaded6 step 0 that admits pid 14 where Clojure admits pid 17 (a five-way 1-vote tie at the floor boundary), seeding an in-conv / base-cluster membership divergence that cascades through every downstream key — the battery's last diverging entry. ## How it works Adds `polismath/utils/clj_hash.py` (hashLong + HAMT key order; integer keys only, with a documented row-order fallback otherwise) and applies it to the legacy greedy candidate order. Clojure's array-map (used for maps of <=8 entries, insertion-ordered) cannot affect the pick: ties only matter with >=16 participants, which guarantees a hash-map. improved mode (the engine setting that keeps Python's corrected behavior) is unchanged. commit-id:d5f1f51d
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.
What
The greedy floor (conversation.clj:259-268) — the legacy rule that admits the top voters into in-conv (the set of participants included in clustering) when too few meet the vote threshold — sorts the user-vote-counts hash-map with a STABLE sort by count descending, so equal-count ties follow Clojure's PersistentHashMap ITERATION ORDER. That order is deterministic: keys sort by successive 5-bit chunks (low first) of Murmur3 hashLong (Clojure's hasheq for Long keys). Validated against three recorded-blob oracles (the raw key order of user-vote-counts: vw front-loaded6 n=18, vw uniform8 n=30, biodiversity n=98 — all exact).
Why
The PR-E port (#2623) assumed this order was non-deterministic and substituted matrix row order. On vw front-loaded6 step 0 that admits pid 14 where Clojure admits pid 17 (a five-way 1-vote tie at the floor boundary), seeding an in-conv / base-cluster membership divergence that cascades through every downstream key — the battery's last diverging entry.
How it works
Adds
polismath/utils/clj_hash.py(hashLong + HAMT key order; integer keys only, with a documented row-order fallback otherwise) and applies it to the legacy greedy candidate order. Clojure's array-map (used for maps of <=8 entries, insertion-ordered) cannot affect the pick: ties only matter with >=16 participants, which guarantees a hash-map. improved mode (the engine setting that keeps Python's corrected behavior) is unchanged.commit-id:d5f1f51d
Stack: