Skip to content

Phase 3: Consolidate duplication in vector-store and tools#158

Merged
gvonness-apolitical merged 2 commits intomainfrom
refactor/phase-3-dedup
Mar 13, 2026
Merged

Phase 3: Consolidate duplication in vector-store and tools#158
gvonness-apolitical merged 2 commits intomainfrom
refactor/phase-3-dedup

Conversation

@gvonness-apolitical
Copy link
Copy Markdown
Contributor

Summary

  • vector-store.ts: Extract removeVectorsAndRelated() — consolidates ~80 lines of duplicated cleanup logic from cleanupExpired() and evictOldest() into a shared private method
  • tools.ts: Extract recordRetrievalSafe() — replaces 3 identical try/catch blocks in search/recall/predict handlers
  • tools.ts: Extract extractRetrievalArgs() — replaces repetitive arg extraction across the same 3 handlers

Net: -53 lines, zero behavior change.

Test plan

  • npm run build:server passes
  • npm test — 2559 tests pass (121 files)
  • npm run lint — 0 errors, 0 warnings
  • npm run format:check — all files compliant

Consolidate ~80 lines of duplicated cleanup logic from cleanupExpired()
and evictOldest() into a shared private method that handles chunk
deletion, empty cluster removal, orphaned index entry cleanup, and
memory state sync.
- recordRetrievalSafe: replaces 3 identical try/catch blocks around
  recordRetrieval() in search, recall, and predict handlers
- extractRetrievalArgs: replaces repetitive arg extraction (query,
  project, agent, maxTokens) across the same 3 handlers
@gvonness-apolitical gvonness-apolitical merged commit 24c5096 into main Mar 13, 2026
3 checks passed
@gvonness-apolitical gvonness-apolitical deleted the refactor/phase-3-dedup branch March 13, 2026 18:00
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