feat(fleet): YAML tab for fleet plans (view + edit source inline) - #554
Merged
Merged
Conversation
Replace the broken "Import/Export YAML" toggle in the plan detail view with a first-class YAML tab (Overview / Settings / Agents / YAML). The toggle opened an empty editor and never persisted because platform mode never reconciled the two FleetPlan columns: `definition` (the JSON source of truth every other tab and execution reads) and `yaml_content` (a separate raw string). `GetPlanYAML` returned only `yaml_content`, which is empty for any plan created in the UI; `SavePlanYAML` wrote only `yaml_content`, so edits never reached the other tabs. Backend (pkg/store/entstore/team_fleet.go): - GetPlanYAML now serializes `definition` to YAML (healing name/key from the row columns), falling back to `yaml_content` only if marshalling fails. The tab always matches the other tabs and is never blank. - SavePlanYAML parses the YAML, validates it (errors surface as 400), reconciles it into `definition` via Save(), and stores the raw text. Frontend: - fleetHooks: accept `yaml` as a valid detail tab (hash routing). - FleetConfigEditor: FleetDetailTabs takes an optional `tabs` prop so templates keep three tabs and only plans opt into YAML. - PlanDetail: render the YAML editor as a full-height tab; remove the old toggle button, its state, and the bottom-dock render. Tests: store round-trip (definition->YAML, name heal, save reconcile, validation) and a hook test for the yaml route.
|
|
…-tab tests Keep both helper functions (validPlan from the PR, validPlanAgents from main) and all six tests. Merge imports (add strings, yaml.v3 on top of main's set).
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.
What
Adds a first-class YAML tab to the Fleet Plan detail view (Overview · Settings · Agents · YAML) for viewing and editing a plan's source inline, and removes the old "Import/Export YAML" toggle button that opened an empty editor and never saved.
Why the old button was broken
A fleet plan row stores two columns:
definition(the JSON source of truth every other tab and execution reads) andyaml_content(a separate raw string). Platform mode never reconciled them:GetPlanYAMLreturned onlyyaml_content, which is empty for any plan created in the UI → blank editor.SavePlanYAMLwrote onlyyaml_content; it never parsed the YAML back intodefinition, so edits never reached the other tabs or execution.Changes
Backend —
pkg/store/entstore/team_fleet.go:GetPlanYAMLserializesdefinition→ YAML (healingname/keyfrom the row columns), so the tab always matches the other tabs and is never blank. Falls back toyaml_contentonly if marshalling fails.SavePlanYAMLparses the YAML, runsValidate()(errors surface as HTTP 400 in the editor), reconciles intodefinitionviaSave(), and also stores the raw text.Frontend:
fleetHooks.ts— acceptyamlas a valid detail tab (hash routing).FleetConfigEditor.tsx—FleetDetailTabstakes an optionaltabsprop; templates keep three tabs, only plans opt into YAML.PlanDetail.tsx— render the YAML editor as a full-height tab; remove the toggle button, its state, and the bottom-dock render.Scope is fleet plans only — fleet templates have no
yaml_contentcolumn or YAML endpoint.Tests
team_fleet_plan_test.go):GetPlanYAMLfrom definition-only rows (blank-editor regression), name healing from the column,SavePlanYAMLreconciliation intodefinition, and validation of invalid/name-less YAML.fleetHooks.test.ts): theyamltab is accepted from the hash.go build ./...clean; full Vitest suite (737 tests) green.resolves #555