Model external links (doors) as a Doors service
Depends on basecamp/bc3#14314 (Doors API)
Adds external links (doors) as a resource of their own: five operations on a new Doors service (tag Dock), a Door shape, and every client generated from them. bc3#14314 serves them as JSON. Before it, create answered a 302 with no body and there was no JSON update path.
bc3#14314 is merged and deployed to production. This PR repins bc3 to its merge commit, 6ceece6f69b, so the four new routes are in the vendored route table at the pin and need no waivers. The range triage is in spec/api-gaps/README.md.
The operations
| Operation | Route | Answers |
|---|---|---|
ListDoors | GET /{accountId}/buckets/{bucketId}/dock/doors.json | 200, the project's active links in section order, unpaginated |
GetDoor | GET /{accountId}/dock/doors/{doorId} | 200 Door; 404 for an unknown id, a non-door, or a link hidden from a client |
CreateDoor | POST /{accountId}/buckets/{bucketId}/dock/doors.json | 201 Door; 422 for an unusable url, with Rails' default error body (no field-keyed errors), mapped to validation; non-idempotent, attempted once |
UpdateDoor | PUT /{accountId}/dock/doors/{doorId} | 200 Door; a partial update; idempotent |
DeleteDoor | DELETE /{accountId}/dock/doors/{doorId} | 204; status becomes "deleted" |
Request bodies follow bc3's contract:
- The link's fields go under
door:service,url,titleanddescription.visible_to_clientssits besidedoor, not inside it. - Writes need permission to edit the project. Without it, they answer 403.
Visibility default: a create that leaves out visible_to_clients makes a private link, visible to the team only, whatever the project's other tools do. No SDK sends a default of its own; the field is omitted unless the caller sets it. An update that leaves out door changes only the visibility. An update that leaves out visible_to_clients keeps the current visibility.
GetDoor is the flat JSON show, which is a separate action from the bucket-scoped GET /buckets/:b/dock/doors/:id. That route stays a 302 redirector to the outside address, and it stays out of scope. The door[image] thumbnail is multipart-only and is not modelled.
Per language
| Language | API |
|---|---|
| Go | client.ForAccount(id).Doors(): List(ctx, bucketID int64) (*DoorListResult, error), Get(ctx, doorID int64) (*Door, error), Create(ctx, bucketID int64, req *CreateDoorRequest) (*Door, error), Update(ctx, doorID int64, req *UpdateDoorRequest) (*Door, error), Delete(ctx, doorID int64) error. CreateDoorRequest{Service, URL, Title, Description string; VisibleToClients *bool}: an empty URL or Service is an ErrUsage before any request. UpdateDoorRequest{Service, URL, Title string; Description *string; VisibleToClients *bool}: an empty string is left unchanged, and Description takes &"" to clear it. The door wrapper is sent only when a door field is set. |
| TypeScript | client.doors.list(bucketId), get(doorId), create(bucketId, {door, visibleToClients?}), update(doorId, {door?, visibleToClients?}), delete(doorId); Door, CreateDoorRequest, UpdateDoorRequest exported from the root |
| Ruby | doors.list(bucket_id:), get(door_id:), create(bucket_id:, door:, visible_to_clients: nil), update(door_id:, door: nil, visible_to_clients: nil), delete(door_id:) |
| Python | the same keyword shape as Ruby, sync and async |
| Kotlin | doors.list(bucketId), get(doorId), create(bucketId, CreateDoorBody(door, visibleToClients)), update(doorId, UpdateDoorBody(door, visibleToClients)), delete(doorId) |
| Swift | doors.list(bucketId:), get(doorId:), create(bucketId:req: CreateDoorRequest(door: CreateDoorPayload(...), visibleToClients:)), update(doorId:req: UpdateDoorRequest(...)), delete(doorId:) |
| Rust | doors().list(bucket_id), get(door_id), create(bucket_id, &CreateDoorRequestContent { door, visible_to_clients }), update(door_id, &UpdateDoorRequestContent { .. }), delete(door_id) |
Also in this PR
- The shared fixtures in
spec/fixtures/doors/are bc3#14314's documented examples.Dooris covered in the fixture manifest. conformance/tests/doors.jsonhas 10 cases, dispatched in all seven runners:- every path;
- the documented create and update requests, asserted as exact whole bodies;
- a create without visibility;
- an update of visibility alone;
- a 404 and a 422 mapped to their codes;
- a create not retried on 503;
- a 204 delete.
spec/bc3-route-allowlist.ymlandspec/bucket-scoped-allowlist.txt:- no door waivers: the repin to bc3 6ceece6f69b put the routes in the table;
- the stale
POST /dock/doorsregistry entry andGET /dock/doors/:idout-of-scope entry are removed, with the redirector's reasoning kept as a comment; - the bucket-only list is justified.
spec/api-gaps/external-links-doors.mdstayspartial-coverage:- create (now 201 JSON) and update are absorbed;
- the multipart
door[image]thumbnail is the one residual; - the redirector stays closed.
- The new operations are recorded in MIGRATING.md under
# Unreleased, and the operation counts are updated in SECURITY.md, SPEC.md and the Rust route-table guarantee.
BREAKING CHANGE (Go only): the generated ClientInterface and ClientWithResponsesInterface gain the five door operations. A hand-written implementation must add them.
Tests, red then green
Each new test was run against origin/main (70c3047d), with only the tests and fixtures copied in, and then on this branch:
| Language | Tests | On origin/main | On this branch |
|---|---|---|---|
| Go | 12 in doors_test.go | build fails: undefined: UpdateDoorRequest (and the rest) | 12 pass |
| TypeScript | 12 in doors.test.ts (13 after review) | 12 failed | 13 pass |
| Ruby | 11 in doors_service_test.rb (12 after review) | NoMethodError: undefined method 'doors' | pass |
| Python | 12 in test_doors_service.py (13 after review) | 12 failed | 13 pass |
| Kotlin | 6 in DoorsTest.kt | Unresolved reference 'doors' / CreateDoorBody | 6 pass |
| Rust | 4 in tests/services.rs | unresolved imports ... CreateDoorPayload, no method named doors | 4 pass |
| Swift | 5 in DoorTests.swift | not run locally (macOS only); CI runs them | CI |
A wire-level mutation as well. If the Go wrapper is made to send door on every update (if true { in place of the any-field-set guard), TestDoorsService_UpdateVisibilityAlone goes red with body = map[door:map[] visible_to_clients:true], want only visible_to_clients. Against bc3 that empty wrapper would hit params.require(:door). With the guard restored, the test is green again.
Conformance: the 10 door cases pass in the Go, TypeScript, Ruby, Python, Kotlin and Rust runners. Each runner passes its full suite, with no failures and no door case skipped. The Swift runner is macOS-only, so CI runs it.