prometeu-studio/discussion/workflow/plans/PLN-0021-integrate-dec-0010-editor-write-ui-and-workflow.md
2026-03-31 16:51:35 +01:00

137 lines
4.2 KiB
Markdown

---
id: PLN-0021
ticket: studio-editor-write-wave-supported-non-frontend-files
title: Integrate DEC-0010 editor write UI and workflow in Studio
status: done
created: 2026-03-31
completed: 2026-03-31
tags: [studio, editor, ui, save, read-only, write-wave]
---
## Objective
Make the Studio editor consume the DEC-0010 VFS write contract and expose the intended UI workflow for editable non-frontend documents and hard frontend `read-only` documents.
## Background
Once VFS access policy and save behavior exist, the editor still needs to:
- stop being globally read-only,
- surface mixed editable and frontend hard `read-only` tabs correctly,
- expose editor-local save commands,
- and keep frontend warnings/status consistent with the decision.
## Scope
### Included
- wire editor UI to new VFS access policy and save commands
- add editor-local `Save` and `Save All` command bar
- keep frontend docs hard `read-only`
- show frontend top warning and status-bar state
- update editor tests
### Excluded
- LSP integration
- frontend editing
- shell-global menu save behavior beyond remaining unused for this flow
## Execution Steps
### Step 1 - Rewire Editor Session State Around Access Policy
**What:**
Make the editor session aware of document access mode and save capability.
**How:**
Update open-file/session models so they track:
- document access mode,
- save eligibility,
- frontend hard `read-only` state,
- and editor-local command enablement.
**File(s):**
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorOpenFileBuffer.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorOpenFileSession.java`
### Step 2 - Add the Editor Command Bar and Save Flow
**What:**
Expose the write commands in the editor itself.
**How:**
Add a top command bar or equivalent editor-local surface with `Save` and `Save All`, wired to VFS save operations for editable non-frontend docs only.
**File(s):**
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorWorkspace.java`
- new `prometeu-studio/src/main/java/p/studio/workspaces/editor/**` command-bar surface as needed
- `prometeu-studio/src/main/resources/themes/default-prometeu.css`
### Step 3 - Enforce Hard Frontend Read-Only in the Editor UX
**What:**
Make frontend files visibly hard `read-only`.
**How:**
Ensure FE files:
- cannot be mutated in the editor UI,
- show `read-only` in the status bar,
- show the required top warning,
- and can coexist with editable non-frontend tabs without ambiguity.
**File(s):**
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorWorkspace.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorStatusBar.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorTabStrip.java`
### Step 4 - Update Editor Tests
**What:**
Keep editor tests focused on editor-owned behavior under the new mixed access-mode workflow.
**How:**
Add or adjust tests for:
- editable non-frontend save command routing,
- FE hard `read-only` UI state,
- mixed tab behavior,
- command enablement.
**File(s):**
- `prometeu-studio/src/test/java/p/studio/workspaces/editor/**`
## Test Requirements
### Unit Tests
- mixed access-mode tab/session behavior
- save command enablement
- FE hard `read-only` presentation state
### Integration Tests
- editor workspace integration against a VFS test double exposing editable and hard `read-only` docs
### Manual Verification
- open editable `json`/`bash`/`text` docs and confirm save works
- open FE docs and confirm they cannot be edited
- confirm FE warning and status-bar state are visible
## Acceptance Criteria
- [ ] editor consumes VFS access policy instead of local editability inference
- [ ] `Save` and `Save All` live in the editor UI
- [ ] FE docs are hard `read-only` in actual editor interaction
- [ ] mixed editable and FE `read-only` tabs behave coherently
- [ ] editor tests cover the new workflow
## Dependencies
- DEC-0010 accepted
- PLN-0020 review completed or otherwise stable enough for UI integration
## Risks
- UI may accidentally permit FE mutation if command enablement and editor mutability diverge
- save flow could become split-brained if some callsites bypass editor-local commands
- warning/status surfaces may drift if they are implemented independently