Repository navigation
refactor(retrieval): freeze the v1.5 retrieval, ingestion and citation seams - #161
Merged
Merged
Conversation
…n seams Introduce the contracts v1.5 builds on, with no user-visible behavior change. - Retriever.search() takes a RetrievalRequest and returns a RetrievalResult carrying a RetrievalTrace (strategy, scope, topK, threshold, durationMs). KnowledgeService gains retrieve() and keeps search()'s legacy shape as a delegate over it. - A requested source filter is refused until #94 implements pre-KNN filtering, instead of being silently ignored. Remove the dead, never-read VectorStore.QueryOptions.filter, which declared a capability that did nothing. - Declare CitationCandidate for #155: the cited span exists before the answer, so no post-hoc (and non-deterministic) semantic alignment is needed. - Declare ingestion run/stage and the source/index state split for #95. Verified: npm run typecheck; npm test (345 pass); the RAG eval harness reproduces docs/eval/baseline-v1.4.json byte-for-byte.
…splay id The candidate's identity in the answer is the same [n] the model writes and Citation.index carries; a string id like 'S2' would put a UI format into the domain model. blockId is optional because not every source has block structure.
…no blocks A chunk indexed before block provenance, or from a source that produces no blocks, has no span to point at. The fallback keeps the whole-chunk quote, so the offsets must be optional rather than a fabricated 0..0.
This was referenced Sep 28, 2026
This was referenced Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Introduces the retrieval, ingestion and citation contracts that v1.5 builds on, with no user-visible behavior change.
Why?
The three v1.5 workstreams all need the same seams, and none existed:
Without this step, each issue would grow its own version of retrieval, ingestion and citation, and
KnowledgeServicewould absorb all of them. This is step 0 of epic #154.Related issue
Fixes #160
Related to #154
What changed
Retriever.search(request: RetrievalRequest): Promise<RetrievalResult>;RetrievalResult.tracerecordsstrategy,scope,topK,threshold,durationMsvia a purebuildRetrievalTrace().KnowledgeService.retrieve()is the new entry point and keeps the embedding-space precondition. The legacysearch()keeps itsSearchResult[]shape and now delegates toretrieve(), so existing callers are unchanged.assertFilterSupported) until [Feat] Source scope: retrieve from the current or selected sources, persisted per session #94 implements pre-KNN filtering. The deadVectorStore.QueryOptions.filter— declared but never read, with no matching clause inknnQuerySql()— is removed. Declaring a capability that does nothing is what this issue exists to stop.CitationCandidatedeclared inshared/types/citation.tsfor [Feat] Exact-passage citation: the model cites source spans, not chunks #155: the cited span exists before the answer, so no post-hoc semantic alignment is needed.src/main/services/ingestion/types.ts:IngestionStage,IngestionRun, theSourceState/IndexStatesplit, andisTerminalStage(), for [Feat] Ingestion runs: persistent pipeline state, retry, and non-destructive re-index #95.How was this tested?
npm run typecheck— passes (node, web, test).npm test— 345 pass, 0 fail (5 new:test/retrievalContract.test.ts,test/ingestionTypes.test.ts).npm run build— passes.electron . --eval-harness --eval-out=/tmp/eval-out— and the deterministic report is byte-for-byte identical todocs/eval/baseline-v1.4.json(diffclean).docs/eval/in the repo was not modified.npm run smoke:packaged(no change to Electron/packaging/db-init; the only new module is a pure types entry undersrc/main/services/ingestion/).Checklist
npm run typecheckpasses.npm run buildpasses.Desktop / build changes