Skip to content

Index ownership consolidation — retire the per-ComponentTable secondary index #629

Closed
12 of 12 issues completed
Closed

Description

@nockawa

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

Phase 2 — make the surviving home safe to depend on

Phase 3 — fix the consumers

Phase 4 — one home

Evidence

Measured on branch feature-629 (throwaway probes, uncommitted):

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).

Sub-issues

Sub-issues

12 of 12 Issues completed
Loading 12 sub-issues

Activity

  1. added theissue type on Jul 31, 2026
  2. added 2 commits that reference this issue on Jul 31, 2026
  3. updated Area Query, Product Engine and Priority P1-High on Jul 31, 2026
  4. 3 remaining items

  5. changed the title [-]FK navigation over cluster-backed archetypes (SingleVersion sources)[/-] [+]Index ownership consolidation — retire the per-ComponentTable secondary index[/+] on Aug 3, 2026
  6. updated Estimate XL and Area Indexes on Aug 3, 2026
  7. moved this to In Progress in Typhonon Aug 3, 2026
  8. moved this from In Progress to Done in Typhonon Aug 5, 2026
  9. added a commit that references this issue on Aug 5, 2026
  10. added 2 commits that reference this issue on Aug 6, 2026
  11. added a commit that references this issue on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Priority

    P1-High

    Estimate

    XL

    Area

    Indexes

    Start date

    None yet

    Target date

    None yet

    Product

    Engine

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions