Skip to content

feat(prisma-postgres): 2026-08-21 spec refresh + typed 409 conflicts - #470

Draft
wmadden wants to merge 3 commits into
alchemy-run:mainfrom
wmadden-electric:feat/prisma-postgres-management-coverage
Draft

feat(prisma-postgres): 2026-08-21 spec refresh + typed 409 conflicts#470
wmadden wants to merge 3 commits into
alchemy-run:mainfrom
wmadden-electric:feat/prisma-postgres-management-coverage

Conversation

@wmadden

@wmadden wmadden commented Aug 21, 2026

Copy link
Copy Markdown

Refresh prisma-postgres to the 2026-08-21 Management API spec and type the error responses its consumers already handle. Follow-up to alchemy-run/alchemy#1061: alchemy's Prisma provider is moving off its hand-rolled client onto this SDK, and these are the routes and typed errors it needs.

Changes

  • Spec bump (specs/distilled-spec-prisma-postgres 2026-06-30 → 2026-08-21): generated ops 73 → 102. Adds the 7 /v1/buckets + bucket-key routes (the key-create response types accessKeyId/secretAccessKey as sensitive), builds, alchemy-state, service-token, and github-actions-token routes. Upstream removed /v1/compute-services/** (15 generated exports dropped, superseded by /v1/apps + /v1/deployments; nothing in-repo referenced them) and the never-generated deprecated /v1/versions/** spec routes.
  • patches/003: declares five 409 responses the spec omits but consumers already catch — project create/delete, database create (both routes), connection create — using the spec's standard {error:{code,message,hint}} envelope. Each is backed by a real catchIf(isConflict, …) site in alchemy's Prisma provider; none has a documented machine-readable code, so they surface as the status-mapped Conflict class.

Why

The regenerated diff is large but is generated output (.generated-specs/management.json, src/services/management.ts) — the reviewable surface is the spec pin and patches/003. Existing patches 001/002 apply cleanly to the new spec unchanged. typecheck and typecheck:strict green.

…age)

Bump specs/distilled-spec-prisma-postgres to aafec81 and regenerate the
management service: 73 -> 102 generated operations. At the spec level the
route count went 95 (22 of them deprecated and skipped by the generator)
-> 102 with none deprecated.

Added: /v1/buckets (+keys), /v1/builds, alchemy-state routes, service
tokens, workspace subscription, github-actions token.
Removed upstream: /v1/compute-services/* and /v1/versions/* (superseded
by /v1/apps + /v1/deployments). Only compute-services had generated
exports (15 removed); /v1/versions/* was deprecated and never generated.
No consumers in-tree either way.

Both OpenAPI patches still resolve against the new spec unchanged.

Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
Declare the conflict responses the spec omits on five operations so they
surface as the typed Conflict class instead of the catch-all:

- POST /v1/projects, POST /v1/databases, POST /v1/connections,
  POST /v1/projects/{projectId}/databases: 409 on a name/default collision
- DELETE /v1/projects/{id}: 409 when the project still owns resources
  (it already declared the 400 variant)

Each is backed by a consumer that recovers from the status today. Envelopes
use the generic {error:{code,message,hint}} shape; none of these statuses
carries a documented const code, so no named error class.

Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
…ready handle

patches/004-add-lifecycle-list-404-responses.patch.json adds the 404
responses the spec omits on two filtered list routes, so they land in the
typed unions as NotFound instead of the catch-all:

- GET /v1/apps: alchemy's destroyProjectApps treats a 404 from the
  project-filtered listing as the project already being gone
  (packages/alchemy/src/Prisma/ComputeLifecycle.ts).
- GET /v1/environment-variables: alchemy's destroyComputeEnvironment
  treats a 404 from the project-filtered lookup as already cleaned up
  (packages/alchemy/src/Prisma/Compute.ts). Slice 1 removed this same
  route's 404 as unbacked (F-2); the backing consumer is in the D3
  files that were out of that round's scope.

Like the 409 round, these are inferred from consumer behavior, not
live-probed: if a live run surfaces UnknownPrismaPostgresError here,
fix this matcher rather than loosening the consumer.

Signed-off-by: willbot <w.a.madden+machine@gmail.com>
Signed-off-by: Will Madden <madden@prisma.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants