Skip to content

feat(registry): sync OpenAPI registry types - #2324

Merged
bokelley merged 3 commits into
mainfrom
pr-5818-merged
Jul 6, 2026
Merged

bokelley merged 3 commits into
mainfrom
pr-5818-merged

Conversation

@bokelley

@bokelley bokelley commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Refreshes the bundled AdCP registry OpenAPI spec and regenerated registry TypeScript types.
  • Exposes the new typed registry feed payload and catalog browse/sync aliases while keeping RegistrySync compatible with older/self-hosted brand feed events.
  • Updates CI/schema validation to run the hosted registry OpenAPI sync path.

Validation

  • npm run generate-registry-types
  • npm run typecheck
  • npm run lint:workflows
  • NODE_ENV=test node --test-timeout=60000 --test-force-exit --test test/lib/registry.test.js test/lib/registry-sync.test.js test/lib/registry-feed-stream.test.js
  • pre-push hook: typecheck + build

@bokelley
bokelley marked this pull request as ready for review July 6, 2026 05:39

@aao-ipr-bot aao-ipr-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean OpenAPI regeneration. The SDK-facing CatalogEvent/FeedResponse widening is the right shape: it's a read-side superset over the narrowed generated union, not fabrication — witness invariant intact.

Things I checked

  • The widening is load-bearing, not redundant. Regen narrows getRegistryFeed's events[] from a loose {event_type: string; payload: {[k]: unknown}} to the strict RegistryFeedEvent oneOf. src/lib/registry/types.ts:100-122 restores the openness the old type had — RegistryBrandEvent (brand.* from older/self-hosted registries) + UnknownRegistryFeedEvent (forward-compat) — expressed as structured compat members with accurate provenance comments. ad-tech-protocol-expert: sound-with-caveats, "liberal in what it accepts (correct Postel posture for a feed consumer), not fabricating wire shapes it then sends."
  • Imports still resolve. GeneratedCatalogEvent/GeneratedFeedResponse remain exported from types.generated.ts post-regen, so the re-point in sync.ts and feed-stream.ts from ./types.generated → ./types compiles.
  • Runtime is unchanged. applyEvent (sync.ts:867-1007) still handles brand.* live and falls through default: break for unknown event_type; the widened union is safe against the event.payload as Record<string, unknown> cast at line 868.
  • --sync fetch is fail-closed. 10s abort timeout, 1 MiB cap with content-length pre-check, redirect: 'error'. No unbounded body risk in the drift path.
  • Changeset present (.changeset/update-registry-openapi-types.md).
  • No mock/fallback injection; the manual compat types add zero runtime data.

Follow-ups (non-blocking — file as issues)

  • authorization.modified is silently dropped. The regenerated union now carries authorization.modified (registry.yaml:543, payload AuthorizationEventPayload), but applyEvent only handles granted/revoked — modified hits default: break. Failure mode: a registry that re-scopes an existing authorization (changed authorization_type/property_ids) via modified instead of revoke+grant leaves a stale entry in authByDomain/authByAgent, so RegistrySync serves outdated authorization data. Pre-existing gap, but this PR is what makes the event type real in the union — track it, ideally handle as revoke-then-apply. agent.verification_earned/agent.verification_lost are similarly unhandled (lower stakes). The class-level staleness note plus state/getLagSeconds() gating is the current backstop.
  • ci.yml:46 adds a live network fetch to the per-PR drift check. -- --sync downloads agenticadvertising.org/openapi/registry.yaml, overwrites the committed spec, then git diff --exit-code compares. Unrelated PRs will fail CI whenever upstream publishes a registry-spec change or the host is briefly unreachable. Consistent with the existing sync-schemas:all pattern in the same job, but it's a second external host on the critical path — the schema-sync.yml scheduled job is the natural home; the ci.yml + scripts/ci-validate.js copies are the part worth a conscious decision.

Minor nits (non-blocking)

  1. Changeset understates as patch; should be minor, and the title is feat not fix. Both reviewers landed here independently: 11 new public type exports across src/lib/index.ts + src/lib/registry/index.ts, plus browseCatalog/syncCatalog. New public surface is a minor bump by convention. Non-breaking, so this is a categorization follow-up, not a gate — worth correcting before the release PR calculates the bump.
  2. UnknownRegistryFeedEvent collapses exhaustive-switch narrowing. event_type: string overlaps every literal discriminant, so downstream consumers doing a switch on CatalogEvent won't reach a never default. Intentional and correct for the compat goal — a one-line doc note on CatalogEvent would save adopters the surprise. Same note covers the .payload access change (typed members have no index signature).

