PlotDirector/Docs/WordCompanion/WindowsHandover/2026-11-07-UI-Redesign.md

9.8 KiB

Companion 1.0.0.15 — Windows handover

Application commit: 5472e98b8f. Later handover-only commits do not change this application source. Shared branch: codex/word-companion-native-phase1-20261104.

Delivered source

The existing WinForms tray agent now has a compact light/dark interface: branding/version, separate verified PlotDirector and Word status, account, manuscript selection, project/book details, in-memory book cover, Open PlotDirector and Settings. Switching active Word documents changes the displayed manuscript; another open document can also be selected explicitly. Changing a book uses one association dialog, with optional, confirmed Word metadata persistence. There is no separate analyser or manuscript upload action in the window.

Settings contains account/server controls and a persistent Advanced mode, off by default. Advanced exposes connection checks, log-folder access, session diagnostics, identifier inspection, marker removal, association reset and confirmed clean/unlink. Sign-in uses the existing browser flow; pending approval and automatic renewal do not offer duplicate sign-in buttons. Window close hides; tray reopen reuses the same window; explicit Exit stops the process without revoking trust.

Changed components:

  • PlotDirector.NativeCompanion/Agent/TrayApplication.cs, CompanionSurfaces.cs, CompanionPresentation.cs: UI, theme, status, actions and asynchronous cover handling.
  • Agent/CompanionStateStore.cs, CloudGateway.Authorization.cs: Advanced preference and scoped association removal. Qualified DPAPI/renewal implementation retained.
  • Agent/CloudGateway.cs: optional cancellation on the existing authenticated GET transport; obsolete cover requests cancel without changing connection health.
  • Protocol/DocumentMaintenancePolicy.cs, Messages.cs, AiContracts.cs, Client/AgentLink.cs, Agent/PipeHost.cs, TrayCoordinator.cs: additive maintenance negotiation, exact-session commands, correlated acknowledgements, project/book metadata and cover DTO.
  • Vsto/WordAdapter.cs: maintenance on the existing measured STA scheduler, one marker per scheduler turn; no retained collection RCWs between batches, no automatic save, no prose assignment. Content controls use Interop Delete(false); bookmarks use Delete().
  • PlotLine/Controllers/NativeCompanionController.cs: additive book names and authenticated /api/native-companion/books/{id}/cover. Ownership checked before resolving the existing thumbnail; bounded PNG conversion supports Windows image decoding of stored WebP covers. No duplicate cover files created.

Cleanup owns only PD-CHAPTER- / PD-SCENE- content-control tags, _PD_CHAPTER_ / _PD_SCENE_ bookmarks and the five explicitly listed native custom properties. It deliberately does not edit arbitrary custom XML or legacy Office.js private settings. Unrelated metadata is left alone. Protected/locked objects or a changed/closed document stop maintenance; partial metadata removal can occur and is reported, so inspect before retrying. Resetting an association does not remove structural markers; clean/unlink does both. Local unlink is confirmed only after a matching Word acknowledgement. This is not a transactional Word undo operation.

Atlas evidence

  • dotnet build PlotLine.slnx --no-restore --disable-build-servers -m:1 /p:UseSharedCompilation=false: success, zero warnings/errors; includes net10.0-windows managed WinForms target, excludes VSTO host.
  • Native executable regression harness: 257 checks passed. Covers preferences/restart, authorisation states, ownership policy, capability negotiation, document routing, failed cleanup and acknowledgement-gated unlink, plus existing IPC/recovery/import tests.
  • Application executable harness: 416 checks passed.
  • --native-companion-http: passed real loopback HTTP authentication, foreign-book cover rejection before file lookup, bounded PNG response and existing AI/import/security regressions.
  • --native-tray and --native-installation: passed.
  • One initial native run hit a transient Linux broken-pipe failure at the pre-existing sequential handshake test; three subsequent full native runs passed (254, 256 after additional status tests, then 257 after the live-identity reset regression). No Windows pipe/ACL claim follows from these Linux tests.

No Windows build, signing, packaging, installer execution, desktop automation or Word execution occurred on Atlas. No schema migration or new configuration setting is required. Development now serves the new cover API and project/book names. Deployment used web application commit 57c6bd5ca5f3d20c1e80fca9835b61b7fdd47f2c; the later native-only fix does not change the web payload.

  • Release: /srv/apps/plotdirector-dev/releases/57c6bd5-20261107T151928Z.
  • Preserved previous deployment: /srv/apps/plotdirector-dev/current-before-57c6bd5-20261107T151928Z.
  • Published/deployed PlotLine.dll SHA-256: a9c3f844e2796e99f02db07ed42197bc2ccc9a60becc567c0d63498cc88786c6.
  • Read-only active-work guard passed before restart; service active, local/public root GET 200, unauthenticated public cover GET 401; no recent warning entries. Authorised image retrieval was tested through the real loopback API with synthetic authentication/data, not a real author's live cover. No Production changes.

