Skip to content

fix(editor): echo live session-trial content from GET /api/config/content (#97) - #106

Merged
falbany merged 1 commit into
feat/yaml-config-editorfrom
fix/editor-session-trial-content
Nov 4, 2026
Merged

falbany merged 1 commit into
feat/yaml-config-editorfrom
fix/editor-session-trial-content

Conversation

@falbany

@falbany falbany commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Closes #97 (sub-issue of the config editor #95).

Problem

Edit the file in the Config Editor → Apply → close → reopen: the editor showed an empty document with "session trial (not anchored to disk)" instead of the configuration just applied. Root cause: GET /api/config/content returned content: "" for any session-trial config because /load-content (the Apply path) parsed the YAML into state and discarded the raw text.

Fix

  • ServerState gains trial_content: str | None — the stored raw YAML of the current trial, cleared by every disk-anchoring path (_apply_config_from_disk, /reload), since a trial belongs to no real file.
  • /load-content stores the payload verbatim; /content echoes it with session_trial=True and config_path=None. Response contract shape unchanged — only the previously-empty content becomes meaningful.
  • /save, /save-as, /load, /create, /reload behavior untouched (trial text dropped when the session anchors to disk).

TDD evidence

  • RED: reopened-editor contract test failed with '' != 'defaults:…' — the missing behavior, watched before implementation.
  • GREEN: uv run pytest tests/server/routes/test_config_editor.py → 24 passed.
  • Full suite: 69 failures exist identically on the base branch (pre-existing tests/test_app.py / tests/web/test_build.py / suffix-parity debt); failure sets diff as identical, so this change adds zero new failures.
  • ruff format --check ✓ · ruff check ✓ · pylint 10.00/10 on both touched modules · pre-commit hooks passed.

Notes for reviewers

  • Client-side needs no change: the modal already renders whatever /content returns; the load-on-open path is covered by existing vitest (open/load cases).
  • The filename for a trial remains the config display name ("Dropped"), per the pre-existing pinning test.

…tent

GET /content returned an empty body for session-trial configs, so an
editor reopened after Apply showed an empty document instead of the
in-memory configuration the user had just applied (issue #97). The
server parsed /load-content payloads into state and discarded the raw
YAML -- there was nothing to echo back.

- ServerState gains trial_content: the stored raw text of the current
  trial; cleared by every disk-anchoring path (_apply_config_from_disk,
  /reload) since a trial belongs to no real file.
- /load-content stores the payload verbatim; /content echoes it with
  session_trial=True and config_path=None (contract shape unchanged).
- The pre-existing drop-pinning test now also pins the echoed text, and
  a new test pins the disk-anchor clearing.

Closes #97
@falbany
falbany merged commit f922b37 into feat/yaml-config-editor Nov 4, 2026
1 check passed
@falbany
falbany deleted the fix/editor-session-trial-content branch November 4, 2026 11:41
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.

1 participant