ad-tech-protocol-expert: sound-with-caveats — no storyboard opinion baked in; brand.* support predates this PR and is preserved, not invented. code-reviewer: no blockers, same three follow-ups.

LGTM. Follow-ups noted below.

aao-ipr-bot[bot]
aao-ipr-bot Bot previously approved these changes Jul 6, 2026

@aao-ipr-bot aao-ipr-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean generated-types resync with a correctly-scoped hand-authored compat shim. Right shape: the generated mirror stays honest, and the widening lives in a separate SDK-facing layer instead of being baked into the generated union.

Things I checked

  • Type resolution is sound. types.generated.ts at head still emits CatalogEvent (L9845), FeedFreshness (L9848), FeedResponse (L9860). types.ts re-imports them as Generated* and redefines wider versions — CatalogEvent = GeneratedCatalogEvent | RegistryBrandEvent | UnknownRegistryFeedEvent. Purely additive, resolves, typecheck passes.
  • Witness, not translator. types.ts is types-only. sync.ts and feed-stream.ts are import-source moves (./types.generated → ./types) with zero logic change. applyEvent keeps its default: break, so unknown/future event types are ignored, not fabricated or normalized. No placeholder substitution, no silent inflation. RegistryBrandEvent reuses the generated BrandEventPayload rather than hand-rolling a payload shape — the compensation adds no fields the wire didn't define.
  • The compat shim is load-bearing and correct. The synced RegistryFeedEvent oneOf enumerates agent./property./collection./authorization./publisher.* but drops brand.*. Widening CatalogEvent with RegistryBrandEvent (brand.hierarchy_updated/updated/resolved/removed/deleted) + an UnknownRegistryFeedEvent catch-all is the required defensive posture for an append-only feed that older/self-hosted registries still emit on. ad-tech-protocol-expert: sound-with-caveats — "the generated mirror stays honest; compensation lives in a separate SDK-facing layer; respects witness-not-translator."
  • --sync in the CI drift check is not new network coupling. The Validate generated files are in sync job already runs npm run sync-schemas:all from the network at ci.yml:41. Adding -- --sync to generate-registry-types makes the registry follow the same sync→generate→diff pattern as every sibling generator instead of regenerating from a stale committed spec (which made the registry drift check effectively inert). schema-sync.yml already used --sync, so the agenticadvertising.org host is a known dependency, not a fresh one. code-reviewer flagged this as a blocker on hermeticity grounds; overriding — the job is already non-hermetic by design one step up, and this aligns registry with the existing convention.
  • Changeset present (.changeset/update-registry-openapi-types.md), descriptive.

Follow-ups (non-blocking — file as issues)

  • Changeset type understates impact. Adds 11 new public type exports through src/lib/index.ts (L119+) and src/lib/registry/index.ts (L215+) and widens the exported CatalogEvent union. New public surface is a minor under the repo's own version-bump guideline, not patch. Not breaking, so not a block — but the bump is a feature, not a fix. Worth confirming intent before the Release PR calculates.
  • File the upstream spec inconsistency. The synced spec now ships a BrandEventPayload schema that no RegistryFeedEvent oneOf arm references, and brand.* is absent from the feed union. The SDK bridge is the right short-term move, but per the spec→mock→SDK triage order this drift belongs in an issue on adcontextprotocol/adcp — either wire brand.* into the union or drop the orphaned payload. Don't let the SDK carry the compat forever without the upstream reconciling.
  • Document the exhaustiveness cliff. UnknownRegistryFeedEvent types event_type as string, which erodes compile-time exhaustiveness for downstreams doing switch (event.event_type). Acceptable for forward-compat, but a one-line JSDoc telling consumers to add a default arm would earn its keep.

Minor nits (non-blocking)

  1. Dead import. FeedFreshness is imported at src/lib/registry/types.ts:69 and referenced nowhere in the file — the new FeedResponse carries freshness via Omit<GeneratedFeedResponse, 'events'>, not a direct reference. Won't fail CI (registry dir is outside the lint glob, no noUnusedLocals), but it's dead. Drop it.

LGTM. Follow-ups noted below.

@bokelley bokelley changed the title fix(registry): sync OpenAPI registry types feat(registry): sync OpenAPI registry types Jul 6, 2026
@aao-ipr-bot

aao-ipr-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ Argus review could not complete

The automated review encountered an issue (possibly reached max turns, timed out, or failed to post the final gh pr review). A human reviewer should take this PR.

View workflow run

This is an automated message from the Argus AI review workflow.

@bokelley
bokelley merged commit 68ce3f4 into main Jul 6, 2026
31 checks passed
@bokelley
bokelley deleted the pr-5818-merged branch July 6, 2026 06:28
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