Skip to content

Commit ea1b258

Browse files
ci: replace the route check that failed silently with a pytest test
Backend CI has failed on every run since at least 8 September, main included. The failing step was an inline python -c route assertion; it exits 1 and the public annotations say nothing more. The same assertion passes locally, and on the runner the pytest step - which imports and boots the same app - passed. The check now lives in tests/test_api.py and names ten public routes explicitly, so a failure says which route is missing. The inline step is removed rather than debugged blind. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent bea2a11 commit ea1b258

2 files changed

Lines changed: 15 additions & 9 deletions

File tree

‎.github/workflows/backend.yml‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@ jobs:
1515
run: cd backend && python -m pytest tests -q
1616
- name: Check imports
1717
run: cd backend && python -c "from app.main import app; print('✅ App imports successfully')"
18-
- name: Verify API routes
19-
run: |
20-
cd backend
21-
python -c "
22-
from app.main import app
23-
routes = [r.path for r in app.routes]
24-
assert '/api/v1/tools' in routes or any('/tools' in r for r in routes), 'Missing /tools route'
25-
print(f'✅ {len(routes)} routes registered')
26-
"
2718

2819
docker-build:
2920
needs: lint-and-build

‎backend/tests/test_api.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,18 @@ async def unverifiable(*_a, **_k):
7878

7979
def test_unknown_project_is_404(client):
8080
assert client.get("/api/v1/projects/not-a-project").status_code == 404
81+
82+
83+
# The route contract the old inline CI script checked, as a test that says what
84+
# is missing instead of exiting 1 with no output.
85+
REQUIRED_ROUTES = [
86+
"/api/v1/tools", "/api/v1/tools/{slug}", "/api/v1/tools/{slug}/resources",
87+
"/api/v1/projects", "/api/v1/projects/{slug}", "/api/v1/roadmaps",
88+
"/api/v1/overview", "/api/v1/status", "/api/v1/health", "/api/v1/health/data",
89+
]
90+
91+
92+
def test_public_routes_are_registered():
93+
registered = {getattr(r, "path", None) for r in app.routes}
94+
missing = [p for p in REQUIRED_ROUTES if p not in registered]
95+
assert not missing, f"routes not registered: {missing}"

0 commit comments

Comments
 (0)