Skip to content

fix: accept 401 in agent registry contract test#57

Merged
beonde merged 1 commit intomainfrom
fix/contract-test-auth-status
May 1, 2026
Merged

fix: accept 401 in agent registry contract test#57
beonde merged 1 commit intomainfrom
fix/contract-test-auth-status

Conversation

@beonde
Copy link
Copy Markdown
Member

@beonde beonde commented May 1, 2026

The /v1/agents endpoint 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.

The /v1/agents endpoint requires Clerk auth. An unauthenticated request
returns 401, which is a valid indicator that the endpoint exists.
Copilot AI review requested due to automatic review settings May 1, 2026 12:01
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

✅ Documentation validation passed!

Unified docs will be deployed from capiscio-docs repo.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

✅ All checks passed! Ready for review.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/agents in the integration test.

Comment on lines +411 to +412
# May return 200 (list), 404 (not implemented), or 401 (auth required)
assert resp.status_code in [200, 401, 404]
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# 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]

Copilot uses AI. Check for mistakes.
Comment on lines 410 to +412
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]
Copy link

Copilot AI May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 1, 2026

✅ SDK server contract tests passed (test_server_integration.py). Cross-product scenarios are validated in capiscio-e2e-tests.

@beonde beonde merged commit 4644d22 into main May 1, 2026
17 checks passed
@beonde beonde deleted the fix/contract-test-auth-status branch May 1, 2026 12:06
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.

2 participants