Repository navigation
[codex] Add registry feed event schemas - #5054
Conversation
There was a problem hiding this comment.
Approving. The schema establishes the registry change feed correctly: each oneOf branch pins event_type to a const AND lists it in required, so the union is disjoint by construction under draft-07 — independent of whether validators honor the OpenAPI discriminator hint.
Things I checked
- Branch disjointness in
static/schemas/source/core/registry-event.json:75-350— every branch hasconstonevent_typeplus a secondaryconstonentity_type. The rejection test attests/composed-schema-validation.test.cjs:1018-1036exercises the secondary check (agent.compliance_changedpaired withentity_type=publisherrejects). - Audit walker classification:
scripts/oneof-discriminators.baseline.jsoncorrectly does NOT carryregistry-event— the const-on-event_typepattern is what the walker accepts as discriminated. No baseline ratchet needed. - Event vocabulary aligned across all three surfaces — 16 types in
registry-event.json:27-44, table inspecs/registry-change-feed.md:44-62, anddocs/registry/index.mdx:502-517. No schema-vs-docs drift. - Rename completeness:
next_cursor→cursorapplied acrossspecs/registry-change-feed.md,specs/registry-authorization-model.md, anddocs/registry/index.mdx. No residual hits. signing_keys$reftargetcore/agent-signing-key.jsonexists and carries the JWK shape (kid/kty/alg/crv/x) the spec example now uses.- Changeset present:
.changeset/4792-registry-feed-event-schemas.mddeclaresminor. Defensible because the registry feed is being formalized for the first time here — but see the first Follow-up.
Follow-ups (non-blocking — file as issues)
publisherAdagentsPayload.anyOf({publisher_domain}|{domain})is wire-shape ambiguity, not a compat shim.registry-event.json:357-386. This is a new schema landing for the first time; nothing is locked todomainyet. The description "Legacy alias … retained for early feed examples" carves an ambiguity into the wire on day one — producers will bifurcate. Stripdomainand update the example atspecs/registry-change-feed.md:81(still emitsdomain), or mark it deprecated-on-arrival with a removal milestone.minorbump is defensible only if no consumer is in flight against the prior spec doc. The doc rename surface is real:next_cursor→cursor, defaultlimit1000 → 100,entity_type=authorization&...→types=authorization.*,collections[].collection_id→collection_ids[]. If a server already emits the prior shape this ismajor. Worth confirming pre-release status before tagging the release.- 9 of 16 event types are unexercised by the composed-schema tests. The fixture in
tests/composed-schema-validation.test.cjs:875-1002coversproperty.created,authorization.granted,agent.discovered,agent.compliance_changed,agent.verification_earned,agent.verification_lost,publisher.adagents_discovered. Missing:property.updated,property.merged,property.stale,property.reactivated,agent.removed,agent.profile_updated,publisher.adagents_changed,authorization.revoked,authorization.modified. ThepropertyPayloadandauthorizationPayloadallOfcompositions are the highest-complexity surfaces — one smoke fixture per branch would prevent silent regressions.
Minor nits (non-blocking)
actorisrequiredbut described as informational.registry-event.json:65-68calls it "Internal producer label for audit and debugging … Consumers MUST treat this as informational." Required + informational is an odd posture — either tighten the description to "MUST be set by the registry on emission" or move to optional.entity_iddoc listspublisher.adagents_changedonly.registry-event.json:57-60enumerates the publisher case butpublisher.adagents_discovered(added in this PR) uses the same bare-domain shape and should be named.- OpenAPI
discriminatorkeyword in a draft-07 schema is advisory.registry-event.json:7-9. AJV ignores it without thediscriminator: trueoption (the test enables it; downstream SDK generators may not). Either drop the hint or leave a comment that theconstbranches are the authoritative selector.
Safe to merge once the publisherAdagentsPayload.anyOf ambiguity gets a tracked sunset.
There was a problem hiding this comment.
LGTM. New published surface; the discriminator and changeset are the right shape.
Things I checked
- 16
event_typeenum values instatic/schemas/source/core/registry-event.json:27-44match the tables inspecs/registry-change-feed.md:46-62anddocs/registry/index.mdx:500-517exactly. No vocabulary drift. discriminator.propertyName: event_typeis advisory under Draft-07, but every oneOf branch carriesevent_type: { const }+required: ["event_type"](e.g.registry-event.json:79,91). That satisfiesscripts/audit-oneof.mjs:148-186— classifies asdiscriminated, no baseline ratchet, no entry inscripts/oneof-discriminators.baseline.json.next_cursor→cursorandentity_type=authorization→types=authorization.*renames are fully applied across registry-feed scope. Residualnext_cursorhits inspecs/structured-agent-query.mdanddocs/aao/directory-api.mdxbelong to different endpoints — out of scope.- JWK signing-key example in
specs/registry-change-feed.md:110(kid, kty, alg, crv, x) matchesstatic/schemas/source/core/agent-signing-key.jsonshape one-to-one. - Default
limit1000 → 100 is a behavior change on the wire, but the endpoint is pre-publication with no documented consumers — safe in this changeset. - Changeset is
minor. Correct for additive new schemas with no modification to existing wire surface. - Server emitters already use these event-type strings (
server/src/crawler.ts:1837,server/src/notifications/compliance.ts:300,314). Schema and implementation line up. property.createdexample indocs/registry/index.mdx:553validates against theproperty.createdallOf branch (hasproperty_rid+classification+identifiers).
Follow-ups (non-blocking — file as issues)
specs/registry-authorization-model.md:429-460still describes achange_kind-based envelope. The schema discriminates onevent_type(authorization.granted | revoked | modified);change_kinddoesn't exist on the wire. The example envelope in that section is also missing the schema-requiredevent_type,actor, andcreated_at. This section pre-dates the discriminator decision and should be rewritten to match the published shape. Biggest single piece of doc drift in the PR.actorfield has a MUST-level constraint that no human-facing surface exposes. Schema description says "Consumers MUST treat this as informational and not as an authorization principal" (registry-event.json:67). The field appears inspecs/registry-change-feed.md:175anddocs/registry/index.mdx:556examples with no prose explanation. A reader hitting the example cold could assumeactoris a signed identity. One sentence in both surfaces would close the gap.publisherAdagentsPayload.anyOfkeeps a legacydomainalias (registry-event.json:357-386). The endpoint has no consumers yet. Carrying a "for early feed examples" alias into the day-one published contract bakes the legacy form in forever. Dropdomain, requirepublisher_domain, and updatespecs/registry-change-feed.md:80to match.authorizationPayloadlacks sub-discrimination byauthorization_type(registry-event.json:472). The same six-way variant is already discriminated instatic/schemas/source/adagents.json. Nothing currently stops aproperty_ids-typed authorization from validating withsignal_tagsset. TMP routers will project these payloads directly into their authorization index — worth a sub-oneOf in a follow-up RFC.registry-feed-response.json:32hasadditionalProperties: trueat the envelope root. Three named fields is a small contract; tightening tofalse(or listing anticipated extensions) makes typo'd producers fail closed.verified_specialismsis{type: "string"}(registry-event.json:255-258) rather than$reftoenums/specialism.json. The fixture uses"sales-catalog-driven"which is a valid enum value; typos slip through silently.- Rejection test coverage is light (
tests/composed-schema-validation.test.cjs:1045-1079). Two negative cases for 16 branches. Add at least one cross-payload mismatch — e.g.event_type: "property.created"with an authorization-shape payload — to prove the discriminator routes per-branch validation across the table, not just on the one combo. - Spec event-table grouping is jumbled in
specs/registry-change-feed.md:46-62(agent.profile_updatedandagent.compliance_changedinterrupt the publisher and authorization clusters). Schema enum order is the better canonical reading. Regroup property → agent → publisher → authorization.
Minor nits (non-blocking)
- Indentation drift.
publisherAdagentsPayloadinregistry-event.json:357-386uses 10-space indent where its$defssiblings use 6. Cosmetic. entity_iddescription doesn't pin a canonical form (registry-event.json:60). Forauthorization.*events it says "row id or a stable agent/publisher composite." Consumers need a stable key for de-dup — pick one.cursor: nullbranch is untested. Fixture attests/composed-schema-validation.test.cjs:1040only exercises a non-null UUID. Add a happy-path empty-feed case to exercise the documented "null only when the feed has no events and no prior cursor" wording.
Approving. The wire vocabulary is right, the discriminator is load-bearing, and the changeset is sized correctly for what this actually is — codifying a pre-publication contract. Notable that follow-up #4 is already solved one schema over in adagents.json; worth pulling that pattern forward before consumers materialize.
…gent index (#7093) * fix(registry-sync): apply agent.profile_updated events to the local agent index RegistrySync.applyEvent() handled agent.discovered and agent.removed but silently no-op'd agent.profile_updated, one of the event_type values the registry-event.json schema has declared since PR #5054 (2026-05-26) for "an agent inventory profile changed". The feed poller advances its cursor past these events regardless, so a locally-synced agent's channels, markets, format_kinds, etc. never converge with the registry after the initial bootstrap — a permanent staleness gap the class's own docstring ("polls the change feed to stay current") explicitly promises against. Add a case that merges the event payload onto the existing AgentIndex entry, matching the merge pattern already used for property.updated immediately below it. A plain copy of agent.discovered's full-snapshot upsert would be wrong here: per the schema's changed_fields description, agent.profile_updated payloads may carry only the fields that changed, so defaulting absent fields to [] / 0 / false (as agent.discovered does for a brand-new entity) would silently wipe out unrelated, unchanged profile data on every partial update. Adds two unit tests to registry-sync.test.ts: one confirming a partial update merges onto the existing profile without clobbering untouched fields, one confirming the event is a no-op for an agent not already in the index (matching property.updated's existing convention). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NFth3sHBrJbHuFeA8Cegdc * fix(registry-sync): whitelist agent.profile_updated payload before merge Addresses review feedback on #7093 point 1: applyEvent()'s agent.profile_updated case spread the raw event payload onto the existing AgentProfile. Per registry-event.json's agentProfilePayload def, additionalProperties is true and this event type additionally carries an advisory changed_fields array — neither is part of AgentProfile, so the bare spread let both leak into the stored profile and back out through agents.get()/list()/search(). Add agentProfilePatchFromPayload(), which explicitly whitelists only real AgentProfile fields (name, channels, property_types, markets, categories, tags, delivery_types, format_kinds, property_count, publisher_count, has_tmp, category_taxonomy) from the payload before merging, mirroring collectionFromPayload's existing explicit- construction pattern in the same file rather than property.updated's spread (which has the same latent issue but is out of scope here). Strengthened the existing merge test to assert changed_fields does not leak into the stored profile, and added a dedicated test that sends changed_fields plus an unrelated advisory field and an unrecognized "type" key (the schema's field name for this concept, distinct from AgentProfile's agent_type) and asserts the stored profile's key set is exactly the AgentProfile fields — nothing else. Verified by reverting the source change (keeping the tests): both new assertions fail against the old spread ('changed_fields' present on the stored profile). Restored the fix — 22/22 pass. npm run typecheck clean. Point 2 of the review (producer coverage for agent.profile_updated) is addressed separately: see PR description update and #7095 for the follow-up. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NFth3sHBrJbHuFeA8Cegdc * fix(registry-sync): preserve profile event agent type --------- Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: Brian O'Kelley <[email protected]>
Summary
/api/registry/feedFixes #4792
Tests