fix(fly-io): restore Machines patches after /v1 spec-mirror prefix - #539
Open
Mkassabov wants to merge 3 commits into
Open
fix(fly-io): restore Machines patches after /v1 spec-mirror prefix#539Mkassabov wants to merge 3 commits into
Mkassabov wants to merge 3 commits into
Conversation
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What happened
#480 regenerated Fly from
spec-mirror-fly-io, which prefixes every Machines path with/v1. The RFC-6902 patches inpackages/fly-io/patches/still targeted/apps/...,/machines/..., etc.Stale JSON pointers were warn-and-skip. The whole chain vanished, so the committed SDK lost:
getApp,listApps,createMachine, …) — back to go-swaggerApps_show/Apps_listBadRequest,Forbidden,NotFound) — everything collapsed toFlyIoOpError.generated-specswas also the pre-patch Smithy model, so even a working patch chain did not show up in the committed spec.Fix
/v1/...patches/machines/operationIds.patch.jsonwithrewriteOpenApiOperationIds(lookup by the spec's currentoperationId, optionally method+path — PUT vs PATCH metadata shareMachines_update_metadata)onStalePatch: "warn"to opt back into skip).generated-specsis the patched modelRestored in
src/services/machines.ts: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.