You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add route-level tests for EarthMind's API and fix two small routing bugs #1138
EarthMind's tests (earthmind/tests/test_anomaly.py, test_trends.py) only cover the pure services in src/services/. The HTTP layer in earthmind/src/index.py (Default.fetch ~line 56 and the _* handlers) has no tests. While writing them you'll hit two real bugs:
limit is parsed with int(...) (~lines 167, 204), so ?limit=abc raises and returns an unhandled 500 instead of a 400.
/api/alerts/<id>/resolve (~line 93) resolves an alert for any HTTP method, including GET. A link preview or crawler can resolve alerts. It should be POST-only.
What to do
Add earthmind/tests/test_routes.py with a minimal fake env (DB.prepare().bind().all()/run()/first(), AI.run) and a fake request.
Test at least: /api/health, GET/POST /api/data, /api/anomalies without parameter (400), /api/alerts list/create, resolve, and unknown routes (404).
Fix both bugs: return 400 for non-integer limit, and return 405 for non-POST requests to /resolve (update the dashboard JS in src/static/ if it calls resolve with another method).
Acceptance criteria
New route tests pass along with the existing 67.
?limit=abc returns 400; GET /api/alerts/1/resolve returns 405.
Activity
github-actions commentedon Nov 2, 2026
Taha254511 commentedon Nov 2, 2026
i am interested to work on this issue ,please assign this issue to me
github-actions commentedon Nov 2, 2026
You can't take this task yet. You still have uncompleted issues: #1133. Please complete them before requesting another.