Skip to content

Index phase 3: CoreState dedup for ProjectIndex/DependencyIndex - #82

Merged
rochala merged 2 commits into
mainfrom
index/phase3-core-state
May 24, 2026
Merged

rochala merged 2 commits into
mainfrom
index/phase3-core-state

Conversation

@rochala

@rochala rochala commented May 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extract private[index] CoreState(symbols, nameTrie, camelCaseTrie, subtypes) with pure add(List[IndexedSymbol]) / remove(Set[SymbolId]) helpers — the trie/subtypes scaffolding now lives in one place.
  • ProjectIndex.State wraps core + byFile + references + refsByFile; DependencyIndex.State wraps core + jarFilters + symbolJar. Bloom filters stay on DependencyIndex per the architecture plan.
  • The var nameTrie = ...; nameTrie = nameTrie.insert(...) accumulator loops collapse to foldLeft over CoreState.add / CoreState.remove. Wrapping state-update sites are now ~11–22 lines each (down from ~41–55).

Implements Phase 3 of ai/architecture-improvements.md.

Test plan

  • ./mill sls.compile — clean
  • ./mill sls.test — 598/598 SUCCESS (including ProjectIndexSpec, DependencyIndexSpec, CrossProducerSpec, IndexManagerSpec, the reference-set / round-trip determinism specs)
  • ./mill sls.fix --check — clean

🤖 Generated with Claude Code

rochala and others added 2 commits May 24, 2026 22:50
Extract `private[index] CoreState(symbols, nameTrie, camelCaseTrie, subtypes)`
with `add(List[IndexedSymbol])` / `remove(Set[SymbolId])`. ProjectIndex.State
wraps `core + byFile + references + refsByFile`; DependencyIndex.State wraps
`core + jarFilters + symbolJar`. The var-accumulator trie loops collapse to
`foldLeft` over CoreState; wrapping state-update sites are ~11-22 lines each
(down from ~41-55). Bloom filters stay on DependencyIndex per plan.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Seals the only site that mutated CoreState fields outside its add/remove
API, so future invariants in CoreState can't be silently bypassed.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@rochala
rochala merged commit e1cb4bc into main May 24, 2026
1 check passed
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