Repository navigation
Description
Epic: Fly.io apply path — a Fly lexicon + flaps applier + mudflaps emulator
Status: PLANNING / ready for pickup. Decomposed into 8 child issues (#737–#744) across
4 phases. Each child is written for cold pickup: context, dependencies, concrete paths,
references, and testable acceptance criteria. Start at the critical path (below).
What this is (for someone new to the repo)
chant is a type system for operations: typed TypeScript resources → pure local chant build
→ a spec-native artifact → a native applier that reconciles the artifact against a live
system using cloud-side ownership markers, with no state file. Each provider is a
lexicon (typed resources + lint + serializer + an applier). Today: aws/azure/gcp/k8s/
helm/gitlab/github/forgejo/docker/temporal. This epic adds fly.
The closest existing peer to copy is lexicons/gcp — a direct-REST applier that does its
own diff + owned-only prune (not a stack-deploy like CloudFormation/ARM). Read
lexicons/gcp/src/op/activities/gcp-apply.ts and floci-gcp.ts before starting anything.
Goal
A @intentius/chant-lexicon-fly package + a flyApply applier that speaks Fly's Machines
API (flaps) REST directly and is endpoint-overridable, so the same code targets real Fly or a
local emulator. Plus mudflaps, a standalone stateful flaps emulator (its own repo) that
makes the whole loop runnable offline.
Decisions log (settled — do not re-litigate)
- D1. Direct flaps REST, no
flyctlshell-out, no state file. Same stateless model as the
other appliers. - D2. Ownership marker = machine
metadatamanaged-by: chant(+ a stack/env key). The
Fly app is the ownership boundary for resource types that lack arbitrary metadata
(volumes, secrets, certs, IPs). Wire the convention via ownership: lexicons declare their ownership key convention (drop core's aws-tag/azure-tag map) #686. - D3. Endpoint override =
FLY_FLAPS_BASE_URL(defaulthttps://api.machines.dev, all
paths prefixed/v1). The same mechanism points the applier at real Fly or atmudflaps
with zero code change. Verified insuperfly/fly-goflaps/flaps.go. - D4. The lexicon + applier are TypeScript (chant is TS on Bun), living in
lexicons/fly. - D5. The emulator (
mudflaps) is its own repo, written in Go — so it imports
superfly/fly-go's types (Machine,MachineConfig,MachineLease, state constants,
NonceHeader) directly and cannot drift from the real wire contract. Shipped as a Docker
image; chant consumes it only via aflapsUp/Downwrapper (exactly how the gcp lexicon
consumes the externalfloci-gcpimage). - D6. Types are generated from the OpenAPI 3.0.1 spec at
https://docs.machines.dev/spec/openapi3.json, cross-checked againstsuperfly/fly-go. - D7. Secrets are apply-only (set-only, no read-back) — excluded from drift/diff.
- D8. A stateful flaps emulator is confirmed vacant (nothing on GitHub/npm/crates; only the
real clients overrideFLY_FLAPS_BASE_URL). A Prism/WireMock schema mock is not a
substitute — it has no state machine, leases, or version churn. This is whymudflaps
exists.
Repo layout (target)
lexicons/fly/— the lexicon (mirrorlexicons/gcp/src/**):
src/spec/openapi3.json,src/generated/,src/codegen/,src/op/activities/{fly-apply.ts,flaps.ts,index.ts},
src/lint/rules/,src/composites/(deploy Op). Package name@intentius/chant-lexicon-fly.examples/local-fly/— the starter example (mirrorexamples/local-cloud-trio/).mudflaps(separate repo, Go) — the emulator + its own tests; published as a Docker
image. Done: https://github.com/INTENTIUS/mudflaps v0.3.0 (ghcr.io/intentius/mudflaps, 42
endpoints, full lease/version/wait fidelity, CI green, MIT). fly lexicon: chant-side flaps wrapper (boot the mudflaps image for local tests) #740 is now only the chant-side wrapper.
The catch (be honest)
- No server-side declarative apply —
flyApplyowns the plan→CRUD loop (the gcp model). - Local testing is not free: Floci covers AWS/Azure/GCP only and isn't chant's to extend, so
mudflapsis net-new (Phase 1, un-deferred). - Ownership markers are uneven outside Machines (D2) — lean on the app boundary; document it.
- chant is the typed-spec + lint + drift + reconcile layer above
fly deploy, not a
replacement for its rollout mechanics.
Child issues by phase
Phase 0 — Lexicon scaffold
- fly lexicon: scaffold chant-lexicon-fly (chant init lexicon + OpenAPI generate) #737 —
chant-lexicon-flypackage + LexiconPlugin skeleton; types from OpenAPI.
Phase 1 — The spine (applier + emulator, built together)
- fly lexicon: App + Machine typed resources + serializer (machine-config / fly.toml) #738 — App + Machine typed resources + serializer.
- fly lexicon: flyApply — direct flaps REST applier (endpoint-overridable, owned-only prune, leases) #739 —
flyApply: direct flaps REST applier (endpoint override, owned-only prune, leases). - fly lexicon: chant-side flaps wrapper (boot the mudflaps image for local tests) #740 — chant-side
flapsUp/Downwrapper that boots themudflapsimage (the
emulator itself is done — v0.3.0).
Phase 2 — Breadth
- fly lexicon: Volume + IPAddress + Certificate + Secret (apply-only) resources #741 — Volume + IPAddress + Certificate + Secret (apply-only) resources.
- fly lexicon: semantic lint rules (regions, guest sizing, mounts↔volumes, no secret literals) #742 — Semantic lint rules.
- fly lexicon: ownership convention — machine metadata + app boundary (ties #686) #743 — Ownership convention wiring (ties ownership: lexicons declare their ownership key convention (drop core's aws-tag/azure-tag map) #686).
Phase 3 — Op + example
- fly lexicon: Fly deploy Op + local-fly starter example (App+Machine end-to-end) #744 — Fly deploy Op +
local-flystarter example (App+Machine end-to-end).
Suggested build order (critical path)
#737 → #738 → (#739 ∥ #740) → #744, then breadth (#741/#742/#743) in any order.
#739 and #740 are developed together: the applier is validated against the emulator. #744 is
the integration proof (green offline run). Breadth issues extend an already-working spine.
Definition of done (epic)
-
flyApplydeploys App + Machine tomudflapsover REST — create →/waitstarted →
update (new version) → owned-only prune — offline, no token. - Endpoint override proven: same applier hits real Fly (with a token) and
mudflapswith
only theFLY_FLAPS_BASE_URLchange. -
examples/local-flyruns green with no Fly account and, unchanged, against a real org. - Lint catches an invalid region and a mount referencing an undeclared volume at build.
Out of scope
No flyctl shell-out; no state file; not replacing fly deploy's rollout. Not a full flaps
reimplementation (mudflaps covers the applier's endpoint subset + state transitions). Not
upstreaming Fly into Floci.
Related
Applier peers awsApply #734, azApply #707, gcpApply #706; appliers-in-lexicons #714;
ownership seam #686; audit-rule metadata #687; GCP starter pattern #711.
Follow-ups (post-epic)
Beyond the original apply-path scope, tracked separately:
-
feat(fly): Managed Agents worker Op on Sprites (per-session sandbox execution) #847 — Managed Agents worker Op on Sprites (per-session sandbox execution). Builds on the Sprite Op activities (sprites: Sprite lifecycle as chant Ops + a testable emulator (complementary to the fly lexicon) #762) and the real Sprites API surface (sprites: confirm the real Sprites REST surface + wire the real-API path (S6 follow-up to #762) #766).
-
feat(fly): Sprite filesystem Op activities (read/write/list/remove) #848 — Sprite filesystem Op activities (read/write/list/remove). Verb-gap fill; driver in feat(fly): Managed Agents worker Op on Sprites (per-session sandbox execution) #847.
-
design(fly): reconcile a Sprite's network policy + services (typed config) #849 — design: reconcile a Sprite's network policy + services as typed config. Desired-state surface; drivers in feat(fly): Managed Agents worker Op on Sprites (per-session sandbox execution) #847 (services) and the governance theme (egress allowlist).
Not pursued: Sprite-as-declarable resource — the create body ({name, wait_for_capacity, url_settings}) has no reconcilable desired state, so #762's Op-primitive model stands.
Activity
[-]chant has no Fly.io apply path: add a Fly lexicon + applier (direct flaps REST → floci-fly / real Fly)[/-][+]chant has no Fly.io apply path: add a Fly lexicon + applier (direct flaps REST → real Fly, standalone fake-flaps emulator later)[/+][-]chant has no Fly.io apply path: add a Fly lexicon + applier (direct flaps REST → real Fly, standalone fake-flaps emulator later)[/-][+]Epic: Fly.io apply path — a Fly lexicon + flaps applier + fake-flaps emulator[/+]lex00 commentedon Jul 10, 2026
Phase-1 update: the
mudflapsemulator (#740) now has a live repo — https://github.com/INTENTIUS/mudflaps (Go, MIT, CI green). The local-testing target forflyApply(#739) exists; the applier can be developed against it.lex00 commentedon Jul 11, 2026
Epic complete — all sub-issues landed on main
The Fly.io apply path is built end to end:
examples/local-fly(App+Machine end-to-end)Proven against the live
mudflapsemulator: #739's applier integration tests (lease-conflict retry, wait-on-new-version, owned-only prune) and #744's full deploy Op loop (Emulator → Build → Apply → Verifystarted→ Teardown,ok:true) both run against a real container locally and skip cleanly in CI.Decisions honored: D1 direct REST (no flyctl/state file), D2 managed-by machine metadata + app-boundary ownership, D3
FLY_FLAPS_BASE_URLoverride (same code → mudflaps or real Fly), D7 apply-only secrets excluded from drift/diff.Closing the epic.
fly: real README + docs overview (#736) (#761)
feat(fly): Managed Agents worker Op on Sprites + keep-alive Tasks (#847)
feat(fly): Managed Agents worker Op on Sprites + keep-alive Tasks (#847)
feat(fly): Managed Agents worker Op on Sprites + keep-alive Tasks (#847…
lifecycle: emit --json for the --live diff path (#852) (#857)
lex00 commentedon Jul 14, 2026
Follow-ups closed out: #847 (#856), #848 (#850), #849 (#854) all merged to main. Remaining: #855 — spritzer must serve the new fs/policy/services/tasks endpoints (they're fake-only until then).