83 lines
12 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Current **1.0.0.10 tray architecture**: use [Tray-Companion.md](Tray-Companion.md). It supersedes the native-dialog qualification below while retaining the same Update/Install scripts and measurement harness.
Current developer version **1.0.0.6**: [Phase 3.5 integration checklist](Phase35-Integration.md). The original Phase 1 qualification below is historical; use the current checklist for implemented authentication, AI and saved workspace behaviour.
For current Phase 3 development, use [Phase3-AI.md](Phase3-AI.md). It provides a same-user, command-line update/build and explicit reversible per-user install workflow. A VM/separate profile, IDE launch or IDE repair is not required. The earlier disposable-profile guidance below is historical qualification advice, not a prerequisite for the authorised Phase 3 developer update.
# Windows / real Word validation gate
**Not executed on the Linux implementation host.** Passing managed tests or generating these sources does not prove VSTO compilation/loading, COM behaviour, Windows pipe ACLs or Word responsiveness. Do not install for authors or distribute until this gate is reviewed and passed.
## 1. Build prerequisites and isolated developer setup
Use a disposable Windows desktop user/profile with supported desktop Word, Visual Studio with Office/VSTO development workload, Office PIAs/VSTO Runtime, .NET Framework 4.8 developer pack and .NET 10 SDK/runtime. Record OS/Word build, Office bitness, Visual Studio/MSBuild versions, installed add-ins and CPU/RAM/storage. Test both supported Office bitnesses on separate machines if both will be supported. The add-in DLL is AnyCPU; the agent is independent win-x64 in the developer helper (qualify Windows ARM64/x86 separately).
1. Clone the exact Phase 1 commit. Build the managed `PlotLine.slnx`; run portable native tests. These do not register an add-in or connect to the server.
2. Open `NativeCompanion.Windows.sln` in Visual Studio. Confirm Office Tools resolves all Microsoft.Office.Tools and PIAs, and inspect/validate the ThisAddIn host-item/designer against a new Word VSTO template from that installed VS version. The checked-in host plumbing is source foundation, not a Linux-verified generated artifact. If regeneration is required, review its diff; do not replace adapter logic or switch to a COM shim.
3. Create/select a **local developer test signing certificate** in the Windows certificate store (never add private keys to Git). Run `Build-Developer.ps1 -CertificateThumbprint <your-test-thumbprint>` from PowerShell. It builds the VSTO project through VS MSBuild and places a framework-dependent win-x64 agent under `Vsto/bin/Debug/Agent/`. No installer/updater is created.
4. Do not sideload an unsigned/untrusted manifest by weakening machine security policy. Use normal Visual Studio F5/developer trust with the signed local test output. If manifest generation, designer activation, registration or loading fails, capture the failure and stop native acceptance; source presence is not a successful VSTO build.
5. Launch Word under the debugger with this prototype only and a new **synthetic** document. Confirm the small PlotDirector ribbon. Record VSTO load/startup time, Word thread/STA and agent PID. Never use a real author manuscript for marker writes in this phase. No Production or Development deployment is part of this procedure.
## 2. Create deterministic synthetic manuscripts
Run `Generate-Fixtures.ps1 -OutputDirectory <new-empty-directory>`. It constructs DOCX ZIP/XML without automating Word or making server calls, refuses existing filenames, and writes a manifest with GUIDs and arbitrary test project/book IDs.
- Discovery: 190,000 prose words, 60-word paragraphs.
- Reckoning: 250,000 prose words, 60-word paragraphs.
- Redemption: 250,000 prose words, ten-word paragraphs (many short/repeated paragraphs).
- Long paragraph: 250,000 words in one prose paragraph, to verify bounded range extraction.
Headings add extra words beyond those prose totals. Every document has native GUID/project/book test properties and unique PD chapter/scene tags. These IDs are local test metadata and **not server-verified**. Also prepare: a blank document, a read-only copy, a close-cancel case, a copied/Save As GUID case, nested controls, bookmark fallback markers, a document with >8 controls/bookmarks in one paragraph (must stop safely), comments, tracked changes and protected content. Preserve original ZIPs for later no-prose-change comparisons. Metadata persistence must not be confused with save confirmation.
The generator itself has not been executed with Windows PowerShell/Word on Linux. Validate OOXML opens without repair before accepting any performance result; malformed fixture generation is a fixture failure, not a Word adapter result.
## 3. Functional and security cases
| Case | Required observable result |
|---|---|
| Word startup with agent absent | Ribbon loads; no synchronous UI wait. Worker launches/contacts one agent; Word typing/scrolling remains usable. |
| Open three generated books | Three distinct live SessionIds, three persistent ManuscriptIds and correct book associations. No document reuses another session. |
| Switch repeatedly (50+ cycles) | Latest active session and positional chapter/scene correspond to the active document; repeated text cannot choose another occurrence. Agent instance/session/correlation records identify each event. |
| Second Word process (`winword /x`) | Same per-user agent; a different WordInstanceId; no old disconnect/close retires the other process's sessions. |
| Cursor movement / selection | Lightweight Range.Start/End event, latest coalesced event; completed structural snapshot resolves tags/heading positions. No full-document text match. |
| Empty/unknown location | Awaiting-structure/unresolved state, never a guessed trusted server scene ID. |
| Edit/insert/delete during extraction | Cancel/supersede obsolete snapshot; no stale revision commit. Rebuild after quiet period or manual command. Record the documented same-length-already-dirty limitation; this phase is not a complete edit journal. |
| Save during pending work | Word save proceeds immediately; handler never sets Cancel or awaits agent/network. No automatic AI or prose upload. |
| Close then cancel | Same session retained after cancelled close; no use-after-close COM calls. |
| Actual close | Exact session retired, pending snapshot released; other books continue. |
| Kill/restart agent at extraction midpoint | Word remains responsive; link reports offline; bounded work does not grow; restart reconciles open docs and starts fresh snapshot, never replays old fragments into a different document. |
| Kill one Word process | Agent retires that lease/session state; other Word process continues. Agent exits after five minutes with no peers, not while another Word process remains attached. |
| Missing/wrong agent executable | Only expected local Agent path used; Word remains functional, bounded reconnect/launch backoff; no shell/path search or network login inside VSTO. |
| Pipe version mismatch | Explicit incompatible handshake, no document registration or mutation. |
| Unauthorized Windows user | From a separate nonprivileged user, attempt connecting to the first user's pipe name: Windows ACL denies access. Record actual identities/result; Linux test delegate does not prove this. |
| Pipe name squatting | A pipe server owned by a different user must fail the add-in's server-process SID verification. Same-user malicious software remains outside a meaningful OS-user boundary; signed packaging is a later hardening requirement. |
| Bounded/invalid frames | Oversized prefix rejected before allocation, malformed JSON closes only offending peer, invalid revision/instance/session refused, capacity limits fail explicitly. |
| Existing Office.js | Existing manifest/task pane and onboarding still work. New custom properties do not alter its settings bag. No native cookie scraping/token injection. |
| Native server integration | Explicitly unavailable: no native sign-in or old user-only SignalR presence registration. Context/Intent/native synchronization is **not** accepted based on local position resolution. |
## 4. Measure responsiveness, extraction and recovery
Measure an add-in-disabled baseline first, then enabled trials (at least three per manuscript and operation). Keep same Word settings, device, document and other add-ins. Record warm/cold startup separately. Run `Measure-Processes.ps1 -OutputFile <new.csv> -Seconds 600` while exercising the trials; it records CPU totals and memory/handles for Word/agent, without COM reads.
Collect `%LOCALAPPDATA%/PlotDirector/Companion/agent.jsonl` and `.previous`, ribbon Diagnostics, VS debugger timings/thread IDs and Windows Performance Recorder/UI delay traces where available. Agent logs contain per-operation IPC elapsed time, queue depth, instance/session/correlation IDs; UI COM call/batch/tick timings are bounded telemetry. Timing summaries record call counts, total/max and counts over 30/100ms. No prose/token/path should appear in logs. Copy logs between trials to preserve rotation boundaries; live measurement is not guaranteed by the source code alone.
For each document/three-document run record:
- Individual COM call and extraction batch p50/p95/p99/max where complete samples are available; summary counts over 30ms/100ms. Initial practical target: ~20–30ms work slices. Flag any >100ms and investigate its exact COM call; do not claim the scheduler can preempt a slow Office call.
- UI timer delay plus externally measured keystroke-to-display, scrolling latency, ribbon click response, save/close latency and visible hangs relative to baseline. A timer alone is not proof of typing latency.
- Snapshot fragments/total characters/time/cancel count; completed vs cancelled revisions and no hidden repeated full-body reads on cursor-only movement.
- Agent CPU, working/private memory and peak queue depth (FIFO ≤64, coalesced selections ≤32; agent snapshot character caps stated in README).
- Time to offline detection/reconnect/reconciled state; no duplicate agents; no stale snapshot commit after restart.
Exercise continuous typing for two minutes during extraction, rapid cursor movement, scrolling while a large snapshot is pending, Save and Save As during pending work, close-cancel, three books switching and agent termination/restart. Add long paragraphs and many short/repeated paragraphs. Structural snapshot timing is **local**, not server manuscript synchronization timing.
Use a results CSV with columns: `commit, machine, OS, WordBuild, OfficeBitness, fixture, trial, action, wordCallP95Ms, wordCallMaxMs, batchP95Ms, typingLatencyP95Ms, scrollLatencyP95Ms, saveLatencyMs, closeLatencyMs, agentPeakCpu, agentPeakPrivateBytes, queuePeak, reconnectMs, result, evidencePath`.
Stop acceptance if typing, scroll/save/close is noticeably degraded, unsupported range handling loops, stale content appears as current, or a COM object crosses threads. Capture evidence and repair before moving to deployment/distribution. Do not replace missing measurements with green portable tests.
## 5. Separate server fixes
Before any future server deployment, apply migration 230 using the repository's verified Development backup/migration procedures and idle-work gate. This prototype does not apply it to the live database. Run the isolated marker security test and existing Office.js browser/Writer regressions. Hub names/signatures/events remain compatible, with stricter rejection for inaccessible/mismatched/stale build acknowledgements.
Phase 1 review must explicitly decide whether Windows measurements and auth/session dependencies are satisfied before full migration. No automatic updating, installer distribution or Production release is authorized here.