refactor(word-addin): move the apply-mode control into the composer as a Review switch

↗ view on GitHub · Amal · 2026-08-16 · 673ab898

WHY THIS MATTERS
Review feedback, twice over: (1) the choice of whether an edit applies
directly or waits for approval belongs where the request is written - in
the chat input, next to Send, exactly like the model picker - because the
setting governs what the NEXT send does; (2) a mode with one safe default
and one opt-out reads better as a single labeled switch than as two
segmented buttons. "Review" ON is the approval flow; switching it off
applies edits directly.

HOW IT WORKS
The composer's action row gains the shared ToggleSwitch (the web app's
switch styling) labeled "Review": checked maps to the approval mode,
unchecked to direct apply. The preference itself is unchanged - the same
mike_word_edit_apply_mode key in OfficeRuntime.storage, default approval -
so existing users keep their stored choice. App threads the mode and its
setter through ChatPanel/ChatView into ChatInput; FloatingHeader loses
the control entirely. ChatView also gains the identity-stable
handleLocateCitation callback that routes citation-chip clicks (from the
citations feature) to selectDocumentText without re-rendering memoized
message rows.

The long-standing "no switches" guard in chat.spec.ts asserted that
document context and change tracking expose no opt-out switches; the
Review toggle is a deliberate exception (it governs how edits resolve,
never whether the document is sent or tracked), so the guard now asserts
exactly one switch exists and that it is the Review control. The
apply-mode specs assert switch semantics (aria-checked) in the composer
and that the header renders nothing. Their prompts also switch to the
current "How can I help?" composer placeholder: they were authored
against the pre-rebase placeholder and, piped through `tail`, their
failures were masked by the pipeline's exit code - the suite now runs
with the exit code captured explicitly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository open-legal-products/mike
Author Amal <mamalanand3@gmail.com>
Authored
Committed
Parents 1ff94349
Stats 7 files changed , +77 , -61
Part of Make Word edit approval reliable across hosts

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-673ab898.md from inside the repo you want the change in.

⬇ Download capture-commit-673ab898.md