prometeu-studio/discussion/workflow/plans/PLN-0018-migrate-code-editor-to-prometeu-vfs.md
2026-03-31 08:00:10 +01:00

169 lines
7.1 KiB
Markdown

---
id: PLN-0018
ticket: studio-editor-document-vfs-boundary
title: Migrate the Code Editor workspace to consume `prometeu-vfs`
status: review
created: 2026-03-31
completed:
tags:
- studio
- editor
- vfs
- migration
- tests
---
## Briefing
Replace direct editor-local filesystem services with `prometeu-vfs` while preserving current read-only behavior, current unsupported-file UX, and current session-local open-tab behavior.
## Objective
Make the Code Editor workspace consume the project-session-owned `prometeu-vfs` for tree and document access without changing the visible behavior of the current editor wave.
## Background
The editor currently wires `EditorProjectSnapshotService` and `EditorFileBufferLoader` directly into `EditorWorkspace`. DEC-0009 requires those concerns to move behind `prometeu-vfs`, while the editor remains owner of layout, visual tree state, open-tab presentation, and error presentation.
## Dependencies
- DEC-0009 accepted and normatively locked
- PLN-0016 accepted or otherwise completed enough to provide the new module contract
- PLN-0017 accepted or otherwise completed enough to provide project-session ownership
## Scope
### Included
- update `EditorWorkspace` to consume `prometeu-vfs` instead of direct filesystem services
- preserve existing `EditorOpenFileSession` ownership for session-local tab state
- preserve the existing unsupported-file modal behavior while moving support determination into `prometeu-vfs`
- remove or retire editor-local filesystem services whose ownership moved into `prometeu-vfs`
- adjust tests accordingly
### Excluded
- write support
- dirty tracking
- watchers
- public event API exposure
- visual redesign of the editor
## Non-Goals
- replace `EditorOpenFileSession`
- introduce outline semantics or helper-region behavior
- change the supported-file UX from modal to another surface
## Execution Method
### Step 1 - Rewire Editor Construction Around `prometeu-vfs`
**What:**
Inject the project-session-owned `prometeu-vfs` dependency into the editor workspace and route tree/document actions through it.
**How:**
Update shell/editor construction so `EditorWorkspace` receives the `prometeu-vfs` consumer dependency it needs and uses it for:
- navigator refresh
- file open
- support resolution
while keeping `EditorOpenFileSession` as the owner of open-tab presentation state.
**File(s):**
- `prometeu-studio/src/main/java/p/studio/window/MainView.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorWorkspace.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorOpenFileSession.java`
### Step 2 - Remove Direct Filesystem Ownership from the Editor
**What:**
Stop the editor package from owning project-tree and document-loading filesystem code.
**How:**
Delete, deprecate, or reduce editor-local classes once their behavior lives in `prometeu-vfs`, ensuring no direct filesystem responsibility remains in the editor workspace boundary for those concerns.
**File(s):**
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorProjectSnapshotService.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorFileBufferLoader.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorProjectSnapshot.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorProjectNode.java`
### Step 3 - Preserve Visual Ownership in the Navigator and Status Surfaces
**What:**
Keep the Studio UI responsible for presentation and view-model concerns after the data-source migration.
**How:**
Update navigator/status consumers to derive their presentation state from `prometeu-vfs` structural data without moving visual state into the module boundary.
**File(s):**
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorProjectNavigatorPanel.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorStatusBar.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorWorkspaceIcons.java`
### Step 4 - Rebalance the Test Suite Around the New Ownership Boundary
**What:**
Keep editor tests focused on editor-owned behavior after tree/document ownership moves to `prometeu-vfs`.
**How:**
- keep `EditorOpenFileSessionTest` for tab/session behavior
- move filesystem behavior tests to `prometeu-vfs`
- add editor-facing tests where necessary for VFS integration, unsupported-file modal routing, and refresh wiring
**File(s):**
- `prometeu-studio/src/test/java/p/studio/workspaces/editor/EditorOpenFileSessionTest.java`
- `prometeu-studio/src/test/java/p/studio/workspaces/editor/EditorProjectSnapshotServiceTest.java`
- `prometeu-studio/src/test/java/p/studio/workspaces/editor/EditorFileBufferLoaderTest.java`
- new `prometeu-studio/src/test/java/p/studio/workspaces/editor/**`
## Test Requirements
### Unit Tests
- editor session/tab behavior remains covered
- unsupported-file modal routing remains covered if testable at this layer
- no editor-local tree/document filesystem tests remain after migration
### Integration Tests
- editor workspace integration test using a project-session-owned `prometeu-vfs` dependency
### Manual Verification
- open a project and confirm the navigator still shows the whole project
- use manual refresh and confirm the editor tree updates through `prometeu-vfs`
- open supported text files and confirm content still appears read-only
- open unsupported files and confirm the existing modal behavior remains intact
## Acceptance Criteria
- [ ] `EditorWorkspace` no longer instantiates direct filesystem tree/document loaders
- [ ] current read-only editor behavior remains unchanged from the user perspective
- [ ] unsupported-file handling still appears through Studio UI while support classification lives in `prometeu-vfs`
- [ ] editor tests now cover editor-owned behavior rather than filesystem ownership that moved to `prometeu-vfs`
## Affected Artifacts
- `prometeu-studio/src/main/java/p/studio/window/MainView.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorWorkspace.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorProjectSnapshotService.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorFileBufferLoader.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorProjectSnapshot.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorProjectNode.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorProjectNavigatorPanel.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/editor/EditorStatusBar.java`
- `prometeu-studio/src/test/java/p/studio/workspaces/editor/EditorOpenFileSessionTest.java`
- `prometeu-studio/src/test/java/p/studio/workspaces/editor/EditorProjectSnapshotServiceTest.java`
- `prometeu-studio/src/test/java/p/studio/workspaces/editor/EditorFileBufferLoaderTest.java`
- new `prometeu-studio/src/test/java/p/studio/workspaces/editor/**`
## Risks
- a shallow adapter-only migration could leave hidden direct filesystem access in the editor package
- moving too much presentation logic into `prometeu-vfs` would violate DEC-0009
- changing unsupported-file UX during the migration would exceed the first-wave scope