Repository navigation
Description
Scope change (2026-08-03). This issue was "FK navigation over cluster-backed archetypes (SingleVersion sources)". Investigation showed that FK navigation is one symptom of a systemic split in index ownership, and that the split is itself an unfinished implementation of ADR-045. The original scope now lives in #662; this issue is the umbrella through to completion.
The root fact
Secondary field indexes live in two homes:
| Home | Scope | Value stored |
|---|---|---|
Per-ComponentTable — ComponentTable.IndexedFieldInfos[i].PersistentIndex |
one tree per component type, shared by every archetype holding it | chunk id |
Per-archetype — ArchetypeClusterState.IndexSlots[s].Fields[f].Index |
one tree per archetype per indexed field | packed ClusterLocation |
Which home applies is decided by the ARCHETYPE's composition, not by the component's declared storage mode. An archetype with ≥1 SingleVersion or Transient slot is cluster-eligible and uses the per-archetype home for all its components, Versioned ones included (DatabaseEngine.cs:2753-2804; ArchetypeClusterState.InitializeIndexes:2746 skips only Transient).
Consumers that read only the per-ComponentTable home return silently empty results on cluster-backed archetypes.
| Feature | Pure-Versioned archetype | Archetype with any SV component |
|---|---|---|
WhereField().Execute() |
works | works |
WhereField().ToView() |
works | broken — always empty |
NavigateField, Versioned source |
works | broken — silently empty |
NavigateField, SV source |
n/a | throws (the #623 guard) |
| Cascade delete | works | broken — deletes no children |
This completes ADR-045 rather than superseding it
ADR-045 (Accepted 2026-04-07, #214) §2 chose per-archetype ownership and §5 declared "Single storage path (no dual-mode fallback)", listing as a positive consequence "All three storage modes (SV, Versioned, Transient) cluster-eligible."
That consequence has been factually false since April. Pure-Versioned archetypes stay legacy (DatabaseEngine.cs:2798) and Transient-indexed archetypes are excluded (:2781). The shipped code is the dual-mode world §5 rejected — and every defect below lives in that gap.
Why not stop halfway
Removing only one exclusion leaves both homes implemented, every consumer still branching, and the legacy path serving a rare population. A rarely-exercised path has the same complexity and far less coverage, so its defect rate rises. Either reach one home or do not start — the Phase 2 prerequisites are worth doing on their own merits regardless.
Phases
Ordering is load-bearing: Phase 1 shrinks Phase 2, and Phase 3 delivers user-visible value before the riskiest work.
Phase 1 — remove the last archetype-wide exclusion
- Remove the Transient-indexed archetype cluster exclusion #655 Remove the Transient-indexed archetype cluster exclusion
Phase 2 — make the surviving home safe to depend on
- RB-01 crash rebuild for the per-archetype index home #656 RB-01 crash rebuild for the per-archetype index home (blocker)
- Per-archetype index StableId collides across component slots #657 Per-archetype index
StableIdcollides across component slots - String64 index on a cluster-backed archetype uses the wrong segment stride #658 String64 index on a cluster-backed archetype uses the wrong segment stride
- Cluster fence drain ignores AllowMultiple and wipes every entity at a key #659 Cluster fence drain ignores
AllowMultipleand wipes every entity at a key - View delta entries publish EntityKey where consumers expect EntityId #660 View delta entries publish
EntityKeywhere consumers expectEntityId - Move the per-archetype index SPI into ArchetypeR1 #661 Move the per-archetype index SPI into
ArchetypeR1
Phase 3 — fix the consumers
- FkReverseLookup: cluster-aware FK navigation (original #629 scope) #662
FkReverseLookup: cluster-aware FK navigation (the original Index ownership consolidation — retire the per-ComponentTable secondary index #629 scope) - Incremental views are permanently empty on cluster-backed archetypes #663 Incremental views are permanently empty on cluster-backed archetypes
- Cascade delete finds no children on cluster-backed child archetypes #664 Cascade delete finds no children on cluster-backed child archetypes
Phase 4 — one home
- Port write-path guards to the per-archetype index home #665 Port write-path guards to the per-archetype index home
- Delete the per-ComponentTable secondary index (A5) #666 Delete the per-ComponentTable secondary index (A5)
Evidence
Measured on branch feature-629 (throwaway probes, uncommitted):
WhereField().ToView()on a cluster archetype:Execute()→ 1 result,ToView()→ 0, before any delta (Incremental views are permanently empty on cluster-backed archetypes #663)- Delta published
EntityPK=2for an entity whoseRawValueis131082, routing id10(View delta entries publish EntityKey where consumers expect EntityId #660) [Index]onString64in a cluster archetype:DebugAssertException: segment.Stride == sizeof(IndexString64Chunk)(String64 index on a cluster-backed archetype uses the wrong segment stride #658)
Verified in code, not reproduced: #655, #659, and the TAIL findings in #666. #657 and #664 have since been reproduced by regression tests — #664 in both halves: forcing the non-cluster partition leaves the children alive, forcing the Versioned PK decode throws the predicted NullReferenceException.
Cost summary
No WAL change, no checkpoint-pipeline change, no backup code exists, no DatabaseFormatRevision bump. Tests: ~70 methods change (1.7% of 4,177); ~666 re-run. Only six test files touch per-ComponentTable index internals. Zero tracked benchmark baselines invalidated.
Design: claude/design/Indexing/index-ownership-consolidation.md (in the typhon-claude docs repo) — full blast-radius analysis, per-phase detail, acceptance criteria, and the open questions deliberately left out of scope (navigation's O(T) target scan, join-strategy estimator, IndexRef semantics).
Activity
#623 Fix the two Versioned-only read paths behind FK navigation, and …
#582 #623 Bug bash: 17 correctness fixes across durability, spatial, …
3 remaining items
[-]FK navigation over cluster-backed archetypes (SingleVersion sources)[/-][+]Index ownership consolidation — retire the per-ComponentTable secondary index[/+]Log2n-io#629 Retire the per-ComponentTable secondary index (PR Log2n-…
#629 #678 Close items 12-21 of the index-ownership consolidation revi…
#672 Zero the slot location when a revision-chain walk finds nothing
#1383 #1384 #1400 #1401 #1456 #1470 #1478 #1479 The docs describe the…