Windows Codex instructions

  1. Preserve the current worktree; discover its configured tracking remote. Fetch and fast-forward this same branch, stopping on divergence. Verify git merge-base --is-ancestor 5472e98b8fbc4dbe5829f3b71051e3194a163bdb HEAD. Do not switch branches, rebase or discard local work.

  2. Preserve the qualified installed 1.0.0.14, its original signed installer and its protected user settings. The baseline evidence is PlotDirector.NativeCompanion/WindowsValidation/Setup/Qualification-2026-11-07-v1.0.0.14.md. Do not clear %LOCALAPPDATA%\PlotDirector\Companion or force a new authorisation.

  3. Build the Atlas-managed UI as delivered. Correct only proven Windows-specific compilation/runtime defects. Compile the updated VSTO host and verify the new document-maintenance-v1 capability; an old host must refuse maintenance without breaking connection/import. Commit any fixes to the shared branch.

  4. Application source is 1.0.0.15; Setup/Release.json deliberately remains the qualified 1.0.0.14 baseline. Prepare the existing unified installer for 15 on Windows: align application/MSI versions, allocate a new ProductCode, retain the UpgradeCode and qualify the 14-to-15 upgrade using the existing scripts. Record the exact clean source SHA before building. Do not introduce another installer or substitute a .vsto file.

  5. Use the existing commands from the repository root, with real local values:

    .\PlotDirector.NativeCompanion\WindowsValidation\Update-WordCompanion.ps1
    # For a clean, committed local Windows qualification fix not pushed yet: use -NoSync.
    .\PlotDirector.NativeCompanion\WindowsValidation\Setup\Build-Setup.ps1 `
      -PackagePath '<validated directory printed by Update-WordCompanion>' `
      -ExpectedSourceCommit '<exact clean build SHA>' `
      -OutputDirectory '<new output directory>' `
      -CertificateThumbprint '<existing signing certificate>'
    .\PlotDirector.NativeCompanion\WindowsValidation\Setup\Test-SetupPackage.ps1 `
      -PackagePath '<same validated package>' -SetupDirectory '<setup output>' `
      -BaselineMsi '<preserved version14 MSI>' -ReportPath '<new report JSON>'
    

    Update prepares %USERPROFILE%\Downloads\PlotDirectorWordCompanion\1.0.0.15-<SHA8> using the supported Downloads-folder resolver; it does not install. Setup produces PlotDirectorCompanionSetup.exe, the MSI and evidence in the supplied output directory. Use actual paths printed by the scripts rather than guessing the installed/profile location. Preserve all existing prerequisite/trust gates.

  6. Run portable tests and the existing package/upgrade checks. Do not launch Word, control the desktop, close applications or install unattended. Distinguish the effective Codex identity/private registry from the normal interactive Windows profile. Registration is not proof that Word loaded the add-in.

  7. Push validated Windows fixes and report their SHA, signed unified installer path/hash and the remaining manual checks. Do not redesign the managed UI or authentication again.

Human acceptance (scheduled Windows session)

  • Install the unified version15 installer, with Word closed by you. Verify settings/book associations and approved sign-in survive the version14 upgrade; no repeated browser approval on normal restart.
  • Check light/dark, 100/150/200% scaling, keyboard focus, smallest window, long filenames/titles and resizing. Check covers for two different books and a book with no cover; rapid book/account switching must never leave another book's image.
  • Confirm separate Word/server states, recovery after network loss and agent restart, close-to-tray, repeated reopen and explicit Exit/restart. Check Settings can be closed/reopened repeatedly and Advanced remains off until enabled, then persists.
  • With disposable saved document copies only, inspect IDs; remove PD markers; reset association; clean/unlink. Include nested controls, unrelated bookmarks/custom properties, formatting, read-only/protected documents and multiple open books. Compare exact prose, formatting and unrelated metadata before/after. Cancel every confirmation once. Verify interrupted cleanup is reported, not claimed complete; saving remains under your control.
  • Check the existing website import wizard still requests Word content only explicitly. Merely opening Companion, inspecting identifiers, changing books or reconnecting must not upload prose.
  • Native appearance, focus behaviour, COM cleanup safety, scaling and actual Word responsiveness remain unverified until these Windows tests run. Do not qualify this build for general distribution on compilation alone.