From 20000adfbf3fe33ec4c6c6fd859dc9e8725bef5c Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 9 Nov 2026 15:40:53 +0000 Subject: [PATCH] Hand over Word Companion chapter synchronisation to Atlas --- ...026-11-09-discovery-sync-atlas-handover.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Docs/WordCompanion/WindowsHandover/2026-11-09-discovery-sync-atlas-handover.md diff --git a/Docs/WordCompanion/WindowsHandover/2026-11-09-discovery-sync-atlas-handover.md b/Docs/WordCompanion/WindowsHandover/2026-11-09-discovery-sync-atlas-handover.md new file mode 100644 index 00000000..b210a808 --- /dev/null +++ b/Docs/WordCompanion/WindowsHandover/2026-11-09-discovery-sync-atlas-handover.md @@ -0,0 +1,27 @@ +# Discovery Word Companion handover to Atlas + +Source baseline: `302bf257331b3e54de17ea293c3d4a34723fd8d5` on `codex/word-companion-native-phase1-20261104`. The working tree was clean before this handover. All implementation work was already committed. + +- `025765e8` presents chapter progress and actions in the ribbon. +- `7c6e9057` captures live Word paragraph IDs and spans. Range XML on this Word build omitted the IDs. The live IDs matched document-level XML on the disposable benchmark. +- `5e5edfce` bounds retries, avoids preemption on a stationary cursor, and surfaces review reasons. +- `302bf257` projects explicit page breaks to the measured Word form feed and retains exact text and span checks. + +## What was verified + +The installed and running tray was verified as **1.0.0.26** at handover. Its Word add-in was installed and authenticated to Development. The 1.0.0.25 rollback briefly restored the local Word-to-tray connection, but Development did not see an eligible Word session at that point. The original and qualification DOCX matched the pre-test backup byte for byte and still carried their saved association to book **10152** at the time of that check. + +On 1.0.0.25, the author reported seeing **21 of 48 accepted**. Historical local logs confirm reads and transfers, but do not independently confirm those server commits. The ribbon's **Checking chapter N of 48** reports scheduled attempts, including retries. Server accepted mappings for a live Word session and persisted evidence checkpoints are separate measures. + +On 1.0.0.26, the real Word probe validated exact local evidence for **47 of 48** chapters after the page-break fix. The final range (838510–845456) contains inline and anchored pictures. An experimental picture projection still disagreed with live paragraph spans and was discarded before packaging. The Windows build and installer checks passed. Local validation does not prove server acceptance. + +For the last authenticated live repair, Development identified the original Discovery filename and the active local session was `11d7e651-4aa4-4b80-8e88-d2dd341e7d91`. The repair entered Checking and the log recorded three chapter transfers between 15:31 and 15:34 on 9 November. A fresh Development page then reported **Needs review · 0/48 accepted for that session**, and the persisted checkpoint panel showed **No chapter checkpoints have been adopted yet**. The generic server status did not identify the chapter or precise rejection. The roughly 42-second gaps between transfers and the agent's 15-second HTTP deadline are consistent with retries after a timeout, but this is unconfirmed. The fresh failure occurred after authentication and transmission. Writing Context following and fast reopening were not verified. + +## Acceptance path + +1. `Vsto/WordChapterRead.cs` runs the staged Word STA reader. It posts `chapter-begin`, offset-ordered `chapter-chunk` frames for text, XML and IDs, then `chapter-end`. The ID payload has eight hex digits for each native ID followed by eight hex digits for its UTF-16 span. `Protocol/Manuscript/ChapterFingerprint.cs` checks exact text, spans, outline and identity evidence. +2. `Agent/SessionManager.cs` validates the negotiated frames. `Agent/TrayCoordinator.Chapters.cs` schedules reads, assembles evidence, finds the manifest chapter, and submits `ChapterObservation` with request and operation IDs, manuscript, instance, session, Word and base revisions, range, content and identity hashes, and paragraph evidence. `CloudGateway.cs` sends the authenticated HTTP requests. +3. `PlotLine/Controllers/NativePresenceController.cs` records the live lease and delivers queued commands through `NativePresenceStore`. `NativeChapterSyncController.cs` uses desktop pairing authentication at `api/native-companion/books/{book}/chapter-sync`. GET returns the manifest for the requested session and Word revision. POST `repair` queues an operation scoped to the selected live session and grant. POST `validate` submits chapter evidence. POST `finish` confirms server acceptance. +4. `ChapterSyncService.cs` checks the grant, exact live saved lease, manuscript identity, revision and repair authority. `ChapterCheckpointEngine.cs` verifies content and paragraph evidence. `ChapterSyncRepository.cs` uses `dbo.BookChapterSync` to commit checkpoints and positions and to resolve the live chapter and scene for Context. Validation requires independently accepted positions for the current session and revision. + +Qualification logs are local under `%LOCALAPPDATA%\PlotDirector\Companion\agent.jsonl`. Development project restore point **13** was listed before the earlier repair. The verified Word backup is `C:\Temp\PlotDirectorQualification-1.0.0.25\Discovery-before-qualification.docx`. The portable book export exceeded its size limit. This handover made no application or database changes.