Skip to content

fix(ci): restore a green build — FastAPI route introspection and two undocumented MCP tools#31

Merged
lfnothias merged 2 commits into
mainfrom
fix/ci-green
Jul 10, 2026
Merged

fix(ci): restore a green build — FastAPI route introspection and two undocumented MCP tools#31
lfnothias merged 2 commits into
mainfrom
fix/ci-green

Conversation

@lfnothias

Copy link
Copy Markdown
Collaborator

Summary

CI has been red on main for every run since #24. Two independent causes, neither related to the code in those pull requests. This restores a green build: 2399 unit tests pass, 0 fail.

1. test_web_app_routes.py — 28 failures

assert '/api/health' in routes failed with have: ['/', '/docs', '/favicon.ico', '/openapi.json', '/redoc', '/static'].

The application is not broken. GET /api/health returns 200 under TestClient, and app.openapi() lists every expected path. The test's introspection is what broke.

FastAPI 0.139 changed include_router(): instead of copying an included router's routes onto the app, it appends a single _IncludedRouter wrapper exposing the router as original_router. _route_methods_by_path iterated app.routes and saw ten wrappers whose .path is None, so it reported no /api/* routes at all.

Nothing in the repository pins FastAPI, so this arrived with an upstream release rather than with a commit — which is why the failure appears across unrelated pull requests.

The helper now descends through original_router. It is written to work on both layouts, so it will not break again when the wrapper is added or removed:

included_router = getattr(route, "original_router", None)
if included_router is None:
    yield route
else:
    yield from _flatten_routes(included_router.routes)

2. test_usage_guide.py — 1 failure

AssertionError: undocumented tools: ['ensure_kb', 'ground_paper']

fcbfe7ed registered both tools in _TOOL_NAMES without adding them to build_usage_guide(). The drift guard caught exactly what it exists to catch. Both now have purpose, when_to_use, and key_knobs entries, written from their implementations: ensure_kb idempotently creates a per-paper KB from a DOI, and ground_paper answers a question against that KB, with tier="si" preferring supplementary information.

Verification

Against the CI environment (pip install -e ".[dev]", no rdflib/pyoxigraph/indicium) and CI's own exclusion flags:

  • Unit suite: 2399 passed, 5 skipped, 18 deselected — previously 29 failed.
  • Integration smoke + config: 75 passed, 65 deselected.
  • Ruff reports no new findings; the 19 pre-existing findings in usage_guide.py are unchanged.

No production code changes. Issue #29, which breaks uv sync on fresh clones, is addressed separately in #30.

@lfnothias lfnothias merged commit 6980396 into main Jul 10, 2026
2 checks passed
@lfnothias lfnothias deleted the fix/ci-green branch July 10, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant