~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
ADR-0010: Test-coverage provenance across the FastAPI migration
Date: 2026-08-19 Status: Accepted Amendment: 2026-08-30, tracked in #6007
Context
PR #3299 replaced Flask request-layer tests with FastAPI tests. Git similarity and test names could not reliably pair predecessors with successors because framework APIs and ownership boundaries changed together.
A net test count is not proof of retained behavior. It combines obsolete framework checks, rewritten behavior checks, new regression coverage, and tests removed from files that still exist. Module-level collection skips are a separate blind spot because a file can remain in the tree while contributing no tests.
Decision
For this migration, review removed tests at the behavior level. A valid disposition identifies either a committed successor that exercises the same behavior or the mechanism that makes the predecessor inapplicable. Filename similarity alone is not evidence.
Keep the durable review result as this decision record, an exact historical snapshot identifier, aggregate measurements, limitations, and executable regression tests. Do not retain the raw per-test working ledger in the normal repository tree. Its point-in-time labels cannot represent current product or security status and become misleading as tests are renamed or the PR is squash merged.
Current non-sensitive work belongs in
GitHub issues.
Potential current security concerns follow
SECURITY.md. This ADR is neither a current task list nor
a vulnerability advisory.
Status for retained non-sensitive migration follow-up is owned by issues #5842, #5843, #5844, #5845, #5846, #5847, #5848, #5849, and #5850. This ADR does not restate their details or open/closed status.
Historical snapshot
The measurements below compare these exact revisions:
- measured migration tree:
7c298956669c5b7cf112d194435eb55a9b782af2; - mainline comparison point:
fa466ad13de57a1cb4a79493df59fe18acce5657.
They describe the reviewed PR state only. They are not current suite totals.
Raw totals use this exact definition-line regex and include Python files at the
root of tests/ and in all nested directories:
git grep -E '^[[:space:]]*(async[[:space:]]+)?def[[:space:]]+test_' \
fa466ad13de57a1cb4a79493df59fe18acce5657 -- \
':(glob)tests/*.py' ':(glob)tests/**/*.py' | wc -l # 36,720
git grep -E '^[[:space:]]*(async[[:space:]]+)?def[[:space:]]+test_' \
7c298956669c5b7cf112d194435eb55a9b782af2 -- \
':(glob)tests/*.py' ':(glob)tests/**/*.py' | wc -l # 36,153
In a repository containing both objects, git merge-base for the recorded
revisions is the comparison revision. While GitHub retains PR #3299's head ref,
a clone missing the objects can attempt:
git fetch origin refs/pull/3299/head:refs/remotes/origin/pr-3299
git cat-file -e 7c298956669c5b7cf112d194435eb55a9b782af2^{commit}
git cat-file -e fa466ad13de57a1cb4a79493df59fe18acce5657^{commit}
GitHub does not promise indefinite PR-ref retention. Ordinary CI therefore does not require the old objects; the guardian pins the immutable metadata and checks maintained current-tree invariants.
| Measurement | Count |
|---|---|
Raw test_* definitions on the comparison tree |
36,720 |
Raw test_* definitions on the migration tree |
36,153 |
Python files under tests/ absent from the migration tree |
166 |
| Raw definition lines in those absent files | 4,486 |
Distinct (path, test-name) removals across 43 surviving files |
125 |
Distinct (path, test-name) additions across 43 surviving files |
120 |
Raw definition lines in 277 added Python files under tests/ |
3,924 |
| Reconciliation residual (not directly measured) | 32,109 |
The reconciliation is 4,486 + 125 + 32,109 = 36,720 for the comparison
tree, and 32,109 + 120 + 3,924 = 36,153 for the migration tree. Here 4,486
and 3,924 are raw definition-line counts; 125 and 120 sum per-file AST
test-name set differences (distinct (path, test-name) entries); and 32,109
is the equation's residual, not a measured population of unchanged definitions.
The mixed-unit reconciliation is bookkeeping, not a per-definition
classification.
The remaining buckets are recorded historical evidence from the same pair:
- Enumerate each tree with
git ls-tree -r --name-only <SHA> -- tests, retain Python paths, and partition the path sets into absent, added, and common. - For each blob, collect names of
test_*FunctionDefandAsyncFunctionDefnodes fromast.walk. Sum per-common-path set differences for the 125 removals and 120 additions, independently of rename detection; a signature-only edit is not a name removal plus an addition. - Raw-definition buckets use the regex above, not the AST name-set unit.
These bucket figures are historical review evidence, not a living inventory.
Separate shelving evidence
Shelving was measured at different revisions and is not part of the comparison table or its reconciliation:
| Shelving measurement | Count |
|---|---|
| Pre-port test definitions (AST and raw) | 76 |
| Pre-port module-level-shelved modules | 8 |
| Immediate re-port unskipped pytest cases | 92 |
| Immediate re-port deliberate pytest skips | 21 |
The pre-port revision was a00eb215ece89692876ef8ea8b33c0ea4308986b;
the exact eight measured modules were:
tests/security/test_auth_security.py;tests/security/test_api_security.py;tests/security/test_csrf_protection.py;tests/security/test_cookie_security.py;tests/security/test_pagination_bounds.py;tests/chat/test_chat_socket_events.py;tests/research_scheduler/test_scheduler_edge_cases.py;tests/test_followup_api.py.
All eight used pytest.skip(..., allow_module_level=True). The immediate
re-port revision was 81314eea7a91714fcc4a870b9797dbe259925942. Its eight
modules collect 92 unskipped cases: the 89 re-port cases plus three
same-commit structural controls (test_the_app_fixture_yields_the_production_app,
test_api_v1_router_is_mounted, and test_csrf_middleware_is_installed_on_the_app).
A definition count is not a pytest case count: parametrization expands cases.
tests/news/test_news_input_validation.py was re-ported separately and is
guarded as current evidence, but is not part of these eight-module counts.
The former working tables' 4,455-test total is not retained because it lagged
23 tests added on main: 17 RAG-upload cases now map to
test_rag_routes_upload_main_port.py and test_collection_upload_dedup.py, two
omitted Notes defaults map to test_notes_router_fastapi.py, and four socket
cases from #5600 map to three parametrized/control-aware tests in
test_subscription_owner_scoping.py. The guardian pins the exact successor
names. This resolves the known drift; it is not a completeness claim.
Method
- Enumerate test files and test definitions on both exact revisions.
- Separate deleted files and removals from surviving files.
- Read predecessor assertions and locate executable successors or the replacement mechanism.
- Resolve successor paths and symbols in the committed migration tree.
- Add focused regression tests and negative controls where safety-relevant behavior was not directly asserted.
- Keep the empty-shelf ratchet and the resulting behavior tests as the maintained contract.
The original history-dependent ledger checks were useful while the branch was
open, but they are not durable after squash merge. Once the migration becomes
part of main, a future merge-base...HEAD comparison no longer reconstructs
the historical PR boundary; it either collapses or measures unrelated later
work. A frozen row-by-row ledger would then be unverifiable as current state.
The maintained guardians therefore verify the exact historical metadata,
documentation boundary, empty shelf, and presence of the committed regression
evidence instead of pretending to re-run the old comparison.
Executable invariants
tests/test_migration_decision_records.pyverifies this ADR's exact snapshot identifiers and counts, ensures the removed raw ledger is not republished, and keeps named regression evidence statically collectible; normal pytest CI executes that evidence and resolves runtime marks, hooks, and fixtures.tests/test_migration_shelved_coverage_ratchet.pykeeps migration-era module-level shelving from returning silently.- The required regression modules call production code and remain the authoritative evidence for current behavior.
Limitations
- The snapshot records review evidence for PR #3299, not behavioral equivalence between Flask and FastAPI.
- The removed working tables drifted as the comparison tree changed. This ADR does not claim a complete row-by-row disposition of every predecessor test.
- A surviving test file does not prove every predecessor assertion is retained; focused review and runtime tests provide that confidence.
- Aggregate counts cannot distinguish strong assertions from vacuous ones.
- Integration, browser, upgrade, and deployment testing remain separate release evidence.
Consequences
- Reviewers can identify the exact historical comparison and reproduce it while its Git objects remain available, without mistaking it for current status.
- Current behavior is represented by code and tests; current work is represented by issues or the security process.
- Future migrations should capture the comparison revisions and durable invariants before merge rather than depend on a permanent raw working ledger.
Issue #6007 tracks this documentation-boundary change.