chore(verification): stage 6 cleanup — docs, refactor, audit comment#3654
Merged
chore(verification): stage 6 cleanup — docs, refactor, audit comment#3654
Conversation
Three follow-ups to #3524: 1. Docs (docs/building/aao-verified.mdx). Last updated for the orthogonal-axes framing in #3536; didn't mention the per-version model that just shipped. Added a "Per-version badges" section, updated the SVG/embed sections with both URL shapes (legacy auto-upgrade and version-pinned), added adcp_version to the JWT claim block with explicit verifier guidance ("verifiers MUST check adcp_version against the AdCP version they care about" — closes the cross-version replay concern from Stage 2's security review), and added a brand.json enrichment subsection documenting the badges[] array and the deprecation policy. 2. Refactor for testability. The shaping logic that builds the aao_verification block was a closure inside the brand.json route handler — unreachable from unit tests. Extracted to services/aao-verification-enrichment.ts as buildAaoVerificationBlock(badges). The route handler keeps the JSON traversal and assignment; the builder is pure with 14 new unit tests covering empty input, single-badge, multi-version dedupe with caller-ordering preserved, modes_by_role flattening (the "buyer pinned to 3.0 sees the wrong contract" footgun), adcp_version shape filtering (defense in depth), and the deprecation notice content. Code-review nit on PR #3604. 3. PROTOCOL_LABELS audit comment in dashboard-agents.html. The `${protocol} Agent${versionSegment}` label construction relies on PROTOCOL_LABELS values not ending in "Agent" — added a comment pinning the invariant so a future contributor adding a new protocol doesn't accidentally produce "Foo Agent Agent 3.1". DX expert nit from #3603. No wire-format changes — brand.json output is byte-for-byte identical to what shipped in #3604. Panel UX changes (role grouping, "show all versions" disclosure) explicitly defer until parallel-version badges land in production with real buyer feedback to design against. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
d7d830d to
47ff609
Compare
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
Cleanup follow-ups after #3524 shipped (Stages 1-5). No wire-format changes; brand.json output is byte-for-byte identical to what shipped in #3604.
What ships
1. Docs update —
docs/building/aao-verified.mdxLast updated for the orthogonal-axes framing in #3536; didn't mention the per-version model that just shipped. Added:
(agent, role, AdCP version)as the badge identity, parallel-version badges, and how the legacy vs version-pinned URLs differ./badge/{role}.svgauto-upgrade and/badge/{role}/{version}.svgversion-pinned), plus the corresponding embed endpoints.adcp_versionand explicit verifier guidance: "verifiers MUST check adcp_version against the AdCP version they care about" — closes the cross-version replay concern raised in Stage 2's security review.aao_verification.badges[]array, theroles[]/modes_by_roledeprecation policy, and the AdCP 4.0 removal target.2. Refactor — extract
buildAaoVerificationBlockfor testabilityCode-review nit on PR #3604: the shaping logic was a closure inside the brand.json route handler — unreachable from unit tests. Extracted to
services/aao-verification-enrichment.tsas a pure function. The route handler keeps the JSON traversal and assignment.14 new unit tests cover:
modes_by_roleflattens;badges[]doesn't)adcp_versionshape filtering as defense in depth (DB CHECK is the real gate, but a hand-edited row or replication slot replay shouldn't leak)3. PROTOCOL_LABELS audit comment —
dashboard-agents.htmlDX expert nit from #3603: the
\${protocol} Agent\${versionSegment}label construction relies onPROTOCOL_LABELSvalues not ending in "Agent" (otherwise we'd get "Media Buy Agent Agent 3.1"). Added a comment pinning the invariant so a future contributor adding a new protocol doesn't break it accidentally.What this PR does NOT do
Test plan
buildAaoVerificationBlockStage tracker (for context)
#3524 fully shipped:
Open follow-up: #3603 (panel role-grouping, "show all versions" disclosure) — deferred until we have parallel-version data.
🤖 Generated with Claude Code