Skip to content

fix(fly-io): restore Machines patches after /v1 spec-mirror prefix - #539

Open
Mkassabov wants to merge 3 commits into
mainfrom
feat/fly-io-v1-patches
Open

fix(fly-io): restore Machines patches after /v1 spec-mirror prefix#539
Mkassabov wants to merge 3 commits into
mainfrom
feat/fly-io-v1-patches

Conversation

@Mkassabov

Copy link
Copy Markdown
Collaborator

What happened

#480 regenerated Fly from spec-mirror-fly-io, which prefixes every Machines path with /v1. The RFC-6902 patches in packages/fly-io/patches/ still targeted /apps/..., /machines/..., etc.

Stale JSON pointers were warn-and-skip. The whole chain vanished, so the committed SDK lost:

  • verb-first operationIds (getApp, listApps, createMachine, …) — back to go-swagger Apps_show / Apps_list
  • typed 400 / 403 / 404 (BadRequest, Forbidden, NotFound) — everything collapsed to FlyIoOpError

.generated-specs was also the pre-patch Smithy model, so even a working patch chain did not show up in the committed spec.

Fix

  • Rewrite Machines patch pointers to /v1/...
  • Replace patches/machines/operationIds.patch.json with rewriteOpenApiOperationIds (lookup by the spec's current operationId, optionally method+path — PUT vs PATCH metadata share Machines_update_metadata)
  • Convert/generate fail on stale patch targets (onStalePatch: "warn" to opt back into skip)
  • OpenAPI patches apply in convert; leftover Smithy-model patches in generate are written back so .generated-specs is the patched model

Restored in src/services/machines.ts:

export type GetAppError = Forbidden | NotFound | FlyIoOpError
export const getApp: API.OperationMethod<...>
export const listApps: API.OperationMethod<...>

Note

Default fail-on-stale is global. The next regenerate of a package with truly stale pointers will fail until those patches are fixed or onStalePatch: "warn" is set.

The spec-mirror prefixed every Machines path with /v1; RFC-6902 patches
still pointed at /apps/... and were silently skipped, so regeneration
#480 dropped verb-first operationIds (getApp, listApps) and typed
400/403/404 errors.

Rewrite the patch JSON pointers, replace operationIds.patch.json with
rewriteOpenApiOperationIds (lookup by current id, not URL), fail
convert/generate on stale targets, and persist patched Smithy back to
.generated-specs.
@alchemy-version-bot

alchemy-version-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

Distilled

@distilled.cloud/core

bun add https://pkg.ing/@distilled.cloud/core/8a6eec1

@distilled.cloud/aws

bun add https://pkg.ing/@distilled.cloud/aws/8a6eec1

@distilled.cloud/axiom

bun add https://pkg.ing/@distilled.cloud/axiom/8a6eec1

@distilled.cloud/azure

bun add https://pkg.ing/@distilled.cloud/azure/8a6eec1

@distilled.cloud/cloudflare

bun add https://pkg.ing/@distilled.cloud/cloudflare/8a6eec1

@distilled.cloud/coinbase

bun add https://pkg.ing/@distilled.cloud/coinbase/8a6eec1

@distilled.cloud/discord

bun add https://pkg.ing/@distilled.cloud/discord/8a6eec1

@distilled.cloud/expo-eas

bun add https://pkg.ing/@distilled.cloud/expo-eas/8a6eec1

@distilled.cloud/fly-io

bun add https://pkg.ing/@distilled.cloud/fly-io/8a6eec1

@distilled.cloud/gcp

bun add https://pkg.ing/@distilled.cloud/gcp/8a6eec1

@distilled.cloud/github

bun add https://pkg.ing/@distilled.cloud/github/8a6eec1

@distilled.cloud/hetzner

bun add https://pkg.ing/@distilled.cloud/hetzner/8a6eec1

@distilled.cloud/kubernetes

bun add https://pkg.ing/@distilled.cloud/kubernetes/8a6eec1

@distilled.cloud/mongodb-atlas

bun add https://pkg.ing/@distilled.cloud/mongodb-atlas/8a6eec1

@distilled.cloud/neon

bun add https://pkg.ing/@distilled.cloud/neon/8a6eec1

@distilled.cloud/planetscale

bun add https://pkg.ing/@distilled.cloud/planetscale/8a6eec1

@distilled.cloud/posthog

bun add https://pkg.ing/@distilled.cloud/posthog/8a6eec1

@distilled.cloud/prisma-postgres

bun add https://pkg.ing/@distilled.cloud/prisma-postgres/8a6eec1

@distilled.cloud/railway

bun add https://pkg.ing/@distilled.cloud/railway/8a6eec1

@distilled.cloud/stripe

bun add https://pkg.ing/@distilled.cloud/stripe/8a6eec1

@distilled.cloud/supabase

bun add https://pkg.ing/@distilled.cloud/supabase/8a6eec1

@distilled.cloud/turso

bun add https://pkg.ing/@distilled.cloud/turso/8a6eec1

@distilled.cloud/typesense

bun add https://pkg.ing/@distilled.cloud/typesense/8a6eec1

@distilled.cloud/vercel

bun add https://pkg.ing/@distilled.cloud/vercel/8a6eec1

@distilled.cloud/workos

bun add https://pkg.ing/@distilled.cloud/workos/8a6eec1

Naming is convert policy, not a spec patch. operationNaming: "verbNoun"
turns go-swagger Apps_list / Apps_show into listApps / getApp in the
Smithy model. Irregulars (shared PUT/PATCH ids, HTTP-method suffixes)
go in operationNames, keyed by METHOD path.

Fly Machines uses that instead of a 75-entry rewrite table. Postgres
ops that were never in the old map follow the same verbNoun shape
(listPostgres, createPostgres, …).
RFC-6902 patches (OpenAPI and Smithy) run as part of spec generation so
.generated-specs is the patched model. generate only compiles Smithy to
TypeScript.

OpenAPI ops apply before conversion; /shapes and /metadata ops apply
after. Cloudflare and Discord Smithy patches are baked into the committed
models; generate.ts no longer has a patch chain.
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.

1 participant