fix(deploy): reject colliding fleet name before provisioning an instance - #142
Merged
Conversation
"+ New fleet" always appended a brand-new [fleet.<name>] block (appendFleetBlock/appendK8sFleetBlock have no merge path), so reusing an existing fleet name only surfaced as a duplicate-key TOML parse error *after* deploy_provision_agent had already stood up the instance — leaving it deployed but unregistered in fleets.toml/fleets-k8s.toml, since fleet_config_write/k8s_fleet_config_write validate before writing and reject the whole file. Check the name against the target config (AWS or k8s, per the provider picker) in the identity-form step and block early with a clear message, before Step 2 can deploy anything.
2 tasks
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.
Summary
Brett hit this live: "New fleet" deploy on the k8s path deployed the instance (
Hera) fine, thenfleets-k8s.toml update failed: TOML parse error ... duplicate key \studio-agents` in table `fleet`— because a k8s fleet namedstudio-agents` already existed.Root cause:
appendFleetBlock/appendK8sFleetBlock(console/src/fleetToml.ts/fleetsK8sToml.ts) always append a brand-new[fleet.<name>]block — there's no merge path, sincefleet_config_write/k8s_fleet_config_writeare whole-file verbatim writes (studio#104's documented no-partial/append-primitive tradeoff). Reusing an existing fleet name in "New fleet" therefore only surfaces as a duplicate-key parse failure afterdeploy_provision_agentalready stood up the instance — the instance is live but never gets registered as a fleet member (the write is rejected before touching disk, so the config file itself isn't corrupted, just stale).Compounding factor: adding an instance to an existing k8s fleet isn't wired through the wizard yet (see the
isK8scomment indeploy.ts's deploy-submit handler), so reusing "New fleet" for that case is currently the only UI path — making this collision easy to hit.Fix
Check the fleet name against the target config (
fleets.tomlorfleets-k8s.toml, per the provider picker) in the identity-form submit handler, and block with an actionable message before Step 2 can deploy anything:New
fleetBlockExistsexport infleetToml.ts(reused by both configs, same asappendMember).Not fixed here
Herak8s instance from this incident is already deployed but not registered in his localfleets-k8s.toml— that's a local file on his machine, needs manual reconciliation (addHera's service name to[fleet.studio-agents]'smembers), not something this PR touches.Test plan
npm run typecheck— cleannpx vitest run— 103/103 passing, incl. 3 newfleetBlockExistscases