Skip to content

docs(divergences): narrow the array-map entry to construction past eight - #826

Open
mparrett wants to merge 2 commits into
mainfrom
wt/ledger-array-map
Open

docs(divergences): narrow the array-map entry to construction past eight#826
mparrett wants to merge 2 commits into
mainfrom
wt/ledger-array-map

Conversation

@mparrett

@mparrett mparrett commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Why

docs/KNOWN_DIVERGENCES.md still says array-map is routed through the unordered persistent map and points at #763 for scoping. #764 resolved #763 on 2026-09-07 without touching the ledger, and the ledger's own maintenance rule asks for temporary entries to track their resolution. The entry is not gone, though: #764 orders up to eight entries and promotes on the ninth assoc, but (array-map ...) with more than eight pairs is built through the same transient and promotes during construction, so it traverses in hash order where Clojure keeps a directly constructed array map ordered at any size.

What changed

Verification

(keys (array-map :i 1 :h 2 :g 3 :f 4 :e 5 :d 6 :c 7 :b 8 :a 9))
;; a6763e77: (:b :g :e :f :a :c :h :d :i)
(keys (array-map :h 1 :g 2 :f 3 :e 4 :d 5 :c 6 :b 7 :a 8))
;; a6763e77: (:h :g :f :e :d :c :b :a)
(int (char 55296))                  ;; 55296, still accepted
(int (char 18446744073709551681N))  ;; 65, still truncated

vm.NewArrayMap in pkg/vm/persistent_map.go builds on a transient, which is where the ninth-entry promotion lives. scripts/docs_frontmatter_hook.py --check passes.

@mparrett mparrett changed the title docs(divergences): #764 narrowed the array-map mismatch to construction past eight entries docs(divergences): narrow the array-map entry to construction past eight Sep 8, 2026

@nooga nooga left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mparrett Content checks out — I verified the array-map construction-past-eight framing against #764 (merged) and the open #827 tracking issue, and the code in NewArrayMap/NewTransientMap matches what this entry now claims. CI green, no open threads. Green light.

Just sequence this after #825 — both currently touch docs/KNOWN_DIVERGENCES.md/its renamed successor, so rebase onto #825 once that's merged rather than merging in parallel.

mparrett and others added 2 commits September 8, 2026 10:56
…on past eight entries

The ledger still described array-map as routed through the unordered map
and pointed at #763 for scoping. #764 resolved #763: up to eight entries
keep insertion order and the ninth assoc promotes. What is left is that
(array-map ...) with more than eight pairs builds through the transient,
which promotes on the ninth entry, so it comes back in hash order where
Clojure keeps it array-backed. Entry rewritten to that residual, with a
transcript from main a6763e7; the decision text and portable-code
guidance updated to match.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mparrett
mparrett force-pushed the wt/ledger-array-map branch from c144889 to 3058c58 Compare September 8, 2026 17:56
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.

Small maps don't preserve insertion order (Clojure array-map semantics)

2 participants