fix: preserve fly scale guest on deploy with partial [[vm]] (#4544)#4946
Draft
kylemclaren wants to merge 1 commit into
Draft
fix: preserve fly scale guest on deploy with partial [[vm]] (#4544)#4946kylemclaren wants to merge 1 commit into
kylemclaren wants to merge 1 commit into
Conversation
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>
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.
Fixes #4544.
With a partial
[[vm]]block infly.toml(e.g. onlycpu_kind = "shared", nocpus/memory),fly deployreset the machine to the shared-cpu-1x / 256MB defaults — silently overriding a size previously set withfly 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/appconfigthat loads a partial[[vm]]against an already-scaled machine — it fails onmaster(machine downsized) and passes with the fix.go test ./internal/appconfig/...is green.✅ Live-verified against a real org (ephemeral app, cleaned up afterward):
fly scale vm shared-cpu-2x --memory 1024, a secondfly deploywith a partial[[vm]](cpu_kindonly) reset the machine to shared-cpu-1x / 256MB (fly scale showconfirmed the loss; master even warns it will override).🤖 Generated with Claude Code