fix: accept 401 in agent registry contract test#57
Conversation
The /v1/agents endpoint requires Clerk auth. An unauthenticated request returns 401, which is a valid indicator that the endpoint exists.
|
✅ Documentation validation passed!
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
✅ All checks passed! Ready for review. |
There was a problem hiding this comment.
Pull request overview
Updates the server integration “contract” test for the agent registry endpoint to treat authentication-required responses as valid evidence that the route exists, aligning with the server’s new Clerk-auth behavior.
Changes:
- Accept HTTP 401 (in addition to 200/404) for
GET /v1/agentsin the integration test.
| # May return 200 (list), 404 (not implemented), or 401 (auth required) | ||
| assert resp.status_code in [200, 401, 404] |
There was a problem hiding this comment.
Since this is only checking endpoint reachability, consider also accepting HTTP 403 here. The same test module treats 401/403 as auth failures (see validate endpoint), and some auth middleware returns 403 instead of 401 when unauthenticated/unauthorized, which would make this contract test fail unnecessarily.
| # May return 200 (list), 404 (not implemented), or 401 (auth required) | |
| assert resp.status_code in [200, 401, 404] | |
| # May return 200 (list), 401/403 (auth required), or 404 (not implemented) | |
| assert resp.status_code in [200, 401, 403, 404] |
| resp = requests.get(f"{API_BASE_URL}/v1/agents") | ||
| # May return 404 or empty list depending on implementation | ||
| assert resp.status_code in [200, 404] | ||
| # May return 200 (list), 404 (not implemented), or 401 (auth required) | ||
| assert resp.status_code in [200, 401, 404] |
There was a problem hiding this comment.
Add a small request timeout to this GET (similar to the server health check) so the integration suite can’t hang indefinitely if the server is reachable but not responding.
|
✅ SDK server contract tests passed (test_server_integration.py). Cross-product scenarios are validated in capiscio-e2e-tests. |
The
/v1/agentsendpoint now requires Clerk auth. An unauthenticated GET returns 401, which is a valid indicator that the endpoint exists and is routed correctly.The contract test only checks endpoint reachability, so 401 should be accepted alongside 200 and 404.