fix(doctor): resolve route checks by matching, not flat app.routes scan#66
Merged
Merged
Conversation
`filigree doctor`'s dashboard route-registration checks ("Scan results
routes", "Entity association routes") reported registered routes as
missing on any install that resolved FastAPI >= 0.137, failing doctor
(exit 1) even though the routes are served correctly at runtime.
FastAPI 0.137 made `include_router` lazy: child routes are mounted
behind a `_IncludedRouter` wrapper and compose their `/api` (and `/weft`)
prefix only at match time, so the doctor's flat `app.routes` path scan
saw the wrapper's empty path and concluded the routes were missing. CI
never caught it because `uv.lock` pinned FastAPI 0.136.3 while field
installs resolved 0.137.x.
`_route_supports` now resolves routes via Starlette matching
(`route.matches(scope)`) instead of path-string scanning — version-
agnostic, method-aware, prefix-composing. The lock moves forward to
FastAPI 0.137.1 / Starlette 1.3.1 so CI exercises the version field
installs actually receive (no upper cap added).
The lock bump's newer TestClient shifted GC timing and unmasked two
pre-existing test-hygiene leaks: tests that opened a DB via
`_attempt_startup` (process-lifetime on `mcp_server.db`, closed at
shutdown in production) but abandoned the handle without closing it,
so the connection was finalized mid-session and tripped the suite's
`error::ResourceWarning` filter. Closed both, matching the close-after-
startup pattern the other `_attempt_startup` tests already use.
Bumps to 3.0.1 so fixed installs are distinguishable from the 3.0.0
builds carrying the false-positive.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Button up the [3.0.1] entry with its compare link, matching the reference-link convention used for every prior release. Co-Authored-By: Claude Opus 4.8 (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.
Problem
filigree doctorfails (exit 1) with false-positive "missing route" errors on any install that resolves FastAPI ≥ 0.137:The routes are served correctly at runtime — only the doctor's static introspection is fooled.
Root cause
FastAPI 0.137 made
include_routerlazy: child routes are mounted behind afastapi.routing._IncludedRouterwrapper whose child paths stay unprefixed and compose the/api(and/weft) prefix only at match time. The doctor built a route table by flat-scanningapp.routesfor.pathstrings — under 0.137 it sees the wrapper's empty path and concludes every included route is missing.CI never caught it because
uv.lockpinned FastAPI 0.136.3 (which still eager-flattens) while realuv tool installs resolve 0.137.x. Classic "green in CI, broken in the field."Fix
_route_supportsnow resolves routes via Starlette matching (route.matches(scope)) instead of path-string scanning — version-agnostic, method-aware, prefix-composing. Works on both old and new FastAPI.uv.lockmoves forward to FastAPI 0.137.1 / Starlette 1.3.1 so CI exercises the version field installs receive. No upper cap added (the matching fix is version-agnostic by design)._attempt_startup-opened DB without closing it, tripping the suite'serror::ResourceWarningfilter). Matches the close-after-startup pattern the sibling_attempt_startuptests already use.Tests
TestRouteSupports(RED-first against the real 0.137 bug): included-router detection, HTTP-method enforcement, absent-route handling.test_run_doctor_emits_real_route_and_auth_checksnow genuinely exercises 0.137.Field rollout
Existing installs need a
uv tool install --reinstallof 3.0.1 — not a data migration. Their stores are already current.🤖 Generated with Claude Code