ebox/.runtime-index-plan.md

52 lines
3.0 KiB
Markdown

# Runtime persistent index cleanup plan
1. Lock the persistent index contract: exact `equal` keys, nil values,
collision buckets, immutable put/delete, count/map/keys, and legacy hash
adapters.
2. Add one fixed-depth radix index module and load it before tree, patch-plan,
incremental, surface, and native commit consumers.
3. Bootstrap node, parent, and region-owner indexes directly into immutable
indexes; store native postorder as node IDs. Bind the generated ID format
to the exact read-only vector; convert unmarked legacy entries with complete
candidate membership validation before retaining that format.
4. Change local candidate preparation to path-copy only removed/touched node and
affected-region keys. Keep all other state tables on their current path.
5. Migrate readers and compatibility entry points to the common adapters.
Preserve hash-table inputs at package boundaries.
6. Keep the complete topology comparison, including untouched surface objects
and source keys. Key-set identity tokens prove only persistent index
membership: value updates retain the token, membership changes replace it,
and unrelated index lineages use the exact key comparison.
7. Verify focused index and candidate regressions, then compile/checkdoc/full
ERT serially after coordinating CPU use with the root agent.
Stop when all production consumers of the three runtime indexes use adapters,
local candidates perform no whole-table copy/remap, and the focused plus full
validation gates pass. Report remaining full work in region-box/count/source
and other state tables.
## Compressed radix follow-up
The compiled fixed-depth version passed behavior checks but regressed measured
row/theme/filter/pagination latency. It is not accepted for integration.
1. Preserve the measured fixed-depth module, compiled bytecode, tests, and
reviewed patch outside the checkout before editing.
2. Add regressions for compressed branching depth and exact key semantics:
prefix divergence above an existing branch; colliding 64-bit integer codes;
colliding noninteger keys; nil values; deletion collapse and fork isolation;
and deletion of the key that supplied a branch's representative code.
3. Replace mandatory-depth roots with nil, exact collision leaves, and
16-way branch vectors carrying their actual nibble shift and representative
code. Branches have at least two children and increasing child shifts.
Put returns its membership-change flag without a separate lookup. Delete
replaces unary branches with their surviving child.
4. Keep key-set tokens, hash-table adapters, native postorder representation,
full topology validation, and all publication/rollback paths unchanged.
5. After the CPU owner releases its slot, run focused regressions, compiled
old/new index cost comparisons, then required package checks serially.
Report actual costs to the root agent for full workload measurement.
Accept this follow-up only after semantic checks pass and measured costs
improve; compressed structure alone does not establish end-to-end latency.