fix(catalog): allow adagents_authoritative as evidence= filter on /registry/authorizations - #4884
Merged
Merged
Conversation
…4841 follow-up) #4879 added the adagents_authoritative evidence value to catalog_agent_authorizations and backfilled ~6,800 cafemedia children into catalog, but the partner-sync endpoints rejected ?evidence=adagents_authoritative with 400 because the VALID_EVIDENCE set in authorization-snapshot-db.ts was hardcoded to the pre-#4841 enum: $ curl '.../api/registry/authorizations?agent_url=...&evidence=adagents_authoritative' {"error":"Invalid evidence value: adagents_authoritative. Expected one of: adagents_json, agent_claim, community, override."} Adds the new value to VALID_EVIDENCE. NOT added to DEFAULT_EVIDENCE — the partner-sync default stays strict-bilateral adagents_json only; consumers opt in to weaker evidence explicitly.
Contributor
There was a problem hiding this comment.
LGTM. Real bug, surgical fix, right shape — adds the missing allowlist entry without weakening the partner-sync default.
Things I checked
server/src/db/authorization-snapshot-db.ts:47addsadagents_authoritativetoVALID_EVIDENCEonly.DEFAULT_EVIDENCEat L48 stays['adagents_json']— strict-bilateral default preserved.- Migration
488_catalog_fanout_authoritative_evidence.sql:39already permitsadagents_authoritativeoncatalog_agent_authorizations.evidence, andpublisher-db.ts:328writes it. Without this PR the validator was the only thing rejecting a value the rest of the stack happily produces. - No other hardcoded evidence enum in
server/src/that this allowlist needs to stay in sync with — the other enums (discovery_method,source) are distinct dimensions. EvidenceValidationErrorat L95 interpolates[...VALID_EVIDENCE]— the new value surfaces in the 400 message.- Empty-frontmatter changeset matches the established server-only-fix convention (cf.
.changeset/3573-canonicalize-agent-url-registered-path.md); not a missing package bump.
Follow-ups (non-blocking — file as issues)
- Add a positive
parseEvidenceParam('adagents_authoritative')test next to the existingoverridetest atserver/tests/integration/registry-authorization-sync-endpoints.test.ts:170. Symmetric coverage and would have caught this drift before the partner-sync 400s.
Minor nits (non-blocking)
- Set order drift. The Set at L47 ends with
adagents_authoritativewhile migration 488's CHECK at L39 orders it beforeoverride. Harmless — affects only the order in theEvidenceValidationErrormessage — but matching migration order would read cleaner.
Self-merging your own one-liner with the typecheck box ticked and the manual-validation checkbox left to the reviewer is a notable choice for a hotfix, but the change is correct and the deploy-time curl is the validation that actually matters here.
LGTM.
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
Hotfix follow-up to #4879. The new `adagents_authoritative` evidence value landed in `catalog_agent_authorizations` and backfilled ~6,800 cafemedia children, but the partner-sync endpoints rejected `?evidence=adagents_authoritative` with 400 because the validator's `VALID_EVIDENCE` allowlist was hardcoded to the pre-#4841 enum.
```
$ curl '.../api/registry/authorizations?agent_url=https://interchange.io&evidence=adagents_authoritative'
{"error":"Invalid evidence value: adagents_authoritative. Expected one of: adagents_json, agent_claim, community, override."}
```
Change
One-line addition to `server/src/db/authorization-snapshot-db.ts:42`:
```diff
-const VALID_EVIDENCE = new Set(['adagents_json', 'agent_claim', 'community', 'override']);
+const VALID_EVIDENCE = new Set(['adagents_json', 'agent_claim', 'community', 'override', 'adagents_authoritative']);
```
Not added to `DEFAULT_EVIDENCE` — the partner-sync default stays strict-bilateral `adagents_json` only. Consumers opt into the weaker evidence explicitly.
Verification after deploy
```bash
ADMIN_KEY=$(grep "^ADMIN_API_KEY=" .env.local | cut -d= -f2)
curl -sS 'https://agenticadvertising.org/api/registry/authorizations?agent_url=https://interchange.io&evidence=adagents_authoritative'
-H "Authorization: Bearer $ADMIN_KEY" | jq '{count, evidences: ([.rows[].evidence] | unique)}'
Expected: count ~6,800, evidences=["adagents_authoritative"]
```
Test plan
🤖 Generated with Claude Code