Card-table wormholes across all six SDKs (#397)

Merged
JE
4mo ago
+5003-107

Card-table wormholes (closes #397)

Models card-table wormholes across all six SDKs — the only mechanism for moving a card to a different project. Routing a move through an existing wormhole already worked (a wormhole id is a valid column_id for MoveCard), so the gap was purely discovering wormholes (decode wormholes[]) and managing them (CRUD). Cards().Move is unchanged.

The server contract is fully shipped and present in the pinned bc3 provenance (see spec/api-provenance.json); it shipped in BC3 #12144 and predates the current pin, so this is a pure absorption with no spec/api-provenance.json SHA bump. Operations 205 → 208; services 45 (account-scoped canonical set; +wormholes).

Contract

Three CRUD operations + one shared Wormhole shape (decode member + create/update outputs):

OpMethod + routeSuccessFailure
CreatePOST /{account}/buckets/{bucket}/card_tables/{cardTable}/wormholes.json201422 (4-per-board limit); 404 (invalid/inaccessible/inactive/same-board destination)
UpdatePUT /{account}/buckets/{bucket}/card_tables/wormholes/{wormhole}200404
DeleteDELETE /{account}/buckets/{bucket}/card_tables/wormholes/{wormhole}204403/404

Wormhole carries the full recording shape plus color, linked (always emitted — true only while the destination column, its board, and its bucket are all active), and destination_url (the only field identifying the destination; the wormhole's own url/app_url/parent point at the source board).

Nullability (destination_url + color)

destination_url is always emitted and null for an unlinked wormhole, so it's modeled as required-but-nullable: @required in Smithy + a 3.1 null-union OpenAPI override (type: ["string","null"] + x-go-type: "*string") via smithy-build.json jsonAdd, mirroring #404's SearchType.key. SDKs get string | null with no spurious | undefined:

  • TypeScript destination_url: string | null, Python str | None, Go generated *string (hand converter copies the pointer), Kotlin/Swift String? (required decode — rejects a missing key, accepts null).
  • destination_url is the first entity-level null-union field, so this PR also (a) teaches the Kotlin generator's entity path (ModelEmitter.resolvePropertyType) to handle null-union types, and (b) fixes a Swift generator bug: the required-nullable path emitted explicit snake_case CodingKeys that conflict with the .convertFromSnakeCase decoder — SearchType (single-word fields) never hit it.
  • color is modeled the same way. The bc3 jbuilder emits json.color recording.color unconditionally (null when unset), so it's wire-identical to destination_url — required-but-nullable. Both round-trip explicit null (Go clean *string with no omitempty; Ruby to_h keep-list; TS/Python/Kotlin/Swift nullable types).
  • UpdateWormhole is 404-only — the 4-per-board 422 is create-only; update swaps a pre-validated destination id (filtered .find → 404), so ValidationError was removed from its error list.

Structure (commit per SDK)

  • spec — Smithy ops + Wormhole + wormholes on CardTable, tags, regenerated artifacts, fixtures (linked + unlinked), api-gaps registry (absorbed-in-sdk, additive), doc/count refresh.
  • Go / TypeScript / Ruby / Python / Kotlin / Swift — service + client wiring + tests, one commit each.
  • Model wormhole destination_url as nullable — the null-union modeling + Kotlin entity-path fix + Go *string converter.

Tests

Every operation: happy path + error case (Create 422/404, Update 404, Delete 403/404), empty-input guards (Go), and a linked + unlinked wormholes[] decode through each language's card_tables.get (including Python). The unlinked case reads null through the corrected string | null / str | None types — a compile-time proof of the nullability contract.

Verification

make check green end-to-end on main: smithy-check, all drift checks, provenance-check (no bump), every language's test/lint/build, full conformance, check-bucket-flat-parity, validate-api-gaps.

Downstream

Unblocks basecamp-cli#342 / draft PR #559: once released and re-pinned, the CLI wires cards move <id> --to-wormhole <id|dest-col-url> and cards wormholes --in <proj>.