Skip to content

Expose StringInterner parent growth and root identity - #503

Draft
helly25 wants to merge 1 commit into
implement/interner-iterator-contractsfrom
implement/interner-parent-introspection
Draft

helly25 wants to merge 1 commit into
implement/interner-iterator-contractsfrom
implement/interner-parent-introspection

Conversation

@helly25

@helly25 helly25 commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

StringInterner children can now identify their topmost root and detect whether their direct parent has grown since the child captured its visible prefix. This supports ownership, lifecycle, and cache-management decisions without changing snapshot visibility or adding hot-path bookkeeping.

AG;DR

  • Add root() to follow borrowed parent links to the topmost interner, including through parents whose captured prefix is empty.
  • Add parent_has_grown() to compare the direct parent's current visible size with first_local_id().
  • Keep the frozen-prefix contract unchanged: later parent or ancestor strings do not become visible to an existing child.
  • Avoid a stored root pointer, revision counter, or separate parent-presence state; the existing parent link and captured boundary are sufficient.
  • Document direct-parent-only semantics, synchronization, and ancestor-lifetime requirements.
  • Test root identity, direct versus distant ancestor growth, duplicate insertion, and unchanged child lookup visibility.

Validation:

  • bazel test //mbo/strings:string_interner_test
  • Focused pre-commit checks pass with local clang-tidy and trunk formatting intentionally skipped; CI remains authoritative for clang-tidy.

Known limitation: these borrowed relationships continue to require externally managed ancestor lifetimes and synchronization, matching the existing StringInterner contract.

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