test(registry-api): route-level coverage for verdict_source owner-scope gate (closes #4378)#4394
Open
bokelley wants to merge 2 commits into
Open
test(registry-api): route-level coverage for verdict_source owner-scope gate (closes #4378)#4394bokelley wants to merge 2 commits into
bokelley wants to merge 2 commits into
Conversation
…pe gate (closes #4378) Adds an integration test that drives GET /api/registry/agents/:url/compliance through the actual Express handler against a real Postgres, exercising the auth/ownership gate end-to-end: - Anonymous caller (no req.user): owner-only keys present, null/false. - Cross-org caller (authenticated but no membership in the agent's org): owner-only keys present, null/false. - Owner caller: verdict_source='owner_test', membership_tier populated, is_api_access_tier=true. - Owner of a tier=NULL org: verdict_source still populated (the gate is is_owner, not is_api_access_tier) — Explorer-tier owners get the UX cue. Run locally: docker compose up -d postgres # exposes 5432 on a random host port DATABASE_URL=postgresql://adcp:localdev@127.0.0.1:<port>/adcp_test \ npx vitest run server/tests/integration/registry-api-compliance-verdict-source.test.ts Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Test-only — no version bump. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the route-level integration test the #4378 ticket explicitly asks for. PR #4389 shipped 6 unit tests pinning `resolveOwnerMembership`'s `is_owner` semantics; this PR layers the Express handler on top so the gate is verified end-to-end against the actual response shape, not just the dispatcher's return value.
What's tested
Four cases, all hitting `GET /api/registry/agents/:encodedUrl/compliance` via supertest against a real Postgres:
Test plan
Pattern reference
Built on `server/tests/integration/registry-api-agent-refresh.test.ts` — same auth/csrf/stripe mock pattern, same DB-fixture shape (organizations + organization_memberships + member_profiles.agents + agent_compliance_runs + agent_compliance_status), same supertest invocation.
Closes #4378.
🤖 Generated with Claude Code