Skip to content

fix: preserve fly scale guest on deploy with partial [[vm]] (#4544)#4946

Draft
kylemclaren wants to merge 1 commit into
masterfrom
fix/issue-4544
Draft

fix: preserve fly scale guest on deploy with partial [[vm]] (#4544)#4946
kylemclaren wants to merge 1 commit into
masterfrom
fix/issue-4544

Conversation

@kylemclaren

@kylemclaren kylemclaren commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #4544.

With a partial [[vm]] block in fly.toml (e.g. only cpu_kind = "shared", no cpus/memory), fly deploy reset the machine to the shared-cpu-1x / 256MB defaults — silently overriding a size previously set with fly scale vm.

The guest builder now preserves the machine's existing (scaled) size for any dimension the partial [[vm]] doesn't explicitly specify, instead of falling back to defaults.

Testing: added a regression test in internal/appconfig that loads a partial [[vm]] against an already-scaled machine — it fails on master (machine downsized) and passes with the fix. go test ./internal/appconfig/... is green.


Live-verified against a real org (ephemeral app, cleaned up afterward):

  • Latest flyctl (master): after fly scale vm shared-cpu-2x --memory 1024, a second fly deploy with a partial [[vm]] (cpu_kind only) reset the machine to shared-cpu-1x / 256MB (fly scale show confirmed the loss; master even warns it will override).
  • This branch: same live scenario → the scaled size shared-cpu-2x / 1024MB is preserved after deploy.

🤖 Generated with Claude Code

A partial `[[vm]]`/`[[compute]]` section that only set a subset of fields
(e.g. just `cpu_kind`) caused `fly deploy` to reset machines back to the
shared-cpu-1x/256MB preset, discarding values previously set via
`fly scale vm/--memory`.

`computeToGuest` always seeded a full preset via `SetSize(DefaultVMSize)`
and then copied only the user-specified fields on top, producing a
fully-populated guest that `updateMachineConfig` applied wholesale over
the live (scaled) machine config passed as `src`.

Thread the existing machine guest into `toMachineGuest`/`computeToGuest`.
When the user supplies neither an explicit `size` nor a GPU compute, build
on top of the existing guest (preserving `fly scale` values) and override
only the fields explicitly listed in the section. Behavior is unchanged
when there is no existing guest (fresh machines still get preset
defaults), when an explicit `size` is given, and for GPU computes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kylemclaren kylemclaren marked this pull request as draft June 30, 2026 14:00
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 deploy resets vm to shared-cpu-1x 256MB

1 participant