Skip to content

Add persistent HAMT child insertion - #460

Draft
helly25 wants to merge 8 commits into
implement/hamt-shared-entry-insertfrom
implement/hamt-shared-child-insert
Draft

helly25 wants to merge 8 commits into
implement/hamt-shared-entry-insertfrom
implement/hamt-shared-child-insert

Conversation

@helly25

@helly25 helly25 commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

Add persistent HAMT child insertion while preserving older snapshots and child lifetimes.

AG;DR

Head f815a47 adds rejection tests for unrelated entry/child count changes and child insertion into terminal collisions. They verify that rejected operations neither allocate nor retain children and preserve the original payload. These cover three previously missed branch paths identified in the remote coverage artifact; no exclusions or baselines change. The pushed head passes bazel test //... (159 passing tests and one existing exception-only skip) and focused pre-commit, with local clang-tidy and trunk-fmt skipped. Replacement remote checks are pending.

Local validation of synchronized head 32f0adb found child-insertion tests still referring to the wildcard import removed by the parent. Head 5fed2be binds those successful allocation payloads with value_or(nullptr), asserts NotNull, and uses checked pointers directly for ownership and inspection. Focused pre-commit passes; local clang-tidy and trunk-fmt remain skipped. Full-suite and remote checks must validate this replacement head.

Synchronized to fully green PR 459 head ac17609 and pushed synchronization c4480b5 immediately. The merge preserves deferred child retention alongside the parent's const construction pointer and original optional return. Follow-up 32f0adb makes CopyChildren accept a const node and applies the same const-pointer/original-result pattern to child insertion. Focused pre-commit passes with local clang-tidy and trunk-fmt skipped. Full-suite and replacement remote validation are pending on this pushed head; earlier heads' results do not validate it. No merging is requested.

TryInsertChild copies the entry array and inserts one child at its dense bitmap rank. Shared allocation and child-copy helpers serve normal construction and entry insertion too. The caller preserves old bitmap slots and adds exactly one node slot. Null children are rejected before allocation; child references are retained only after successful construction. Exact allocator metadata and non-throwing entry constraints remain unchanged.

Tests cover insertion positions, preserved entries, lifetime/reference balancing, invalid counts/ranks, null children, and exhausted storage. HAMT_STORAGE.md documents ownership and caller invariants. This draft follows PR 459; it does not request merging. Validation is in progress. Local clang-tidy and trunk-fmt are skipped as requested.

Published synchronization b325df8 includes its parent's collision/backing-storage and shared-node failure-path tests, exact packed-object lifetime checks, singleton collision lifetime checks, and full-depth routing/lookup tests at widths 4–7. No baselines or exclusions change. Current-head full-suite and replacement remote coverage validation are in progress.

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