Skip to content

chore(verification): stage 6 cleanup — docs, refactor, audit comment#3654

Merged
bokelley merged 1 commit intomainfrom
bokelley/per-version-badges-stage6-cleanup
Apr 30, 2026
Merged

chore(verification): stage 6 cleanup — docs, refactor, audit comment#3654
bokelley merged 1 commit intomainfrom
bokelley/per-version-badges-stage6-cleanup

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

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.mdx

Last updated for the orthogonal-axes framing in #3536; didn't mention the per-version model that just shipped. Added:

  • New "Per-version badges" section explaining (agent, role, AdCP version) as the badge identity, parallel-version badges, and how the legacy vs version-pinned URLs differ.
  • Display section documents both URL shapes with examples (/badge/{role}.svg auto-upgrade and /badge/{role}/{version}.svg version-pinned), plus the corresponding embed endpoints.
  • JWT claim block adds adcp_version and 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.
  • brand.json enrichment subsection documents the aao_verification.badges[] array, the roles[] / modes_by_role deprecation policy, and the AdCP 4.0 removal target.

2. Refactor — extract buildAaoVerificationBlock for testability

Code-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.ts as a pure function. The route handler keeps the JSON traversal and assignment.

14 new unit tests cover:

  • Empty input → null
  • Single-badge build
  • Multi-version dedupe with caller-ordering preserved
  • The "buyer pinned to 3.0 sees the wrong contract" footgun (modes_by_role flattens; badges[] doesn't)
  • adcp_version shape filtering as defense in depth (DB CHECK is the real gate, but a hand-edited row or replication slot replay shouldn't leak)
  • Leading-zero-major rejection, full-semver rejection, double-digit minor preservation
  • Deprecation notice content invariants

3. PROTOCOL_LABELS audit comment — dashboard-agents.html

DX expert nit from #3603: the \${protocol} Agent\${versionSegment} label construction relies on PROTOCOL_LABELS values 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

  • 14 new unit tests for buildAaoVerificationBlock
  • 145/145 unit tests pass total (was 131)
  • TypeScript typecheck clean
  • Pre-commit hook green (image quality, etc.)

Stage 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

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>
@bokelley bokelley force-pushed the bokelley/per-version-badges-stage6-cleanup branch from d7d830d to 47ff609 Compare April 30, 2026 19:53
@bokelley bokelley merged commit 9a50d4e into main Apr 30, 2026
18 checks passed
@bokelley bokelley deleted the bokelley/per-version-badges-stage6-cleanup branch April 30, 2026 19:56
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.

1 participant