Repository navigation
fly: App + Machine serializer emitting flaps create bodies (#738) - #751
Merged
Merged
Conversation
Replace the scaffold serializer stub with the real flySerializer: it turns declared App and Machine resources (over #737's generated types) into the JSON create bodies flaps accepts, keyed by entity name as { endpoint, method, body } so #739's applier can POST them verbatim and mudflaps round-trips them. Field names follow mudflaps' Go structs (the wire oracle), which win over the OpenAPI-generated TS names: App create body is { app_name, org_slug } (not `name`); Machine body is { name?, region?, config } with the owning app as a URL path segment, not a body field. D2: every serialized Machine carries the managed-by: chant ownership marker (plus stack/env from context.ownership) merged into config.metadata, even when the user set no metadata — the marker wins over colliding keys so ownership can't be silently unset. Ownership key naming lives in a new src/ownership.ts (FLY_METADATA_OWNERSHIP_KEYS), mirroring aws/azure. 16 fly package tests pass; generate + validate green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…hant fly's src/generated is gitignored (regenerated in prepack), but the CI "Generate lexicon artifacts" step enumerated lexicons explicitly and omitted fly — so the generated types were absent at test time and serializer.test.ts (which imports ./generated/index) failed with ERR_MODULE_NOT_FOUND. #750 passed only because no test imported generated yet. Add `npm run --prefix lexicons/fly prepack` to both generate steps, and move fly's spec cache to ~/.chant (matching k8s) so CI's schema cache covers it and a docs.machines.dev hiccup falls back to cache instead of failing generate. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 11, 2026
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.
Closes #738 (Phase 1 spine). Turns declared
App/Machineresources — built on #737's generated types (D6) — into the JSON create bodies flaps accepts, so #739's applier can POST them verbatim and mudflaps round-trips them.Output shape
A JSON object keyed by entity name; each value is one flaps request:
{ "web": { "endpoint": "/v1/apps", "method": "POST", "body": { "app_name": "my-app", "org_slug": "acme" } }, "api": { "endpoint": "/v1/apps/my-app/machines", "method": "POST", "body": { "name": "api-1", "region": "iad", "config": { "image": "flyio/hellofly:latest", "guest": { "cpu_kind": "shared", "cpus": 1, "memory_mb": 256 }, "metadata": { "managed-by": "chant", "chant-stack": "billing", "chant-env": "prod" } } } } }Wire fidelity
Field names come from mudflaps' Go structs (the oracle), which win over the OpenAPI-generated TS names:
{ app_name, org_slug }— not the generatedname.{ name?, region?, config }; the owning app is a URL path segment, not a body field.D2 ownership
Every serialized Machine carries
managed-by: chant(plus stack/env fromcontext.ownership) merged intoconfig.metadata, even with no user metadata — the marker wins over colliding keys so ownership can't be silently unset. Key naming lives in a newsrc/ownership.ts, mirroring aws/azure.Tests
16 fly package tests pass (serializer 8, incl. bare-machine marker + ownership stack/env +
app_namefidelity).generate+validategreen;check-lexiconno regression.Deferred to #739: actually POSTing to mudflaps, leases/nonce,
/wait, owned-only prune. Volume/IP/cert/secret are recognized-but-skipped (out of scope → #741).🤖 Generated with Claude Code