Skip to content

Fix set_val_at #175 - #176

Merged
luketpeterson merged 2 commits into
Adam-Vandervorst:masterfrom
adamv-symbolica:fix-set-val-at-below-focus
Nov 3, 2026
Merged

luketpeterson merged 2 commits into
Adam-Vandervorst:masterfrom
adamv-symbolica:fix-set-val-at-below-focus

Conversation

@adamv-symbolica

Copy link
Copy Markdown
Contributor

Claude 5.5 xhigh:

When the write zipper's focus has no child node of its own, with_node_at_path joined the focus key and the relative path and handed the whole key to the parent node's node_set_val / node_set_branch. Those expect a key that doesn't pass through a child, so a child further along the key (e.g. xa from earlier writes of xab and xac) was split around instead of entered. The write then landed beside the existing path, giving a duplicate value or a value the trie can't reach (#175). It now enters such a child, as the root case already does.

The branch for a focus key plus path longer than a node key had the same defect inside the subtrie it takes from below the focus, and now walks it the same way.

When the write zipper's focus has no child node of its own, `with_node_at_path`
joined the focus key and the relative path and handed the whole key to the
parent node's `node_set_val` / `node_set_branch`. Those expect a key that
doesn't pass through a child, so a child further along the key (e.g. `xa` from
earlier writes of `xab` and `xac`) was split around instead of entered. The
write then landed beside the existing path, giving a duplicate value or a value
the trie can't reach (Adam-Vandervorst#175). It now enters such a child, as the root case
already does.

The branch for a focus key plus path longer than a node key had the same
defect inside the subtrie it takes from below the focus, and now walks it the
same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@luketpeterson

Copy link
Copy Markdown
Collaborator

Good fix for a nasty bug. Could also have impacted zipper creation at a relative path too.

@luketpeterson
luketpeterson merged commit b384d1b into Adam-Vandervorst:master Nov 3, 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.

2 participants