Account event feed, inbox, and stream tickets: spec operations and generated clients

Merged
JE
3mo ago
+8185-169

Summary

Models the account event feed's wire surface, now merged on bc3 master, and regenerates all seven SDKs from it. Three operations on a new EventFeed tag (service eventFeed):

OperationMethod + pathNotes
PollEventsGET /{accountId}/events.json@readonly; since (decimal int64 id, 0, or now), position, and the comma-joined filters types/buckets/creators/performers/exclude_performers/actor_types
PollInboxGET /{accountId}/inbox.json@readonly; since, position, reasons/types/buckets; 403 for every non-agent principal
CreateStreamTicketPOST /{accountId}/events/stream_ticket.jsonbodyless, 200; @idempotent because the mint is a stateless signed capability (safe to retry, not a claim of an identical response)

Shapes: FeedEvent (with a nullable performed_by_id and a details document, carried verbatim — only for boost.created / card.moved today; a typed projection would drop the explicit nulls a recording-level boost sends and any member a newly cataloged type adds, so the poll lane would disagree with the connector's push lane), PollEventsOutput / PollInboxOutput envelopes (events|items, position, next?), InboxItem, and the mint's {ticket, expires_in, url} with ticket and url marked sensitive (recorded in behavior-model.json's redaction map and rendered as Rust's SensitiveString; no SDK logs response bodies, and the §23 connector never renders either value). Typed error bodies (revised after peer review): FeedRequestError (400 on both poll lanes: error plus an optional reason of invalid_position | invalid_filter from bc3 #13362 — absent means an undifferentiated 400 the consumer surfaces rather than guessing between recovering and stopping), FeedFilterMismatchError (409: position_digest, filters_digest), and two deliberately distinct 410 shapes on two operations: FeedPositionGoneError on PollEvents (epoch_after_id required; resume re-enters at the epoch) and InboxPositionGoneError on PollInbox (resume re-enters at since=0; no epoch) — so no single errors.As arm can silently handle the wrong lane. PollInbox's 403 is BareForbiddenError (bodyless, following BareNotFoundError). CreateStreamTicket keeps @basecampIdempotent(natural: true): Ruby, TypeScript and Go classify retry off that flag, and dropping it fails check-idempotency-parity.

Pagination is deliberately not the Link-header walk: the body envelope's position is the durable cursor and next the continuation URL, so the operations carry no pagination trait and are wired into no SDK's paginator — one call is one page. The operation docs and SPEC §23 "Wire Operations" say so.

Also absorbed from the same bc3 range: the optional performed_by: Person member on Event (recording events) and WebhookEvent (bc3 #13040). Person.personable_type was already an open string in every SDK, so the new Agent / Tombstone values decode without a closed enum to widen.

Contract sources (bc3 master):

What changed

  • Spec: spec/basecamp.smithy (operations, shapes, error shapes, @sensitive ticket types, performed_by), spec/overlays/tags.smithy; openapi.json, behavior-model.json, url-routes.json regenerated.
  • Generated code, all seven SDKs (make generate), plus the eventFeed service wired into the TypeScript, Ruby and Python clients; RESOURCE_TYPE_OVERRIDES gain PollEvents → feed_event and PollInbox → inbox_item in the four generators that emit resource types (Poll is not a verb pattern, so inference fell through to resource).
  • Go wrapper: AccountClient.EventFeed() → EventFeedService with PollEvents / PollInbox / CreateStreamTicket, typed *FeedRequestError (with Reason), *FeedFilterMismatchError, *FeedPositionGoneError (feed only) and *InboxPositionGoneError (inbox only), each unwrapping to the canonical *Error, and PollEventsOptionsFromURL / PollInboxOptionsFromURL to follow a next or resume URL through the generated operation (query-only parse; origin validation stays with the SPEC §23 connector). Event.PerformedBy and WebhookEvent.PerformedBy on the existing wrappers.
  • Tests: TypeScript, Ruby, Python and Rust service suites (entry point and comma-joined filters on the wire, envelope decode with a null performed_by_id and both details variants, 400/409/410 mapping, the inbox's agents-only 403, the bodyless mint and its 401); Go wrapper tests for the same plus the typed errors and URL parsers.
  • Conformance: conformance/tests/event_feed.json (12 cases, including the 400 with and without reason) dispatched from all seven runners with flat per-runner summaries; registered in SPEC §19's categories table and Appendix D.
  • Gates: spec/bc3-route-allowlist.yml waives the three routes with routes.rb / controller / test evidence (they are documented past the current provenance pin — see out of scope); scripts/check-idempotency-parity counts +1 idempotent / +3 union; go/grouped-client-inventory.yml lists the three as not grouped; Rust guarantees.rs pins moved to 265 operations.
  • details per language: Go json.RawMessage (the bytes, untouched; the wrapper's FeedEvent.Details too), TypeScript unknown, Python Any, Ruby a Hash, Kotlin JsonElement, Rust serde_json::Value, Swift the SDK's JSONValue? — the Swift generator used to render every Smithy document as String?, which cannot decode an object, so it now maps documents to JSONValue (which gained Encodable); WebhookEvent.details changes type with it, noted in MIGRATING.md, and numbers ride as Double there.
  • Docs / registry: SPEC §23 gains a "Wire Operations" subsection describing the generated layer and listing the contract deltas the merged head introduced for the connector to absorb (the srv2 digest scheme, the epoch re-entry, the new filter dimensions and the inbox lane — which #778's §23 text now carries). spec/api-gaps/event-feed.md and delegated-events-performed-by.md close as absorbed-in-sdk. AGENTS/SECURITY/README operation and service counts were rewritten by make generate.

Verification

Run locally on macOS (every exit code 0 unless noted):

  • make generate (clean re-run produces no diff)
  • All 54 static gates of make check-targets individually (smithy-check, behavior-model-check, provenance-check, sync-api-version-check, doc-constants-check, url-routes-check, bc3-route-parity + its self-test, go-check-drift / go-check-wrapper-drift / go-check-generated-drift, check-grouped-client-coverage, auth-routable-check, check-service-inventory-parity, check-operation-assignment-parity, the five per-SDK drift checks, check-bucket-flat-parity, validate-api-gaps, check-deprecation-parity, check-fixture-coverage, kt-check-optional-arrays-and-scalars, go-check-optional-pointers, check-idempotency-parity, check-write-semantics-parity, check-retry-metadata-parity, check-runner-test-reachability, check-replay-decoder-parity, check-readme-env-vars, lint-npm-lockfile-writes, check-projected-examples, the OAuth / event-feed / conformance fixture checks, …)
  • make go-check, make ts-check (1899 tests), make py-check (2094 tests), make rb-check (1745 runs), make rs-check, make kt-check, make swift-check (563 tests)
  • make check-fixture-execution (runs make conformance: all seven runners execute the 284 cases; the new family passes in every language)

Live canary against a real account with the Go SDK on this branch, using a person-principal token: PollEvents since=now → 200, empty page with a position; PollEvents since=0 with types and exclude_performers=self → 200; a malformed position → the documented 400 (validation, "Unrecognized position…"); PollInbox → 403 forbidden (agents only, as documented); one CreateStreamTicket → 200 with expires_in: 120, a ticket, and a wss:// URL carrying it (nothing beyond lengths was recorded; the URL was not connected to — that is the connector's job).

Out of scope, deliberately

  • Connector reconciliation (SPEC §23 layer 2) — the TicketMinter / PollSource adapters over these operations, the srv2 rename, the 410 re-entry semantics, and the new filter dimensions land in the event-feed connector PRs; the symbols above are what they bind to.
  • Provenance repin. The three routes are only documented past the current pin. Advancing the pin drags roughly 25 unrelated bc3 doc drifts (subtasks, card-table templates, templatifications, backlinks, bulk enrollments, the unscoped recording show) into spec/api-gaps/ triage, so this PR follows the existing convention of evidenced route waivers marked "delete at the next repin".
  • Typed 409/410 members outside Go. The other six SDKs surface the canonical error (api_error, non-retryable) with the server's message; reading position_digest / resume off a typed value is the connector adapter's concern in each language.
  • TimelineEvent also renders performed_by upstream; only Event and WebhookEvent (the two the gap registry names) are modeled here.

Release notes: Features (enhancement). The API Compatibility gate flags the new generated Go interface methods (ClientInterface.PollEvents etc.), as it does for every added operation (#836, #833, #827, #847 all carried breaking), and Event/WebhookEvent gain an exported PerformedBy field, which breaks unkeyed Go composite literals — MIGRATING.md carries the note under Unreleased. Applying the breaking label needs triage rights, so a maintainer will have to add it for the gate to pass.