Skip to content

Phase 4a: Break searchContext and ingestSession into pipeline stages#159

Merged
gvonness-apolitical merged 2 commits intomainfrom
refactor/phase-4a-pipelines
Mar 13, 2026
Merged

Phase 4a: Break searchContext and ingestSession into pipeline stages#159
gvonness-apolitical merged 2 commits intomainfrom
refactor/phase-4a-pipelines

Conversation

@gvonness-apolitical
Copy link
Copy Markdown
Contributor

Summary

  • search-assembler.ts: Refactor searchContext from 440-line monolith into 6 extracted stage functions + 120-line orchestrator. Eliminates 4x agent post-filtering duplication and 2x entity boost duplication.
  • ingest-session.ts: Refactor ingestSession from 370-line monolith into 3 composable stages + simplified orchestrator. Sub-agent processing kept inline (complex team branching).

Zero behavior change — pure structural refactoring.

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
  • All 197 retrieval tests pass
  • All 185 ingest tests pass
  • All 3 integration tests pass

Extract 6 functions from the monolithic searchContext:
- filterByAgent: eliminates 4x duplicated agent post-filtering
- applyEntityBoost: shared entity boost RRF fusion
- keywordPrimarySearch: keyword-first retrieval path
- indexBasedSearch: hybrid retrieval via semantic index
- chunkBasedSearch: hybrid fallback via chunk vectors
- postProcessResults: shared post-processing pipeline

searchContext is now a clear orchestrator: pick path → fuse → post-process.
Extract 3 stage functions from the monolithic ingestSession:
- validateAndSetup: session info, checkpoints, mtime, skip checks
- assembleSessionTurns: stream/file parsing, incremental filtering
- initializeEmbedding: embedder setup with error recovery

Sub-agent processing kept inline (complex team topology branching).
@gvonness-apolitical gvonness-apolitical merged commit 09df638 into main Mar 13, 2026
3 checks passed
@gvonness-apolitical gvonness-apolitical deleted the refactor/phase-4a-pipelines branch March 13, 2026 18:09
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