fix: provider/model filters were silently ignored + startup blocked HTTP for the full reindex#70
Merged
Conversation
Two issues blocked v0.6.1 multi-provider from working in real use: 1. Filter query params silently ignored on 5 routes. FastAPI requires ``Query()`` (or ``Annotated[..., Query()]``) to bind repeated list-typed query parameters. Without it the param stays ``None`` regardless of what the URL contains. The routes added in PR #66 used the bare ``list[str] | None = None`` shape, so every ``?provider=...`` / ``?model=...`` filter from FilterBar was being dropped on the server side. Verified live before fix: /api/projects?provider=cursor → 187 projects (all 7 providers) /api/projects?provider=claude → 187 projects (all 7 providers) After fix: /api/projects → 187 projects /api/projects?provider=cursor → 7 projects /api/projects?provider=cursor+cline → 8 projects Used ``Annotated[list[str] | None, Query()] = None`` so direct in-process calls (existing test pattern) keep getting ``None`` as the default while HTTP-bound calls go through FastAPI's normal parameter binding. 9 bindings touched across projects, sessions, cost, data (dashboard-data + messages), optimize. 2. Startup blocked HTTP for the entire reindex (~90s today, 30+min on cold 188-project store). The ``_lifespan`` handler ran ``run_ingest()`` synchronously before ``yield``, so the HTTP server didn't actually start serving until ingest finished — even though the CLI wrapper had already printed the misleading "live at..." line. Schema apply still runs sync (cheap, needed by every route), but ``run_ingest`` now runs in a daemon background thread so HTTP starts serving in <1s. The "Ingest complete" log line still fires when the thread finishes; any error in the thread degrades to a single ``logger.error`` call, matching the previous behaviour. 1341 backend tests pass. No version bump. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merged
5 tasks
0bserver07
added a commit
that referenced
this pull request
May 20, 2026
Two issues blocked v0.6.1 multi-provider from working in real use: 1. Filter query params silently ignored on 5 routes. FastAPI requires ``Query()`` (or ``Annotated[..., Query()]``) to bind repeated list-typed query parameters. Without it the param stays ``None`` regardless of what the URL contains. The routes added in PR #66 used the bare ``list[str] | None = None`` shape, so every ``?provider=...`` / ``?model=...`` filter from FilterBar was being dropped on the server side. Verified live before fix: /api/projects?provider=cursor → 187 projects (all 7 providers) /api/projects?provider=claude → 187 projects (all 7 providers) After fix: /api/projects → 187 projects /api/projects?provider=cursor → 7 projects /api/projects?provider=cursor+cline → 8 projects Used ``Annotated[list[str] | None, Query()] = None`` so direct in-process calls (existing test pattern) keep getting ``None`` as the default while HTTP-bound calls go through FastAPI's normal parameter binding. 9 bindings touched across projects, sessions, cost, data (dashboard-data + messages), optimize. 2. Startup blocked HTTP for the entire reindex (~90s today, 30+min on cold 188-project store). The ``_lifespan`` handler ran ``run_ingest()`` synchronously before ``yield``, so the HTTP server didn't actually start serving until ingest finished — even though the CLI wrapper had already printed the misleading "live at..." line. Schema apply still runs sync (cheap, needed by every route), but ``run_ingest`` now runs in a daemon background thread so HTTP starts serving in <1s. The "Ingest complete" log line still fires when the thread finishes; any error in the thread degrades to a single ``logger.error`` call, matching the previous behaviour. 1341 backend tests pass. No version bump. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Two unrelated bugs surfaced today on real multi-provider data.
Bug 1 — filter query params dropped server-side
PR #66 added
?provider=/?model=to 5 routes but bound them as barelist[str] | None = None. FastAPI silently keeps theseNoneregardless of URL — every FilterBar toggle in the UI was being thrown away by the backend.Verified live before fix:
After fix:
Used
Annotated[list[str] | None, Query()] = Noneso direct in-process calls (test pattern) keepNonedefaults while HTTP-bound calls go through FastAPI binding. Touched: projects, sessions, cost, data (dashboard-data + messages), optimize.Bug 2 — startup blocked HTTP for the full reindex
_lifespanranrun_ingest()synchronously beforeyield. Today's startup: 89s of dead time before HTTP started binding, even though the CLI wrapper had already printed "live at http://127.0.0.1:8095". Cold 188-project store would block for ~30 min.Now: schema apply stays synchronous (cheap, needed by every route),
run_ingest()runs in a daemon thread. HTTP starts serving in <1s. "Ingest complete" log still fires when the thread finishes.Test plan
pytest tests/ -q→ 1341 passed, 2 skipped?provider=cursoractually returns 7 projects, not 187🤖 Generated with Claude Code