feat(people): add project client access and client enablement operations

Merged
JE
3mo ago
+5318-21

What

Absorbs the project client-users API that shipped in basecamp/bc3#13098 (1d8d4ce95d, deployed): three new operations on the People service, modeled in Smithy and regenerated across all six SDKs.

OperationRouteNotes
UpdateProjectClientAccessPUT /projects/{id}/people/client_users.jsonclient-side counterpart of UpdateProjectAccess; same grant/revoke/create triad
EnableProjectClientsPOST /projects/{id}/client_enablement.jsonanswers {"clients_enabled": true}
DisableProjectClientsDELETE /projects/{id}/client_enablement.jsonanswers {"clients_enabled": false}

Endpoint contract

  • create rows need only email_address; name defaults to the address server-side, title and company_name are optional. Modeled as CreateClientRequest (distinct from CreatePersonRequest, which requires name).
  • Only client users are eligible: a grant id belonging to a team member is omitted from granted rather than cross-graded, and revoke never removes a team member. Response is the existing ProjectAccessResult shape, each person client: true.
  • 403 until clients are enabled on the project; enabling is deliberately a separate call because it applies the project's default client visibility. POST enablement is 403 unless the project can have clients; DELETE is 403 while any client users remain.
  • Invitations are all-or-nothing. An invalid create row (an email-less one included) answers 422 {"errors": [{"email_address", "messages"}]} naming each rejected row, and nobody is invited. New distinct addresses that would exceed the account's user limit answer a bare 429, and nobody is invited; addresses already on the account take no seat and a repeated address counts once.

Two contract traits this op does not inherit from UpdateProjectAccess

  1. The 429 is a verdict, not throttling. It carries no Retry-After and re-asking cannot change the answer, so the operation declares retryOn: [503] instead of the shared [429, 503]. Every SDK gates status retry on the declared set (SPEC §7 Gate 3), so the 429 surfaces on the first attempt; a conformance case asserts one request and rate_limit/httpStatus 429 in all six runners. The error keeps the status-mapped rate_limit code (SPEC §6 maps by status, and the bare body gives nothing to shape-detect); I'm not adding operation-aware error mapping across six SDKs for one route — a caller that hit this op knows a 429 from it is the seat limit. SPEC's "all operations use [429, 503]" sentences now name the exception. Happy to revisit if the CLI needs a distinct code.
  2. The 422 body is a row list, not a field map. SPEC §6 had two 422 shapes ({error} and {errors: {field: [...]}}); this one is {errors: [{email_address, messages}]} (with email_address: null for a blank row), and every SDK dropped the rows and answered "Request failed (HTTP 422)". New SPEC §6 step 1b keys the shared field_errors slot by each row's email_address, else an integer index (the account enrollment API's spelling), else its position, so the rejected addresses reach both message (not-an-address: Email address must be valid) and the structured slot in all six languages. Unit tests in each SDK replay the literal bc3 controller bodies plus strict-gate negatives; the people service tests assert the slot; a conformance case pins the composed message across the runners. I reused the existing slot rather than adding a per-operation typed error class in six languages: the rows already are a map from an identifier to messages.

What else is in here

  • Idempotency: all three are naturally idempotent (the PUT re-asks the same all-or-nothing question; the toggles re-answer the same state), so check-idempotency-parity advances 88 → 91 / 216 → 219 and EnableProjectClients is the eleventh flagged POST in SECURITY.md.
  • Go: hand-written wrappers over the generated client; all three accounted for in the grouped-client inventory (not grouped, beside UpdateProjectAccess).
  • Tests in all six languages: wire body (name omitted when blank), enablement toggle, 403/422/429 paths. Conformance: paths, request body, 503 retries, single-attempt 429, row-keyed 422, dispatched in all six runners.
  • Provenance pin does not move. The range since the pin also carries the Subtask API, circles create, bulk enrollments, backlinks and unscoped recording-show families, which need their own triage. The three routes are waived in spec/bc3-route-allowlist.yml with routes.rb/controller/test-api evidence and marked for deletion at the next repin; the contract is registered as spec/api-gaps/project-client-users.md (absorbed-in-sdk).

Release notes: enhancement.

Downstream

The CLI PR (basecamp-cli, feat/project-clients) pins this branch and will flip to the tagged release after merge, as #839 → basecamp-cli#677 did.

I'm babysitting the review loop on this PR: Copilot, Codex, cubic and CI feedback each get a fix or a reasoned reply per round.


Summary by cubic

Adds three People service operations that manage project client users, ported from basecamp/bc3#13098 into all six SDKs.

New Features

  • UpdateProjectClientAccess uses the same grant/revoke/create triad as UpdateProjectAccess; create rows need only email_address, and name defaults to the address server-side.
  • EnableProjectClients and DisableProjectClients toggle enablement and are a required first step (403 until enabled).
  • Only client users are eligible: team-member IDs are omitted from granted, and revoke never removes a team member.
  • All three operations are naturally idempotent.
  • The TypeScript request type is exported from the package root.
  • Go classifies UpdateProjectClientAccess as project_access to match the other SDKs.

Error handling

  • Invitations are all-or-nothing; one bad create row rejects the whole batch with a row-keyed 422 naming each rejected email_address.
  • The row-keyed 422 is a new error shape (SPEC §6 step 1b); rejected addresses now reach the field_errors slot instead of a bare "Request failed".
  • Malformed row selectors fall through to the next keying strategy rather than discarding the whole list.
  • Swift now treats a boolean index selector as malformed, keying the row by position instead of "1".
  • The seat-limit 429 is a verdict, not throttling, so UpdateProjectClientAccess retries only on 503 and surfaces the 429 on the first attempt; the retry documentation now names this exception.

The provenance pin stays put; the new routes are waived in the bc3 route allowlist, and the gap entry now references the provenance file rather than embedding the pin SHA.