Repository navigation
Description
Split from #4965.
The change of #4965 deletes the weighted SearchReranker and lets the RRF order of the hybrid step stand. Its quality gain and its latency need a measurement that the pull request of #4965 cannot make. This issue makes that measurement and records the result on #4965.
Proposed design
Problem statement
Measure the quality and the median latency of the fusion-order change of #4965 over the checked-in knowledge-base gold set, and record the result on #4965. The eval arm fits one pull request and waits on #4965. The production arm waits on the deployment of #4965 and is deferred to its own issue.
Acceptance criteria
Requirement: Offline fusion-order harness
The RAG module SHALL hold an offline harness that runs hybrid retrieval over a gold set and a document set and reports the quality and the median latency of the run.
Scenario: One measured revision
- WHEN A test calls the harness with a temporary gold set, a temporary document set, a fake Qdrant client and a fake embedder.
- THEN The harness returns one quality value and one median latency value for the run.
Requirement: Quality metric at 5
The harness SHALL compute nDCG at 5 from the ranked result and the qrels that the gold set's expected sources build.
Scenario: Ranked result matches the qrels
- WHEN A test gives the harness a fixture whose ranked result lists exactly the relevant documents of its qrels.
- THEN The harness reports nDCG at 5 of 1.0, and it reports a value below 1.0 when the ranked result omits a relevant document.
Requirement: Revision-agnostic retriever call
The harness SHALL build the retriever with no reranker argument and SHALL write the revision under test into its record, so one harness measures the weighted-reranker arm and the RRF arm.
Scenario: Two revisions, two records
- WHEN A test runs the harness twice with two revision labels and reads the two records.
- THEN Each record holds its own revision label with its own metric value, and the harness module source holds no
SearchRerankername.
Requirement: Machine-readable record
The harness SHALL write each run as a JSON record that holds the revision, the eval set name, the metric name, the metric value and the latency.
Scenario: Record fields
- WHEN A test runs the harness on the fixture and loads the JSON record that it writes.
- THEN The record holds the keys
revision,eval_set,metric,valueandlatency_ms.
Requirement: Pending a person after the merge
The item SHALL record the quality and the latency of the eval arm on issue #4965, with the path of the committed record.
Scenario: Result comment on #4965
- WHEN
devops gh issue view 4965 --commentsreads the comments of fix(ai): rank RAG hits by fusion, not by the weighted score #4965 after the pull request of this item merges. - THEN A comment holds the path of the record under
docs/and the quality and the latency of the eval arm.
Existing Tool Considered
No alternatives check has run. The open library pytrec_eval (distribution pytrec-eval-terrier, MIT) covers nDCG at 5. The project already holds retrieval-metrics code that reports NDCG at 5 for its embedding benchmark (src/devops_cli/ai/benchmark/embedding_runner.py), and tests/ai/benchmark/test_retrieval_metrics.py covers it. The change reuses that code and adds no metric dependency. The harness that calls the hybrid retriever, times each query and writes the record is new project code: about 4,000 tokens to build, 1,000 tokens per year to keep and fix, and about 1 hour of elapsed work.
Key questions
- Which revisions does the measurement compare?: The parent commit of the merge of fix(ai): rank RAG hits by fusion, not by the weighted score #4965 and the head of fix(ai): rank RAG hits by fusion, not by the weighted score #4965. The parent holds the weighted
SearchRerankerinsrc/devops_cli/ai/rag/reranker.py, and the retriever builds it insrc/devops_cli/ai/rag/retriever.py. The RRF arm exists only after fix(ai): rank RAG hits by fusion, not by the weighted score #4965 lands, so this item depends on fix(ai): rank RAG hits by fusion, not by the weighted score #4965. [sources: src/devops_cli/ai/rag/reranker.py, src/devops_cli/ai/rag/retriever.py] - Where do the eval query set and its relevant documents live?: The checked-in gold set at
tests/fixtures/kb_gold_set/gold_set.jsonholds 12 entries. Each entry has aquestionand theexpected_sourcethat is its relevance judgment.load_gold_setinsrc/devops_cli/ai/benchmark/gold_set.pyreads it.score_gold_setinsrc/devops_cli/ai/benchmark/gold_set_scorer.pycallsSemanticRetriever.searchwithhybrid=False, so it does not exercise the RRF order. The harness callssearchwithhybrid=True. [sources: tests/fixtures/kb_gold_set/gold_set.json, src/devops_cli/ai/benchmark/gold_set.py, src/devops_cli/ai/benchmark/gold_set_scorer.py, docs/TESTING.md] - Which code computes the retrieval quality metric?: The retrieval-metrics code that the project already holds. The embedding benchmark reports NDCG at 5 with a p50 latency in
src/devops_cli/ai/benchmark/embedding_runner.py, andtests/ai/benchmark/test_retrieval_metrics.pycovers that code. The archived gold-set change rejectedranxandir_measuresbecause the retriever seam already ranks results. The harness reuses that code and adds no metric dependency. (best practice) [sources: src/devops_cli/ai/benchmark/embedding_runner.py, tests/ai/benchmark/test_retrieval_metrics.py, openspec/changes/archive/2026-11-17-3902-a-gold-set-measures-retrieval-of/design.md]- Chosen: Reuse the project's retrieval-metrics code. The embedding benchmark already reports NDCG at 5, and the tests cover the code, so the harness adds no metric code and no dependency.
- Rejected: Add pytrec_eval (pytrec-eval-terrier). It duplicates the nDCG code that the project already holds and tests.
- Rejected: Add ir_measures. The archived gold-set change rejected a metric dependency because the retriever seam already ranks results.
- Rejected: Write an nDCG function in the harness. It duplicates the code that the project already holds and tests.
- Which cutoff does the quality metric use?: nDCG at 5. The review loop injects the top 5 results, the gold-set scorer reports its hit rate at k=5, and the embedding benchmark reports NDCG at 5 with a p50 latency. The fusion-order measurement uses the same depth and the same latency statistic. (best practice) [sources: src/devops_cli/ai/benchmark/gold_set_scorer.py, src/devops_cli/ai/benchmark/embedding_runner.py]
- Chosen: nDCG at 5. It matches the depth of results that the review loop injects and the metric that the embedding benchmark reports.
- Rejected: nDCG at 10. It scores documents past the depth that the loop injects, so it measures a ranking that production never reads.
- Where does the harness live and how is it invoked?: A module under
src/devops_cli/ai/rag/with a__main__entry point. The same file runs by path withPYTHONPATH=<worktree>/srcfor the parent arm. The module sits with the retriever that it measures. A run by path keeps the harness module out of the package that the parent worktree supplies. (best practice) [sources: CONTEXT.md, src/devops_cli/ai/rag/retriever.py]- Chosen: A module under
src/devops_cli/ai/rag/with a__main__entry point. It sits with the retriever that it measures and runs by path on both revisions without a new CLI command. - Rejected: A CLI command. The measurement is a one-off verification, and a new CLI command adds a user-facing surface and a generated reference.
- Rejected: A script under
scripts/. The module belongs with the retriever that it measures. - Rejected: A test under
tests/ai/rag/. The measurement must run outside CI, on two revisions.
- Chosen: A module under
- How does the harness measure the parent revision?:
git worktree addof the parent revision, and a run of the harness file by path withPYTHONPATH=<worktree>/src. The parent'sdevops_clipackage loads, and the harness file's module is__main__. The project already makes worktrees withdevops repos worktrees add. (best practice) [sources: CONTEXT.md, src/devops_cli/ai/rag/retriever.py]- Chosen: Worktree of the parent revision, harness file run by path with
PYTHONPATH=<worktree>/src. The parent revision's package loads first, and the harness file stays in one copy. - Rejected: Install the parent revision in a second virtual environment. It duplicates the environment and takes minutes for each run.
- Rejected: Copy the harness file into the worktree. Two copies of the harness can drift.
- Chosen: Worktree of the parent revision, harness file run by path with
- How does one harness measure both arms?: The harness builds the retriever with no
rerankerargument and callssearchwithhybrid=Trueand norerankargument. The parent then applies its weightedSearchReranker, and the new revision applies the RRF order. One harness file measures both arms, and the record holds the revision label. (best practice) [sources: src/devops_cli/ai/rag/retriever.py, src/devops_cli/ai/rag/reranker.py, src/devops_cli/ai/benchmark/gold_set_scorer.py]- Chosen: Leave the rerank setting at the revision's default. The parent applies its weighted reranker and the new revision applies the RRF order, so one harness measures the change.
- Rejected: Pass
rerank=Falsetosearch. It skips the weighted reranker in the parent arm and measures no fusion-order change. - Rejected: Pass a
rerankerargument. The new revision holds noSearchReranker, so the call fails on one arm.
- Where is the measurement recorded?: The harness writes a JSON record. The pull request commits it under
docs/. A comment on fix(ai): rank RAG hits by fusion, not by the weighted score #4965 holds the numbers with the record path. The production arm is deferred to its own issue. (best practice) [sources: docs/TESTING.md, CONTEXT.md]- Chosen: A JSON record under
docs/plus a comment on fix(ai): rank RAG hits by fusion, not by the weighted score #4965. The tree keeps a durable copy, and fix(ai): rank RAG hits by fusion, not by the weighted score #4965 holds the result beside its change. - Rejected: A comment on fix(ai): rank RAG hits by fusion, not by the weighted score #4965 only. A comment is no durable copy in the repository.
- Rejected: A file in the change folder only. The archive of the change buries the record.
- Chosen: A JSON record under
Fit
Fits in one pull request.
Suspected block
None.
Activity
devops-cli-service commentedon Nov 18, 2026
Both concern the RAG fusion-order change; #4965 delivers the code change, the candidate delivers the eval and production measurement of that change.[-]perf(rag): verify the fusion-order change on the eval set and in production[/-][+]perf(rag): Verify the fusion-order change on eval and production[/+]devops-cli-service commentedon Nov 18, 2026
The job shortened the title of this item. The summary had 64 characters, and the limit is 60. The type and the scope stay.
perf(rag): verify the fusion-order change on the eval set and in productionperf(rag): Verify the fusion-order change on eval and productiondevops-cli-service commentedon Nov 19, 2026
Refine cannot set this item to Ready at 3ecd647 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
The next refine round also looks at the item again when a commit on the default branch changes one of these files:
src/devops_cli/ai/rag/reranker.py,src/devops_cli/ai/rag/retriever.py.devops-cli-service commentedon Nov 27, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies and Watched files in the section Proposed design of the body.
devops-cli-service commentedon Nov 29, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.