Skip to content

insert_prefix at a mid-key focus corrupts a LineListNode #79

Description

@adamv-symbolica

WriteZipper::insert_prefix (master code).

map = {aaa}
map.write_zipper().descend_to(b"a"); insert_prefix(b"b");
map.iter() -> ["abaa", "aaa"]          // the stale path is still reachable
validate_node(root) -> "ambiguous path violation"   // child at slot 0 with a key that prefixes slot 1's

Same invalid node shape that master's lean/FINDINGS.md §14 (PR #69) records for graft;
insert_prefix is another route to it (their §4 covers only insert_prefix("")). The PR's Case 3
debug_assert_eq!(key1.len(), 1) trips on such nodes — keep that assert — and in release the recursive
engine would misplace the value. Until fixed, path-sensitive cata results on maps mutated by
insert_prefix/graft cannot be trusted, and the randomized cata tests should avoid those operations
at mid-key foci.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions