Repository navigation
feat(registry): sync OpenAPI registry types - #2324
Conversation
There was a problem hiding this comment.
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'sevents[]from a loose{event_type: string; payload: {[k]: unknown}}to the strictRegistryFeedEventoneOf.src/lib/registry/types.ts:100-122restores 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/GeneratedFeedResponseremain exported fromtypes.generated.tspost-regen, so the re-point insync.tsandfeed-stream.tsfrom./types.generated→./typescompiles. - Runtime is unchanged.
applyEvent(sync.ts:867-1007) still handles brand.* live and falls throughdefault: breakfor unknownevent_type; the widened union is safe against theevent.payload as Record<string, unknown>cast at line 868. --syncfetch 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.modifiedis silently dropped. The regenerated union now carriesauthorization.modified(registry.yaml:543, payloadAuthorizationEventPayload), butapplyEventonly handlesgranted/revoked—modifiedhitsdefault: break. Failure mode: a registry that re-scopes an existing authorization (changedauthorization_type/property_ids) viamodifiedinstead of revoke+grant leaves a stale entry inauthByDomain/authByAgent, soRegistrySyncserves 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_lostare similarly unhandled (lower stakes). The class-level staleness note plusstate/getLagSeconds()gating is the current backstop.ci.yml:46adds a live network fetch to the per-PR drift check.-- --syncdownloadsagenticadvertising.org/openapi/registry.yaml, overwrites the committed spec, thengit diff --exit-codecompares. Unrelated PRs will fail CI whenever upstream publishes a registry-spec change or the host is briefly unreachable. Consistent with the existingsync-schemas:allpattern in the same job, but it's a second external host on the critical path — theschema-sync.ymlscheduled job is the natural home; theci.yml+scripts/ci-validate.jscopies are the part worth a conscious decision.
Minor nits (non-blocking)
- Changeset understates as
patch; should beminor, and the title isfeatnotfix. Both reviewers landed here independently: 11 new public type exports acrosssrc/lib/index.ts+src/lib/registry/index.ts, plusbrowseCatalog/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. UnknownRegistryFeedEventcollapses exhaustive-switch narrowing.event_type: stringoverlaps every literal discriminant, so downstream consumers doing aswitchonCatalogEventwon't reach aneverdefault. Intentional and correct for the compat goal — a one-line doc note onCatalogEventwould save adopters the surprise. Same note covers the.payloadaccess 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.
There was a problem hiding this comment.
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.tsat head still emitsCatalogEvent(L9845),FeedFreshness(L9848),FeedResponse(L9860).types.tsre-imports them asGenerated*and redefines wider versions —CatalogEvent = GeneratedCatalogEvent | RegistryBrandEvent | UnknownRegistryFeedEvent. Purely additive, resolves,typecheckpasses. - Witness, not translator.
types.tsis types-only.sync.tsandfeed-stream.tsare import-source moves (./types.generated→./types) with zero logic change.applyEventkeeps itsdefault: break, so unknown/future event types are ignored, not fabricated or normalized. No placeholder substitution, no silent inflation.RegistryBrandEventreuses the generatedBrandEventPayloadrather 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
RegistryFeedEventoneOf enumerates agent./property./collection./authorization./publisher.* but drops brand.*. WideningCatalogEventwithRegistryBrandEvent(brand.hierarchy_updated/updated/resolved/removed/deleted) + anUnknownRegistryFeedEventcatch-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." --syncin the CI drift check is not new network coupling. TheValidate generated files are in syncjob already runsnpm run sync-schemas:allfrom the network at ci.yml:41. Adding-- --synctogenerate-registry-typesmakes 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.ymlalready used--sync, so theagenticadvertising.orghost is a known dependency, not a fresh one.code-reviewerflagged 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+) andsrc/lib/registry/index.ts(L215+) and widens the exportedCatalogEventunion. New public surface is aminorunder the repo's own version-bump guideline, notpatch. 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
BrandEventPayloadschema that noRegistryFeedEventoneOf 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 onadcontextprotocol/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.
UnknownRegistryFeedEventtypesevent_typeasstring, which erodes compile-time exhaustiveness for downstreams doingswitch (event.event_type). Acceptable for forward-compat, but a one-line JSDoc telling consumers to add adefaultarm would earn its keep.
Minor nits (non-blocking)
- Dead import.
FeedFreshnessis imported atsrc/lib/registry/types.ts:69and referenced nowhere in the file — the newFeedResponsecarriesfreshnessviaOmit<GeneratedFeedResponse, 'events'>, not a direct reference. Won't fail CI (registry dir is outside the lint glob, nonoUnusedLocals), but it's dead. Drop it.
LGTM. Follow-ups noted below.
|
The automated review encountered an issue (possibly reached max turns, timed out, or failed to post the final This is an automated message from the Argus AI review workflow. |
Summary
Validation