You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(editor): GET /api/config/content returns empty text for a live session-trial config #97
Follow-up to the YAML config editor (#95), identified in the post-implementation review (brainstorm 2026-11-04).
Problem
Edit the file in the Config Editor → click Apply → close the modal → reopen it (StatusBar "Config"). The editor shows an empty document with the header note "session trial (not anchored to disk)" instead of the live in-memory configuration that was just applied.
Root cause
GET /api/config/content (src/profiles/server/routes/config.py:362-380) answers content: "" + session_trial: true whenever has_disk_path(state) is false. Configs applied via POST /load-content (the editor's Apply action, and dropped .profiles files) swap state.config but the raw YAML text is discarded during parsing — there is nothing to echo back to a reopened editor.
Proposed solution
Add a field to ServerState (src/profiles/server/state.py): trial_content: str | None = None.
In /load-content (src/profiles/server/routes/config.py): store state.trial_content = payload.content alongside state.config = loaded.
In the session-trial branch of /content: return {"filename": ..., "content": state.trial_content or "", "config_path": None, "session_trial": True} instead of the empty content.
Clear state.trial_content = None on every disk anchoring path: _apply_config_from_disk (covers /load, /save, /save-as, /create) and /reload — a recorded disk anchor invalidates the trial text.
Acceptance criteria
Editor reopened after Apply shows the exact applied text; header still reads "session trial (not anchored to disk)".
After /save, /save-as, /load, /create or /reload, /content returns the disk file content with session_trial: false.
A recorded-but-missing file still answers 404 (unchanged).
No state change on GET /content (read-only remains read-only).
Tests
tests/server/routes/test_config_editor.py:
apply content via /load-content → GET /content returns the same text, session_trial=True, config_path=None;
then /load a disk config → /content returns the file text, trial content cleared;
update the existing "empty body for session trial" assertion accordingly.
Vitest (src/profiles/web/src/components/ConfigEditorModal.test.tsx): modal reopened after a mocked Apply shows the applied text, not an empty document.
Activity
Merge pull request #106 from falbany/fix/editor-session-trial-content
Merge pull request #110 from falbany/feat/yaml-config-editor