Bring decisions and comments into the plan #36
- MA
## Summary
This reworks Chopin around one collaborative plan with two views: the full plan, where decisions and comments live beside the prose they affect, and a focused Decisions view for working through unanswered questions in isolation.
The conversation stays in a narrower left rail. The previous right-hand decisions rail is removed so the document can use the rest of the workspace.
## What changed
### Inline and focused decisions
- Render questionnaire decisions as full cards inside the plan instead of zero-height anchors or a separate right rail. - Split new batched questions into independently answerable cards while retaining the old tabbed renderer for existing multi-question records. - Add a personal Plan/Decisions switch above the document. The focused view projects the same canonical questionnaire records rather than creating copies. - Show the unanswered count on the Decisions control, quietly emphasise newly added questions, and focus the first unanswered card when the view opens. - Preserve plan scroll position, selection, collaborative editor state, undo history, and presence while switching views. - Keep resolved questionnaires under a collapsed history disclosure and let each card return to its exact inline position with “Show in plan”.
### Decisions-first planning flow
- Open questionnaire-only rooms directly in Decisions while the planner waits for genuinely blocking answers. - Move to Plan once when the first prose appears; later questions never steal focus, change the reader’s view, or move their caret. - Teach the planner to ask questions with the plan revision and the related prose block addresses. - Validate every placement before creating records or mutating the document, then insert each decision beside its related prose in stable ask order. - Broadcast new anchor relationships immediately so already-connected clients can highlight and navigate without reconnecting. - Support the explicit empty-room path for blocking questions asked before prose exists.
### Document-anchored comments
- Move open comment threads out of the right rail and onto the document as passage highlights with Phosphor comment controls in the gutter. - Show a lightweight preview on hover or keyboard focus and pin the full thread card on click. - Preserve native text selection, including wrapped passages, while the overlay remains pointer-transparent outside its controls. - Keep comments reachable when exact text drifts, and expose a small orphan fallback only when no subject block survives. - Remove comment chrome after resolution; accepted threads remain durable inline `<Decision>` records with quote, discussion, and provenance.
### Planner activity and chat polish
- Show a petrol-green Planner row with shimmering “Working on it” text while a turn is active, replacing it with the real response when prose arrives. - Keep the working row through tool activity and clear it correctly on response, stop, failure, reconnect, and history replacement. - Tolerate older active-turn wire frames during rolling deployments. - Remove the redundant “questions are waiting” chat row. - Make tool activity clearer and expose failed tool calls rather than leaving malformed or endlessly spinning status chrome.
### Interface and maintainability
- Default the conversation rail to 280px with a 240–400px range and give the document the remaining workspace. - Standardise interface icons on Phosphor and add a design-system guard against literal emoji or hand-authored SVG icons in product TSX. - Extract questionnaire placement mutations into a focused plan module, bringing the central room module back below 1,000 lines. - Remove dead placement data and shorten implementation comments while retaining explanations for collaborative-state and browser failure modes.
## Compatibility and safety
- The plan remains the canonical collaborative MDX document; the focused Decisions view is only a projection. - Existing split subject/result decision anchors are folded into the new single-placement shape when read, preserving old rooms. - Existing multi-question questionnaires retain their compatibility renderer; only new asks are split into separate records and nodes. - Accepted-comment decisions and questionnaire answers remain immutable record-owned projections rather than editable prose. - `PlanEditor` stays mounted in both views, so switching views does not rebuild Yjs or Lexical state.
## Verification
- `bun test` — 652 passing - `bun run e2e` — 76 passing - `bun run types` — passing - `bun run ci` — passing with no warnings or errors - `bun run build` — passing - `git diff --check` — passing
The final branch also received an independent thermo-nuclear maintainability review before this PR was opened.
MaggieAppletonmerged 8b55e9d7f5843 months ago on GitHub
MaggieAppletonhead-ref-deleted3 months ago on GitHub