Skip to content

feat(fleet): YAML tab for fleet plans (view + edit source inline) - #554

Merged
rschardosin merged 2 commits into
SAP:mainfrom
corey-aloia:feat/fleet-yaml-tab
Sep 26, 2026
Merged

rschardosin merged 2 commits into
SAP:mainfrom
corey-aloia:feat/fleet-yaml-tab

Conversation

@corey-aloia

@corey-aloia corey-aloia commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

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) and yaml_content (a separate raw string). Platform mode never reconciled them:

  • GetPlanYAML returned only yaml_content, which is empty for any plan created in the UI → blank editor.
  • SavePlanYAML wrote only yaml_content; it never parsed the YAML back into definition, so edits never reached the other tabs or execution.

Changes

Backend — pkg/store/entstore/team_fleet.go:

  • GetPlanYAML serializes definition → YAML (healing name/key from the row columns), so the tab always matches the other tabs and is never blank. Falls back to yaml_content only if marshalling fails.
  • SavePlanYAML parses the YAML, runs Validate() (errors surface as HTTP 400 in the editor), reconciles into definition via Save(), and also stores the raw text.

Frontend:

  • fleetHooks.ts — accept yaml as a valid detail tab (hash routing).
  • FleetConfigEditor.tsx — FleetDetailTabs takes an optional tabs prop; 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_content column or YAML endpoint.

Tests

  • Go (team_fleet_plan_test.go): GetPlanYAML from definition-only rows (blank-editor regression), name healing from the column, SavePlanYAML reconciliation into definition, and validation of invalid/name-less YAML.
  • Vitest (fleetHooks.test.ts): the yaml tab is accepted from the hash.
  • Verified in-browser (Studio, platform mode): tab appears, editor is populated, valid save reflects in Overview, invalid YAML returns a 400 without corrupting the plan, old button gone.

go build ./... clean; full Vitest suite (737 tests) green.

resolves #555

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.
@cla-assistant

cla-assistant Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ corey-aloia
❌ rschardosin
You have signed the CLA already but the status is still pending? Let us recheck it.

…-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).

@rschardosin rschardosin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@rschardosin
rschardosin merged commit d41436f into SAP:main Sep 26, 2026
6 of 7 checks passed
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.

Fleet plan YAML editor opens empty and never persists edits (platform mode)

2 participants