fix(registry): tighten metric_id+accreditation filter to per-metric semantics#3740
Closed
bokelley wants to merge 2 commits into
Closed
fix(registry): tighten metric_id+accreditation filter to per-metric semantics#3740bokelley wants to merge 2 commits into
bokelley wants to merge 2 commits into
Conversation
…emantics (#3733) When both metric_id and accreditation are present in /api/registry/agents, the same metrics[] element must now satisfy both constraints simultaneously. Independent JSONB predicates ANDed at SQL level allowed cross-metric false positives. Cross-product AND semantics now apply for multi-value params. Adds regression tests for filterMeasurementAgents and documents combined filter semantics (including the 2×N cross-product warning) in docs. Closes #3733 https://claude.ai/code/session_01WtFVR4EFu1UUuLN9PKGVfx
…mantics Multiple metric_id or accreditation values were documented as OR'd but the SQL has always AND'd them. Corrects table rows in docs/registry/index.mdx and OpenAPI descriptions in registry-api.ts to accurately say AND'd. Also adds cross-product AND note to the accreditation OpenAPI description to match the combined-filter semantics block added in the parent commit. https://claude.ai/code/session_01WtFVR4EFu1UUuLN9PKGVfx
Contributor
Author
|
Closing — superseded by merged #3733, which shipped the same per-metric semantics fix for the metric_id+accreditation filter. |
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.
Closes #3733
Summary
When
/api/registry/agentsreceives bothmetric_idandaccreditationquery params, the old implementation built independent JSONB@>containment predicates ANDed at SQL level. This allowed cross-metric false positives: a vendor with anattention_unitsmetric (not MRC-accredited) and a separately MRC-accreditedviewabilitymetric would match?metric_id=attention_units&accreditation=MRC, even though no single metric satisfies both constraints.Fix: When both params are present,
filterMeasurementAgentsnow emits one combined JSONB containment probe per(metric_id, accreditation)pair — cross-product AND semantics. Each probe requires a single metrics element to carry bothmetric_idand the nestedaccreditations[].accrediting_body. Solo filters (onlymetric_idor onlyaccreditation) are unchanged and still use the existing@>path.Also fixed (pre-existing docs error): The
metric_idtable row and OpenAPI description incorrectly said multiple values were "OR'd within the param". The code has always AND'd them (vendor must carry all named metrics). Both are corrected here.Changeset:
--empty— this is a server-side query behavior fix; no AdCP protocol schema changes.Non-breaking justification
PR #3726 shipped this endpoint on 2026-05-01 (the same day this issue was filed). Zero production callers have observed the old behavior in steady state. The fix narrows results to what callers actually asked for; any agent using both params with the old code was getting false-positive vendors.
Changes
server/src/db/agent-snapshot-db.tsmetric_idsandaccreditationsare setdocs/registry/index.mdxmetric_idtable row from "OR'd" to "AND'd"server/src/routes/registry-api.tsmetric_idandaccreditationOpenAPI descriptions to reflect AND semantics and cross-product noteserver/tests/unit/agent-snapshot-db.test.tsqfilterPre-PR review
metric_iddescription still said "OR'd" (fixed in second commit)Session: https://claude.ai/code/session_01WtFVR4EFu1UUuLN9PKGVfx
Generated by Claude Code