Skip to content

fly: describeResources for plan + drift (#767) - #775

Merged
lex00 merged 1 commit into
mainfrom
fly-describe-767
Jul 11, 2026
Merged

lex00 merged 1 commit into
mainfrom
fly-describe-767

Conversation

@lex00

@lex00 lex00 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Closes #767. Wires the read-back seam so chant's plan/drift machinery sees live Fly state — the capability that closes the biggest gap against Terraform.

What

The write path (flyApply, #739/#741) already reads live state to decide create/update/noop and prune owned orphans. This surfaces that same read side through the standard describeResources seam, so core's buildChangeSet and chant lifecycle plan can classify create/update/delete/adopt/noop for Fly.

  • Two-tier ownership verdict (fly lexicon: ownership convention — machine metadata + app boundary (ties #686) #743): machines per-marker (managed-by: chant → owned, else foreign); metadata-less types (volumes/IPs/certs) at the app boundary — everything under a chant-managed app is owned. Honors the owned filter and logs when app-boundary ownership is inferred, per the seam contract. Secrets excluded (D7).
  • Reuses the applier verbatim: resolveEndpoint (FLY_FLAPS_BASE_URL/FLY_API_TOKEN) so plan reads the same target apply writes, and configEqual so the update/noop decision agrees with apply.
  • flyPlan renders the declared-vs-live change set without mutating (optional dry-run).

The safety property, proven live against mudflaps

CREATE: web2
DELETE: gone  (Fly::Machines::Machine) [owned]
ADOPT:  legacy (Fly::Machines::Machine) [foreign]   # unmarked → never a delete
NOOP:   app [owned], web [owned]

The integration test asserts an unmarked machine is adopt and never appears as a delete.

Verification

90 fly tests pass (6 unit + 1 live mudflaps integration + existing); validate clean; check-lexicon Tier 1 unchanged.

Note: core's chant diff is a build-output-vs-file text diff and doesn't call describeResources; the declared-vs-live change-set path is chant lifecycle plan (its handler calls plugin.describeResources then buildChangeSet), which is what's demonstrated. Core was not touched, so the declared-vs-live configEqual refinement lives in the fly-side flyPlan glue.

🤖 Generated with Claude Code

Wire the read-back seam so chant's plan/drift machinery can see live Fly state.
The write path (flyApply, #739/#741) already GETs live state to decide
create/update/noop and prune owned orphans; this surfaces that same read side
through the standard describeResources seam, so buildChangeSet and
`chant lifecycle plan` can classify create/update/delete/adopt/noop for Fly.

- describeResources lists live flaps resources (apps + machines, volumes, IPs,
  certs), keyed by chant entity name, with a two-tier ownership verdict (#743):
  machines per-marker (`managed-by: chant` → owned, else foreign); metadata-less
  types at the app boundary. Honors the `owned` filter; logs when app-boundary
  ownership is inferred rather than returning everything. Secrets excluded (D7).
- Endpoint + auth reuse the applier's resolveEndpoint (FLY_FLAPS_BASE_URL /
  FLY_API_TOKEN) verbatim, so plan reads the same target flyApply writes; the
  update/noop decision reuses configEqual so plan and apply agree.
- flyPlan renders the declared-vs-live change set (renderChangeSet) without
  mutating — an optional dry-run.

The safety property is proven live against mudflaps: an unmarked machine reads
`foreign` and classifies as `adopt`, never a delete; a removed owned machine is
a delete. 90 fly tests pass (6 unit + 1 live integration + existing).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lex00
lex00 merged commit 94ee652 into main Jul 11, 2026
5 checks passed
@lex00
lex00 deleted the fly-describe-767 branch July 11, 2026 22:09
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.

fly: describeResources for plan + drift (wire the read-back seam)

1 participant