F8: out-of-workspace authoring — hybrid sidecar persistence (#25) #26

Merged
benstull merged 8 commits from f8-out-of-workspace into main 2026-06-11 20:18:55 +00:00
3 changed files with 1413 additions and 0 deletions
Showing only changes of commit bfd951552c - Show all commits
+27
View File
@@ -196,6 +196,33 @@ the manual smoke, not the sealed-sandbox E2E.
Design: `vscode-cowriting-plugin-content/specs/coauthoring-rendered-preview.md`. Design: `vscode-cowriting-plugin-content/specs/coauthoring-rendered-preview.md`.
Live smoke: [`docs/MANUAL-SMOKE-F7.md`](docs/MANUAL-SMOKE-F7.md). Live smoke: [`docs/MANUAL-SMOKE-F7.md`](docs/MANUAL-SMOKE-F7.md).
## F8 — Out-of-workspace authoring (Feature #25)
"Ask Claude to Edit Selection" (and F2 threads / F3 attribution / F4
propose-accept) now work on **any** document the editor shows — saved in the
workspace folder, saved outside it, or untitled — matching the already-universal
F6 diff and F7 preview. Authoring is no longer gated to in-workspace files, and
the commands are live even with **no folder open**.
Persistence is **hybrid** (one `SidecarStore` abstraction, routed per-document):
- an **in-workspace** file keeps its committable `.threads/<repo-rel>.json`
sidecar, **byte-for-byte unchanged** (INV-2) — the only home the F5 cross-rung
contract ever sees;
- an **out-of-workspace** file or **untitled** buffer stores its coauthoring
artifact in VS Code **global storage** keyed by `sha256(uri)` (the same home
and key F6's baseline uses, INV-19/24); untitled buffers are **in-memory
only** (lost on reload/save).
A global-storage artifact is **not a committed file**, so it is **never
cross-rung-shareable** (INV-25), and renaming/moving the file **orphans** its
artifact (the key is the URI hash) — both stated as design contract, not
discovered later. Routing leaves the in-workspace path untouched, so rollback is
a plain PR revert with zero data migration.
Design: `vscode-cowriting-plugin-content/specs/coauthoring-out-of-workspace.md`.
Live smoke: [`docs/MANUAL-SMOKE-F8.md`](docs/MANUAL-SMOKE-F8.md).
## Develop ## Develop
- `npm run watch` — rebuild on change. - `npm run watch` — rebuild on change.
+45
View File
@@ -0,0 +1,45 @@
# Manual smoke — F8 out-of-workspace authoring
Confirms "Ask Claude to Edit Selection" (+ threads / attribution) work on a file
**outside** the workspace folder and on an **untitled** buffer, while in-workspace
authoring is unchanged. One live turn hits the SDK (the only LLM step).
Spec: `vscode-cowriting-plugin-content/specs/coauthoring-out-of-workspace.md`.
## Prereqs
- Build: `npm run build`.
- Launch the Extension Development Host (F5 in VS Code) with this repo's `sandbox/`
opened as the workspace folder.
## A. Out-of-folder file (PUC-1)
1. Open a markdown file from a DIFFERENT directory (outside `sandbox/`) — e.g. a
sibling repo, or `File > Open` a scratch file under `/tmp`.
2. Select a sentence → Command Palette → **Cowriting: Ask Claude to Edit Selection**
→ type an instruction → wait for the proposal (amber range + ✓/✗).
3. Accept (✓). Expect: the text is replaced and shows the Claude attribution tint.
4. Add a coauthoring thread on a selection (**Add Coauthoring Thread on Selection**).
5. Close and reopen the file (or revert). Expect: the thread + attribution are
restored. There is **no** `.threads/` folder beside the file — its state lives
in VS Code global storage (`<globalStorage>/sidecars/<hash>.json`).
## B. Untitled buffer (PUC-2)
1. `File > New File` (don't save) → type a few sentences.
2. Select → **Ask Claude to Edit Selection** → instruct → accept. Expect: it works
exactly like A, in-session.
3. Reload the window (Developer: Reload Window). Expect: the untitled buffer's
coauthoring state is **gone** (in-memory only — documented limitation, §6.7).
## C. In-workspace unchanged (PUC-3)
1. Open a file UNDER `sandbox/`. Repeat the propose→accept→thread loop.
2. Expect: a committable `sandbox/.threads/<path>.json` sidecar is written, exactly
as before F8 (byte-for-byte, INV-2).
## D. Read-only view declines (PUC-5)
1. Open a Git diff / Output view, select text, run **Ask Claude to Edit Selection**.
2. Expect: a warning that this kind of document can't be edited (not "select some
text").
## E. Folder-less (optional)
1. Launch the EDH with **no folder** open. Open an untitled buffer or `File > Open`
any file. Repeat A/B. Expect: authoring works (every doc routes to global
storage); the commands are not stubbed.
File diff suppressed because it is too large Load Diff