diff --git a/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Both-panels-expanded.png b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Both-panels-expanded.png new file mode 100644 index 00000000..c4fdf9c0 Binary files /dev/null and b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Both-panels-expanded.png differ diff --git a/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Both-panels-minimum-centre.png b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Both-panels-minimum-centre.png new file mode 100644 index 00000000..ac26c10e Binary files /dev/null and b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Both-panels-minimum-centre.png differ diff --git a/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Left-collapsed-tab.png b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Left-collapsed-tab.png new file mode 100644 index 00000000..5bc89d11 Binary files /dev/null and b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Left-collapsed-tab.png differ diff --git a/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Left-expanded-ribbon-Back.png b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Left-expanded-ribbon-Back.png new file mode 100644 index 00000000..9ddbe23b Binary files /dev/null and b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Left-expanded-ribbon-Back.png differ diff --git a/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Narrow-in-flow.png b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Narrow-in-flow.png new file mode 100644 index 00000000..3bf4a2be Binary files /dev/null and b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Narrow-in-flow.png differ diff --git a/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Qualification.json b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Qualification.json new file mode 100644 index 00000000..bda53c50 --- /dev/null +++ b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Qualification.json @@ -0,0 +1,114 @@ +{ + "schemaVersion": 1, + "qualifiedUtc": "2026-11-18T00:02:06.128198+00:00", + "branch": "codex/word-companion-native-phase1-20261104", + "deployedWebCommit": "5ebb9f82e83288e0a0ba11d5b173b673074451ef", + "databaseScopeCommit": "7177740ffb7896bbe9c484164b4fd130b41dbada", + "release": "5ebb9f8-20261117T235108Z", + "deployedDllSha256": "f25c7b2e4e30c7f095bd5b028c9a5ba0ba7de4a664fd6f7f1cb896f3e8084093", + "database": "PlotDirector_Development", + "migrations": [ + "275_InvestigationGuidance.sql", + "276_InvestigationGuidanceProcedure.sql", + "277_InvestigationGuidanceBookScope.sql" + ], + "build": { + "warnings": 0, + "errors": 0 + }, + "regressions": { + "baselinePasses": 610, + "finalPasses": 623 + }, + "checks": { + "privateDomainState": "passed", + "realSqlStateAndConcurrency": "passed", + "movedBookScopeRollback": "passed", + "nativeAndFallbackBack": "passed", + "sharedReader": "passed", + "integratedReview": "passed", + "writerLayout": "passed", + "isolatedCompanionRazorHttp": "passed", + "authenticatedDevelopmentJourney": "passed", + "sameProjectOtherAuthorIsolation": "passed", + "actualRenderedScreenshotsInspected": true + }, + "browserAcceptance": { + "recommendationDestinations": [ + "PlotLineWorkspace.Index", + "Timeline.Index" + ], + "findings": 2, + "progressAfterOpening": "Exploring", + "explicitDonePersists": true, + "unconfirmedSaveRestoresConfirmedValue": true, + "summaryFailureRetry": true, + "normalAndInPageBookScope": true, + "pinCollapseSessionRestoration": true, + "dismissReactivate": true, + "invalidIdAndUnavailableDestination": true, + "viewports": [ + { + "width": 1440, + "height": 1000 + }, + { + "width": 1100, + "height": 1000 + }, + { + "width": 800, + "height": 1000 + } + ], + "minimumCentralWidth": 560, + "maximumNarrowGuidanceHeightVh": 55 + }, + "preservation": { + "comparedOriginalTables": [ + "Projects", + "Books", + "Chapters", + "Scenes", + "BookParagraphManuscripts", + "WriterInvestigations", + "WriterInvestigationEvents", + "WriterWorkingObjectives", + "WriterReviewObservations", + "WriterWorkSessions", + "WriterInvestigationCatalogues" + ], + "allOriginalCountsAndHashesMatch": true, + "remainingFixtureAccounts": 0, + "remainingFixtureGuidance": 0, + "rollbackOnlyScopeFixtureRemoved": true, + "credentialsRemoved": true + }, + "limitations": [ + "Standalone PWA detection simulated in Chromium; no installed OS PWA test", + "Physical Windows/Word unavailable; existing native/audio browser telemetry simulated", + "Presentation preferences device-specific", + "Only existing verified destination adapters offered" + ], + "screenshots": [ + "Both-panels-expanded.png", + "Both-panels-minimum-centre.png", + "Left-collapsed-tab.png", + "Left-expanded-ribbon-Back.png", + "Narrow-in-flow.png", + "Ribbon-Back-retains-guidance.png", + "Second-destination-Timeline.png" + ], + "deployment": { + "serviceActive": true, + "localGet": 200, + "publicTlsGet": 200, + "publishedAndDeployedDllHashesMatch": true, + "productionChanged": false, + "windowsCompanionBinariesChanged": false, + "retainedBackups": true, + "notableWarning": "Local HTTP HTTPS-port discovery warning behind TLS proxy; public HTTPS succeeded" + }, + "diagnosticEngineOrQuestionnaireChanged": false, + "writerPhase2Started": false +} diff --git a/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Ribbon-Back-retains-guidance.png b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Ribbon-Back-retains-guidance.png new file mode 100644 index 00000000..9dd381df Binary files /dev/null and b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Ribbon-Back-retains-guidance.png differ diff --git a/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Second-destination-Timeline.png b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Second-destination-Timeline.png new file mode 100644 index 00000000..10c39b90 Binary files /dev/null and b/Docs/Writer/Writer3/Evidence/Investigation-Companion-Phase15/Second-destination-Timeline.png differ diff --git a/Docs/Writer/Writer3/Investigation-Companion-Phase15-Report.md b/Docs/Writer/Writer3/Investigation-Companion-Phase15-Report.md new file mode 100644 index 00000000..d2e1886e --- /dev/null +++ b/Docs/Writer/Writer3/Investigation-Companion-Phase15-Report.md @@ -0,0 +1,118 @@ +# Phase 1.5 — Persistent Investigation Companion + +## Scope and baseline + +Shared branch: `codex/word-companion-native-phase1-20261104`. Fetched and reconciled before editing; Phase 1 application `b527e8e` and report `2a865f0` verified. The existing unrelated untracked canonical-manuscript assessment was preserved. Baseline solution build: zero warnings/errors; baseline executable regression harness: 610 passing checks. + +This phase adds follow-through to saved Guided Investigations and corrects Back placement. It does not introduce AI, change questions/answers/weights/thresholds, implement feature readiness or begin Writer Phase 2. Development access follows the existing investigation gate; synthetic content remains administrator-only. + +## Architecture and reuse + +The existing authenticated `_Layout` contains one `plotline-help-layout` flex shell: centre working surface, right Help and its splitter. A single `_InvestigationCompanion` partial adds the left drawer and splitter to that same shell. There are no per-tool sidebar implementations. Shared Help header/content classes, theme tokens, sticky measurement conventions, pointer resizing and the Pin/Collapse interaction pattern are reused. Business logic is independent: opening or closing either drawer never clears the other. + +Help's existing Pin means restoration on later pages. Investigation uses the same meaning. A pinned active investigation restores expanded unless explicitly collapsed. Unpinned guidance restores as a narrow tab on navigation. Collapse, per-book width (280–440px) and bounded per-investigation scroll positions use author-scoped browser preferences; they contain no answers or diagnostic results. Enter/Space operate native buttons; the splitter supports pointer capture and arrow keys. Malformed/blocked preference storage falls back safely. + +The shared shell measures the actual sticky header/ribbon height for both drawers, rather than applying a guessed offset. The existing Writer contextual/Word panel continues to use its own established available-width breakpoint. Focus Reading makes both shared drawers inert and restores their prior inert state on exit. + +## Ribbon Back correction + +There is exactly one Back action, outside the tab panels but inside the main ribbon button row, first in the Navigation group. Its SVG arrow, label, spacing, hover/focus and disabled treatment use the existing ribbon command styling. The upper menu-row instance and its special styles are removed. Switching categories retains this one button. Collapsing the ribbon hides its command row, including Back; expanding restores it. The native/fallback history script is unchanged, including external-boundary and unsaved-change protections. + +A narrow-window regression revealed that a visually hidden resizing description could escape its scrolling ribbon panel because its containing block was outside that panel. Establishing the panel as a positioned containing block fixes the overflow without hiding controls or redesigning the ribbon. + +## Persistence and diagnostic integrity + +`WriterInvestigationGuidance` stores only follow-through metadata: canonical investigation ID, private author/book identity, active/finished flags, optimistic version, selected hypothesis/capability IDs and explicit progress. One filtered unique index permits one active investigation per author/book. Activating another preserves the former row and progress. Dismiss and Finish deactivate guidance; neither deletes an investigation. Finished journeys can be reactivated without completing every suggestion. + +Canonical `WriterInvestigations` and append-only `WriterInvestigationEvents` remain the authoritative answers and diagnostic results. A compact stored-procedure projection reads the current saved event's evaluation outcome/recommendation IDs and live answer-option IDs needed by existing eligibility rules. It excludes questionnaire wording, explanations, presented-question history and recommendation history. Evidence wording and optional explanations load only when the author expands Evidence, bounded to five supporting answers. + +No diagnostic evaluation is run by companion summary, progress or tool opening. The existing results page retains its existing evaluation behaviour. Old investigations without an event snapshot remain readable with an explanation and full-results link; the companion does not invent a diagnosis or destination for them. If an investigation is still in progress, its old suggestions are not offered as current recommendations. + +`InvestigationGuidanceService` projects authored catalogue templates onto saved recommendation IDs and uses the existing trusted `DestinationRegistry`. Immutable catalogues are cached by version for 30 minutes; no private summaries are shared between users. One compact SQL query restores the panel per scoped page; the indexed current-event lookup does not retrieve the replay history. Requests are aborted/versioned so stale responses cannot overwrite a newly selected context. No background service was added. + +## Navigation and authorisation + +Results and companion tool actions use ordinary same-window antiforgery-protected POST/redirect navigation. No recommendation uses `target=_blank` or `window.open`. Results pass the selected finding as well as capability, preserving identity when the same tool belongs to multiple findings. Both entry points call the same follow-through service and trusted controller/action resolver. The destination is authorised and checked for current availability/prerequisites before redirecting; no catalogue URL concatenation is used. + +Opening selects the finding/tool and moves Not started to Exploring. It never marks Done and preserves an explicit Done/Skipped decision. Progress choices are Not started, Exploring, Done and Skipped; all can be revised. Keys are stable `hypothesis/capability` identities, independent of array order or wording. Progress does not modify manuscript/story data or stand for feature readiness. + +Every server operation checks authenticated ownership, book/project membership, archived state and synthetic-catalogue restrictions. Stored procedures additionally enforce ownership and scope. Even another owner of the same project cannot read the author's private investigation. Mutation versions reject stale windows rather than overwriting newer progress. Summary responses are private/no-store. Explicitly selecting a different book never falls back to the prior book's guidance. On project-only tools, the latest active investigation for that project may supply the book context, clearly named in the panel. On context-free pages the tab explains how to choose a book. Existing in-page Calendar/At This Point book changes notify the shared panel to reload its validated scope. + +The full-results link always remains available. Switching investigations is an explicit results action (“Keep this investigation alongside my work”) or recommendation click; the results explain that this changes active guidance and preserves other saved investigations. Unavailable tool navigation presents a recovery page with the saved-results link. Failed progress saves restore the last confirmed presentation and report that the change was not confirmed. + +## Help coexistence and responsive behaviour + +Right Help retains its own article, pin, collapse and width state. When pinned, an existing page-level guide is used on navigation where declared; otherwise its saved guide remains available. Investigation never replaces Help content with diagnostic content. + +On wide screens, left and right drawers consume bounded columns and the central workspace reflows. With both drawers open, responsive limits reserve a minimum 560px central surface at 1100px and above, including a preferred 440px left width. Plot Lines’ existing filter grid now uses its available space rather than fixed minimum columns; its controls cannot extend into Help. At narrower widths the expanded left drawer becomes a bounded in-flow guidance row above the workspace; it does not obscure controls or push the tool off-screen. Help can independently expand as an in-flow row. Collapse remains a persistent narrow tab and does not discard selection/progress. Main document scrolling is retained; drawer contents scroll independently. Width preferences survive responsive changes. + +## Migrations and preservation + +- `275_InvestigationGuidance.sql`: additive table, cascading canonical-investigation foreign key and unique active-author/book index. +- `276_InvestigationGuidanceProcedure.sql`: scope-checked read/mutation procedure with optimistic concurrency and transactional activation. +- `277_InvestigationGuidanceBookScope.sql`: requires the book’s current project to match the investigation’s saved project on both reads and mutations. A rollback-only fixture proves that moving a book cannot expose or relabel stale guidance, even when the author belongs to both projects. + +A unique copy-only Development backup with checksum was verified using `RESTORE VERIFYONLY` before fixture/migration changes. During initial qualification the new procedure's unquoted `Option` identifier was rejected; its unapplied procedure batch was separated into corrected forward script 276. The successfully applied table/index batch remains in 275. Both final files were applied in order and reapplication passed. No pre-existing numbered migration was changed, and no existing investigations were rewritten. + +Rollback is web-only: the prior web build can ignore these additive objects. Retain guidance rows if reverting the web application; dropping the table would discard private progress and is not part of the rollback. Account/project deletion continues through canonical investigation cascades, explicitly tested. No manuscript/project/book schema changes or destructive jobs were introduced. + +## Qualification and deployment receipts + +Final solution build: **zero warnings/errors**. Final executable regression harness: **623 passing checks**, including all prior questionnaire/public Problem Solver checks. The production catalogue’s existing 127 deterministic completed paths were also exercised without generating new question content. + +Focused qualification passed: + +- Domain/service tests: multiple findings and tools, selected finding restoration, exploration versus explicit completion, reopening Done, disabled capability, invalid finding, book/user isolation, finish/reactivate, older records without snapshots and unchanged canonical JSON/events. +- Real SQL integration: compact persisted evaluation projection, private author/book scope (including a second owner of the same project), durable progress, stale-write rejection, exclusive active investigation, retained previous progress, cascade deletion and unchanged canonical investigation/event hashes. +- Final SQL scope test: a rollback-only account/project/book fixture verifies positive access before a book move and denial in both old and new project contexts afterwards. All fixture rows roll back. Migration 277 adds the same book/project identity predicate to read and mutation paths. +- Native/fallback Back browser suite: internal boundaries, redirects, refresh/Forward, push/replace preservation and cancelled unsaved navigation. The history script is unchanged. +- Existing integrated Review browser/PWA suite: anchored observations, stale drafts, Word paragraph/chapter acknowledgement, Audio Review state, Focus Reading, Help and narrow overlay. +- Existing shared Reader suite: 3 widths × 4 themes × browser/PWA, escaped/selectable text, private headers, chapter/error/empty states and scope isolation. +- Existing Writer layout suite: all five pages, shown/hidden companion, internal reflow, layout preference persistence, resizing, Help, Reading/Focus and sticky offsets. Its Back assertion now expands the ribbon command row; the sticky case uses the existing long-manuscript fixture rather than scrolling beyond a short chapter’s workspace. +- Isolated real Razor/HTTP companion suite, followed by authenticated Development acceptance: saved results, two findings, Plot Lines and Timeline destinations in the same window, selected suggestion, supporting answers on demand, explicit Done, refresh, failed-save restoration, simultaneous Help, collapse/expand/pin, reopened simulated PWA session, ribbon navigation/Back, book switching, in-page book events (including All books), malformed preferences, failed summary/retry, dismissal/reactivation, invalid IDs and unavailable destinations. Another authenticated project owner cannot read or activate the private investigation. + +The authenticated journey used a disposable saved investigation from an existing deterministic production-catalogue path, persisted through the canonical stored procedure before any guidance row existed. This exercises old-record activation, actual Dapper/stored-procedure writes and normal destination controllers, not mocked UI state. Browser network failures and existing native/audio telemetry are explicitly simulated. Seven final rendered screenshots were inspected; page dimensions alone did not establish acceptance. + +Resolved qualification issues included the reserved SQL identifier, a temporary publish quota failure before installation, the ribbon’s positioned accessibility description, Plot Lines filter overlap, and drawer CSS specificity/height limits. Each was investigated and corrected. The new browser assertions check actual panel hiding, bounded drawer height, centre width and containment of working controls, in addition to page overflow. The in-page book test was corrected to preserve the canonical book URL before testing refresh, as the real Calendar navigation does. + +### Development deployment + +Application foundation: `fccc0d8`. Final deployed web application: **`5ebb9f82e83288e0a0ba11d5b173b673074451ef`**, including the subsequent visual/scoping-link refinements. Final database scope hardening and its regression: **`7177740ffb7896bbe9c484164b4fd130b41dbada`**. The latter changes only SQL/test files and does not require replacing the identical web application code. It was applied after the full authenticated journey and qualified by the positive/negative rollback-only SQL scope test. + +Development release: `5ebb9f8-20261117T235108Z`. Published/deployed DLL SHA-256: + +`f25c7b2e4e30c7f095bd5b028c9a5ba0ba7de4a664fd6f7f1cb896f3e8084093` + +Assembly informational version: `1.0.0+5ebb9f82e83288e0a0ba11d5b173b673074451ef`. Publication used a fresh directory; the physical current tree was backed up and deployed configuration, keys, uploads and logs were preserved. Pre-stop checks found no queued/running imports, synthesis, enrichment or analysis jobs. Service is active; local GET and public TLS-validated GET return 200. No error/critical application log entries were found. The local HTTP smoke check logged the known HTTPS-port discovery warning behind the TLS proxy; public HTTPS acceptance succeeded. + +The first publish attempt exhausted temporary-storage quota before installation. Only obsolete task-created publish directories were removed, and a fresh publish on the repository filesystem succeeded. Release archives and current-before backups were retained. No Production service or Windows Companion binary was changed. + +### Data-preservation receipts + +After guarded cleanup of the two acceptance accounts and the rollback-only scope fixture, all **11 original table counts and SHA-256 aggregate hashes match exactly**: Projects, Books, Chapters, Scenes, BookParagraphManuscripts, WriterInvestigations, WriterInvestigationEvents, WriterWorkingObjectives, WriterReviewObservations, WriterWorkSessions and WriterInvestigationCatalogues. The new guidance table has zero remaining fixture rows, and no fixture accounts remain. Original questionnaire/catalogue code and content are unchanged. These checks cover the named tables rather than claiming a whole-database comparison. Private credentials, disposable publish outputs and the browser fixture host were removed/stopped. + +### Screenshot evidence + +All screenshots are authenticated Development captures with disposable content. Standard desktop captures use 1440 × 1000; additional widths are labelled below. + +| Evidence | Screenshot | +|---|---| +| Left expanded; Back is a ribbon action | [Plot Lines and ribbon Back](Evidence/Investigation-Companion-Phase15/Left-expanded-ribbon-Back.png) | +| Left collapsed to persistent tab; Help retained | [Collapsed tab](Evidence/Investigation-Companion-Phase15/Left-collapsed-tab.png) | +| Independent Investigation and Help expanded | [Both panels](Evidence/Investigation-Companion-Phase15/Both-panels-expanded.png) | +| Minimum central surface, contained filters, 1100 × 1000 | [Width boundary](Evidence/Investigation-Companion-Phase15/Both-panels-minimum-centre.png) | +| Second recommended destination and page-specific Help | [Timeline](Evidence/Investigation-Companion-Phase15/Second-destination-Timeline.png) | +| Ribbon Back preserves selected suggestion/progress | [Back to Timeline](Evidence/Investigation-Companion-Phase15/Ribbon-Back-retains-guidance.png) | +| Bounded in-flow guidance and usable tool, 800 × 1000 | [Narrow window](Evidence/Investigation-Companion-Phase15/Narrow-in-flow.png) | + +[Phase 1 comparison showing the former Back placement](Evidence/Layout-Phase1/After/Write-hidden.png). [Machine-readable qualification receipt](Evidence/Investigation-Companion-Phase15/Qualification.json). + +## Future recommendation participation + +A future catalogue recommendation participates through its stable hypothesis and capability IDs, authored explanations/action wording and a verified existing destination adapter. Add/qualify an adapter in `DestinationRegistry` when a capability needs one; do not add sidebar-specific routes or navigation handlers. The results form and companion call the same `InvestigationGuidanceService.Open`. Future readiness/preparation may decorate guidance separately, but must never change the canonical diagnostic evidence or treat explicit Done as readiness proof. + +## Limits and stopping point + +Restoration is asynchronous: the compact tab appears while the private summary loads. Presentation preferences are device/browser-specific, following existing Help conventions; active identity, selection and progress are server-side. Context-free pages require choosing a project/book; no private content from an unrelated context is automatically displayed. Old records without saved snapshots require returning to the full investigation. Only the currently implemented trusted destination adapters are offered; this phase does not expand the capability graph. + +Installed operating-system PWA and physical Windows/Word testing are unavailable; Chromium standalone detection and existing native/audio simulations provide browser qualification. No Windows Companion binaries or Production deployment are authorised or performed. Writer Phase 2 and speculative AI assistance remain out of scope. Stop for review after the Development receipts are complete.