Record Writer Phase 2.1 and final Review Development acceptance

This commit is contained in:
Nick Beckley 2026-11-18 22:36:08 +00:00
parent 75d3aba233
commit e7cd923efc
33 changed files with 122 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 KiB

View File

@ -0,0 +1,121 @@
# Writer workspace Phase 2.1
## Executive summary
Implementation baseline: `f228d40`, fetched and fast-forward checked on the existing shared branch `codex/word-companion-native-phase1-20261104`. The untracked canonical architecture assessment was preserved. Work is limited to Development; Production, Test and Master are unchanged.
The five workspaces now distinguish current focus, intended activities, editorial decisions and recorded work. The deterministic investigation engine/catalogues/scoring are retained. Windows/Word physical acceptance and native binary packaging remain separate from Atlas qualification.
## Workspace changes
### Shared shell and Write
Visible introductory headings/descriptions are removed from the five workspaces, with a semantic hidden heading retained. Document titles use the workspace and selected book with the existing PlotDirector suffix. `site.webmanifest` retains its installed application name/short name, PlotDirector. The browser/OS owns the installed PWA caption: changing document titles does not establish a changed Windows title-bar caption. No native window-caption or manifest identity change was attempted.
Back remains the existing icon ribbon command with its history and same-window safety. The authenticated public Problem Solver shortcut is removed without changing its public controller, routes, content or indexing. Guided Investigation targets New investigation within Explore. Journey routes and query aliases redirect to Reflect, preserving book/year/month/day. Dashboard remains a distinct metrics view; scene queues, schedule tools and Reports retain their existing capabilities and routes.
Write distinguishes selecting activity/chapter/scene from opening the selected scene workspace. Saving focus does not create a session. Explicit recording remains in Write and retains its existing elapsed/browser/audio semantics. Existing checklist records have visible immediate completion checkboxes outside the notes accordion. Completion uses existing field concurrency tokens; label/details/order editing preserves the recorded completion unless explicitly changed. Ordinary prose notes remain separate records. Context and Intent links from Write use the same window; the advanced multi-display infrastructure is retained.
### Explore
New/Saved tabs replace stacked starting/saved sections. Saved records retain statuses and recent-activity ordering in a bounded list, with scroll position retained on tab switching. The initial 50/50 Discover/investigation grid reflows to 25/75, with question/history regions and responsive reflow. The existing Start/Answer/read engine endpoints render an inline journey for AJAX requests. Native forms/full-results routes remain available. Earlier-answer editing and deterministic recomputation are unchanged. Version conflicts and request failures retain the entered form; duplicate submissions are guarded. Start request UUIDs permit safe recovery after a lost response. Continue from the Investigation Companion returns to Explore with the selected investigation. Persistent Companion state, pin/collapse/close/selection and independent Help remain intact; opening a recommendation does not mark it complete.
### Plan
One private per-author/book activity collection supports title, activity type, notes, optional target date, status, manual order and timestamps. Optional relationships cover active chapters/scenes in the book and characters/locations/plot lines/threads belonging to its project (with book scope where applicable). Server-side validation rechecks references. List, Board and Schedule read the same records; undated activities remain visible. Accessible status controls replace a drag-only requirement. Create/edit, reorder, complete/reopen, defer and reversible archive are supported with version conflict checks and idempotent create UUIDs.
Schedule shows intended dated work alongside the existing allocated writing work; it does not generate a second schedule engine. The large duplicated focus wizard is removed. Start working routes to Write, Review, Characters, Locations or Story tools as appropriate. Only compatible chapter/scene work sets saved focus. It neither completes the activity nor creates a recording session. Deleted/archived references are displayed honestly and cannot silently retarget another entity.
### Review
The canonical Reader remains central, with independent chapter and scene note panels, direct existing-record editors, annotation classification/status filters and explicit chapter/scene/accepted-passage scopes. A scene comes only from the accepted paragraph assignment and active chapter structure; no prose inference is introduced. Chapter context remains fixed while verified scene context follows selection. Unassigned and changed/missing anchors remain explicit.
Existing `WriterReviewObservations` store the new annotations. Classifications are Observation, Revision needed, Continuity, Research, Character, Plot, Pacing, Reminder and General note; lifecycle includes Open, Working (displayed as In progress), Resolved and Dismissed. Editing classification/text/status retains original accepted provenance. To choose a different saved reference, the author deliberately creates another annotation; existing anchors are never silently rewritten. Passage references retain accepted paragraph IDs, offsets, revision and hash. Revisit returns to a retained paragraph and briefly highlights it without moving Word automatically. An ambiguous new annotation requires an explicit scope choice. Chapter annotation editors stay in the left panel; scene/passage editors stay in the right panel.
Existing chapter summaries/intentions and scene intentions/prose notes/checklists are edited through their existing versioned authoring service. They are not silently merged or reclassified as annotations. Structural chapter editing remains a secondary same-window route with a local validated return path. Reader metadata and audio controls remain available. Focus Reading keeps its minimal centred manuscript and preserves mode across previous/next chapter navigation. Review panels are not exposed in Focus Reading. Manuscript content uses continuous document scrolling and a bounded prose measure. The late amendment replaces the earlier optional note utilities with permanent Chapter Notes | Reader | Scene Notes columns, initially 25/50/25. Two pointer and keyboard dividers enforce minimum note and manuscript widths and persist presentation ratios in per-user browser storage. The notes have independent scrolling and remain sticky below the measured expanded or collapsed PWA ribbon. At less than 960px of available editorial width, both notes remain visible side by side above a full-width reader; neither becomes an interchangeable tab. Help and Investigation remain independent shared-shell features. Focus uses the existing Reader implementation, hides both notes, preserves the current accepted passage where practical and restores the saved widths on exit. Review also retains the last valid chapter per author/book within the browser session; a first visit can default to a valid saved working chapter without changing focus.
The permanent fourth Word Companion column is removed on Review only. Application connection status and Display Setup remain in the shell. Chapter/scene/paragraph navigation uses the existing ribbon commands and verification checks. A compact evidence-based warning and on-demand connection/update diagnostics sit by the Reader; saved assessment destinations remain available. No synchronisation or matching service was replaced.
In PWA mode, the existing page-command contribution framework promotes native Reader handlers into Reading & Review, Annotations and Synchronisation groups. Previous/next, Focus/Exit, Reading & Audio and pause/resume updates retain their original handlers; pause has an explicit pressed/active state. Reading/audio opens the existing single work toolbar in a compact dialog. The header retains chapter selection, Read and minimal status. Source controls remain in normal browser mode because that mode does not compose PWA page contributions. Focus retains its own minimal chapter navigation/Exit because the ordinary shell is inert while reading. Contextual panel Add/Edit controls and diagnostics stay with their records; they are not another reader toolbar.
### Reflect
Calendar remains the default, including month/day selection and year overview. Sessions & activity has a separate bounded, filterable history and existing exports. Quiet days do not fabricate evidence. Legacy Journey links redirect here; recording remains in Write. Reporting and accepted-change evidence remain available. Recent session reads/exports retain their existing 50-record bound; selecting a day and Reports provide scoped access rather than inventing unlimited historical reconstruction.
## Database, security and preservation
Forward-only migrations:
- `281_WriterActivities.sql`: new private activity records and validated stored-procedure access, versioned changes and reversible archive. User/book deletion cascades; optional entity references do not prevent deliberate structural deletion.
- `282_WriterEditorialAnnotations.sql`: nullable scope/classification metadata and expanded status constraint on existing observations; previous rows/accepted anchors are not rewritten. Existing rows retain their original fields and are displayed through compatibility defaults.
Application access uses Dapper/stored procedures; no Entity Framework or inline application SQL is introduced. Mutations retain authentication/antiforgery, author/book scope, entity validation, concurrency checks and repeat protection. No existing numbered migration was edited. Planner and review writes do not mutate canonical manuscript content, paragraph IDs, scene relationships or accepted revisions. Operational planner records are not added to the portable project backup format in this phase; database backup/restore and account/book cleanup retain them.
Migrations were first exercised in the separately restored `PlotDirector_WriterPhase21_20261118` database, using its own physical files and synthetic authors. The copy-only/checksum Development backup was verified and restored successfully. Application-principal execute access was confirmed. All 15 compared author-data table counts/content hashes matched immediately before and after live migration: Projects, Books, Chapters, Scenes, accepted paragraph manuscripts, investigations/events/catalogues, working objectives, observations, sessions, scene notes, checklist items, chapter goals and writing plans. Final post-cleanup comparison and deployment receipts are recorded below.
## Word navigation investigation and qualification limits
Two concrete code paths explain the reported defects:
1. The browser captured chapter/scene targets once when the page loaded. It now reads current context and invalidates/rechecks targets on saved focus and accepted selection changes. Ribbon and retained legacy actions use the same validated navigation service.
2. The agent skipped presence exchanges for unchanged documents for up to 15 seconds, although those replies deliver navigation requests. Navigation acknowledgement identity/result were also absent from that change key. Acknowledgement-capable clients now exchange at most every two seconds and changed acknowledgements bypass the unchanged-document delay. Older clients retain their former heartbeat behaviour.
Ribbon availability is checked against the same exact actor/book/instance/document/manuscript/revision and verified target resolution used for dispatch. Unsupported/unmapped/disconnected targets stay disabled with explanations. Chapter-capable navigation can read lightweight accepted status and existing live checkpoint mappings; a request-scoped accepted snapshot read is reused for scene/passage checks. Execution revalidates the current mapping. UUID acknowledgement, expiry, duplicate fences and multiple-document selection remain authoritative. A queued request is never presented as completed.
Instrumentation covers browser dispatch/server request/confirmation, server target-resolution/queue `Server-Timing`, and VSTO UI-dispatch, identity/target and Word selection metrics. Existing adapter diagnostics retain execution counts/last command. Chromium simulated transport confirmed repeated requests in approximately 1.3–1.4 seconds (including the deliberate one-second confirmation poll); this is not a physical Word benchmark. The reported ten-second real-Word delay was not reproduced on Atlas. Source corrections remove the identified polling delay, but installed Windows agents/add-ins must be rebuilt/qualified before claiming an end-to-end latency improvement. No Windows installer or installed software was changed.
## Additional shared ribbon correction
Shared ribbon CSS reduces excessive group/button padding and minimum widths while retaining 22px command icons and consistent 68px command heights. Centred labels wrap naturally to two lines. Wide selectors/search controls are more compact, with practical native editing and dropdown behaviour. Selected long visible labels have shorter presentation captions with full tooltip/accessibility descriptions retained. Group headings, separators, dropdown indicators, focus/active/disabled states, source identities and command handlers/destinations remain intact. Existing responsive dropdown behaviour and horizontal scrolling fallback remain available; no Maps-only styling or command consolidation was introduced.
Chromium comparisons at 1666px apply the original spacing CSS to the same command set and compare the compact CSS. Primary Project, Book, Writer, Story, Characters, World and Tools ribbons are checked at 1666/1366/1024/800px. Before/after geometry, identities and screenshots are included in the evidence inventory; final authenticated Maps captures use the deployed application.
## Qualification, evidence and deployment
The original job was validated (build, 624 regression checks and publish), committed and pushed through `9493e73` before applying the late amendment on the same shared branch. The amendment is therefore a subsequent, coherent part of this job, not a competing implementation. Its principal commit is `c43fe5d12d8784d376c3c8e12cf4942c3d1f4ffa`; the final application build is `75d3aba23377c7ac1104a486f5b3b2bbb45f7c1c` (`aac32d5` qualified the normal-browser chapter selector; `75d3aba` isolates sticky notes for correct Chromium painting during long scrolls). No force push, separate branch or competing worker was used.
| Gate | Actual result |
|---|---|
| Solution build | Passed, zero warnings/errors (`build-amendment-final.log`). |
| Executable regression harness | 624 PASS, exit 0 (`regression-amendment.log`). |
| Disposable database suite | 32 PASS, including actual repository idempotency, author/book fences, concurrency, status/order, accepted annotation anchors and canonical preservation (`database-final.log`). |
| Native portable suite | 292 PASS; Linux cannot qualify Windows ACL/COM/physical Word (`native-final.log`). |
| Native actual HTTP suite | Passed authentication, antiforgery, pairing, invalidation, idempotency and persistence paths with a synthetic provider and no paid AI (`http-final.log`). |
| Browser Review fixture | Passed chapter/scene/passage annotations, classifications/statuses, dividers, persistence, Focus navigation, four themes and responsive layouts (`browser-review-amendment-final.log`); canonical and Word transport are simulated in this fixture. |
| Browser Word fixture | Passed repeated unique requests/receipts, saved-focus target change, disconnect/cross-book disablement and mapping recovery (`browser-word-recovery.log`); transport is simulated. |
| Shared ribbon comparison | At 1666px the same Maps command set changes from 1901px to 1568px total width and from 11 to 15 commands fitting; identities/destinations are unchanged (`ribbon/qualification.json`). |
| Authenticated Development ribbon | Both browser and simulated PWA; Project, Book, Writer, Story, Characters, World and Tools at 1666/1366/1024/800px; four Maps themes, two-line labels, 68px command heights, keyboard focus, no page overflow. Writer matches inactive/active/hover/focus colours in each theme (`ribbon-live-final.log`). |
| Authenticated Development Review amendment | Both modes; real long accepted chapter at top/middle/last paragraph, both permanent notes, default proportions, both pointer dividers and keyboard resizing, reload persistence, independent panel scroll, expanded/collapsed ribbon offsets, diagnostics, audio controls, scope choice, Focus restore and narrower layouts (`live-amendment-final.log`). |
| Full authenticated workspace acceptance | PASS in browser and simulated PWA (`live-complete.log`): saved focus/checklists/session independence, inline investigation with recomputation/results, saved scrolling, planner views/edit/status/order/start, chapter/scene/passage annotations, direct note edits, Focus chapter navigation, Reflect/history/legacy redirects, responsive destinations, zero popups and zero page errors. Run on `aac32d5`; the sole subsequent application change is the note painting CSS. Final Review/ribbon acceptance was repeated on deployed `75d3aba`. |
Browser PWA tests set the browser's standalone signal; they do not prove installation, Windows title-bar captions, OS window management or physical Word behaviour. The browser normal-mode chapter selector was widened after visual inspection. Long-scroll inspection also exposed missing sticky text despite passing geometry assertions; giving the two note panels their own render layers corrected it. The final top/middle/last-paragraph and collapsed-ribbon captures were inspected again after deployment. Representative data is synthetic and confined to the disposable author. Chromium captures are inspected visually; direct viewport captures avoid screenshot clipping during large programmatic scrolls. No assertion that a successful build alone establishes visual acceptance is made.
### Deployment receipt
Development release: `75d3aba-20261118T223105Z`. Published/deployed `PlotLine.dll` SHA-256: `510e78bbd225eb424085d601cfea8141a18eabf69181516d94ac4ae3592db8ff`. Deployed informational version is `1.0.0+75d3aba23377c7ac1104a486f5b3b2bbb45f7c1c`; service is active, local HTTP and public HTTPS return 200, and the post-deployment warning/error journal is empty. The guarded idle check passed before installation; configuration, keys, uploads and logs were preserved. Production was not changed.
Immediate application rollback is `/srv/apps/plotdirector-dev/current-before-75d3aba-20261118T223105Z` (the qualified amendment build). The pre-job application rollback is `/srv/apps/plotdirector-dev/current-before-c868eb4-20261118T213225Z`; migrations are forward-only and are not undone by application rollback. The copy-only verified database backup is `/var/opt/mssql/backup/writer-phase21-20261118T210741Z.bak`.
### Evidence inventory
Selected screenshots are retained in `Evidence/Phase2-1/`; the complete local screenshot/log inventory is `/home/nick/writer-phase21/`. Review top/middle/bottom, collapsed ribbon, narrow layouts, four themes and normal-browser header captures supersede the earlier optional-panel screenshots. Maps before/after uses identical fixture commands; final Maps captures use the authenticated deployed application. Workspaces include Write checklists, inline Explore/results/saved scrolling, Plan List/Board/Schedule and Reflect Calendar/Sessions.
### Remaining Windows acceptance
Rebuild and package the paired Windows Companion agent and Word add-in from the final branch before measuring the heartbeat fix. On a Windows machine, connect the intended manuscript, confirm accepted revision/checkpoints, and repeat chapter, scene and paragraph navigation at least three times each. Correlate request UUIDs, server timings, agent execution count and add-in dispatch/identity/selection diagnostics. Check multiple open documents, unsaved changes, stale/missing anchors, disconnect/reconnect and expiry; only a matching completed acknowledgement establishes completion. Compare real timings before/after; the simulated 1.3–1.4-second receipt is not a promised Word latency. Finally check the genuinely installed PWA's caption, native window behaviour and four themes. These physical Windows/Word checks remain unverified on Atlas.
### Cleanup and final preservation
The disposable author was removed through normal authenticated account deletion, including its owned project, books, investigations, annotations, activities and sessions. Explicit Development queries confirm the fixture author/project/book/activities are absent. The private credential file and temporary symlink were deleted. The exact disposable clone `PlotDirector_WriterPhase21_20261118` was dropped only after verifying its expected physical file paths. The local fixture browser host was stopped. Verified backup/rollback artifacts are retained; no Production database was accessed.
Thirteen of the fifteen final whole-table counts/content hashes exactly match the pre-job baseline, including projects, books, chapters, scenes, accepted manuscript JSON, working objectives, observations, sessions, catalogue, ordinary scene notes, checklist items, chapter goals and writing plans. The two investigation tables reflect live activity outside the deleted fixture author: one new investigation at 21:43:23 UTC and one existing investigation updated at 21:44:12 UTC, with two appended events overall. All original 105 investigation events retain the exact baseline hash `201E89F1ACC32C19195E8D6B6EFFA00042C7734A7D3031BDCD11E35C8F255762`. This concurrent activity was preserved, not reverted. Therefore the final report does not claim all fifteen whole-table hashes are unchanged. Immediate pre/post-migration comparison did match all fifteen. Receipts: `preserve-final-application.txt`, `preserve-original-investigations.txt`, `preserve-original-events.txt`, `cleanup.log`, `cleanup-verify.log`, `cleanup-clone.log`.
Selected visual evidence (all disposable fixture data):
- Review: [top](Evidence/Phase2-1/Review-top-PWA.png), [middle](Evidence/Phase2-1/Review-middle-PWA.png), [last paragraph](Evidence/Phase2-1/Review-bottom-PWA.png), [collapsed ribbon](Evidence/Phase2-1/Review-middle-collapsed-PWA.png), [1666px](Evidence/Phase2-1/Review-width-1666-PWA.png), [800px](Evidence/Phase2-1/Review-width-800-PWA.png), [normal browser](Evidence/Phase2-1/Review-top-browser.png).
- Four Review themes: [modern light](Evidence/Phase2-1/Review-modern-light-PWA.png), [modern dark](Evidence/Phase2-1/Review-modern-dark-PWA.png), [warm light](Evidence/Phase2-1/Review-warm-light-PWA.png), [warm dark](Evidence/Phase2-1/Review-warm-dark-PWA.png).
- Maps: [original spacing](Evidence/Phase2-1/Maps-1666-before.png), [compact spacing](Evidence/Phase2-1/Maps-1666-after.png), [deployed PWA](Evidence/Phase2-1/Maps-1666-modern-light-PWA.png). All eight deployed browser/PWA Maps theme captures are included in the same folder.
- Workspaces: [Write](Evidence/Phase2-1/Write-checklist-and-ribbon.png), [Explore](Evidence/Phase2-1/Explore-new.png), [results](Evidence/Phase2-1/Explore-results.png), [saved investigations](Evidence/Phase2-1/Explore-saved-scroll.png), [Plan List](Evidence/Phase2-1/Plan-list.png), [Board](Evidence/Phase2-1/Plan-board.png), [Schedule](Evidence/Phase2-1/Plan-schedule.png), [Reflect Calendar](Evidence/Phase2-1/Reflect-calendar.png), [sessions](Evidence/Phase2-1/Reflect-sessions.png), [Focus](Evidence/Phase2-1/Focus-reading.png).
The unrelated untracked `Docs/Investigations/CanonicalManuscriptArchitectureAssessment.md` remains untouched. Development is ready for review; physical Windows/Word qualification remains as explicitly listed above.

View File

@ -2,7 +2,7 @@ const {chromium}=require('playwright'),fs=require('node:fs'),assert=require('nod
const who=JSON.parse(fs.readFileSync(process.env.PD_PHASE21_IDENTITY)),s=JSON.parse(fs.readFileSync(process.env.PD_PHASE21_SCOPE)),base='https://dev.plotdirector.com',out=process.env.PD_PHASE21_SCREENSHOTS;
assert(who.Database==='PlotDirector_Development'&&/^pwa-browser-.*@example\.invalid$/.test(who.Email));
(async()=>{const browser=await chromium.launch();try{for(const pwa of [false,true]){const c=await browser.newContext({viewport:{width:1920,height:1100}});await c.addInitScript(({user,pwa})=>{localStorage.setItem('plotdirector.desktop.v1.'+user,JSON.stringify({dismissedAt:Date.now()}));if(pwa)Object.defineProperty(navigator,'standalone',{value:true});},{user:who.UserID,pwa});const p=await c.newPage(),errors=[];p.on('pageerror',e=>errors.push(e.message));await p.goto(base+'/Account/Login');await p.locator('[name=Email]').fill(who.Email);await p.locator('[name=Password]').fill(who.Password);await Promise.all([p.waitForURL('**/Projects'),p.locator('button[type=submit]').click()]);await p.goto(`${base}/Writer/Review?bookId=${s.book}&projectId=${s.project}&chapterId=${s.chapter}`);await p.locator('[data-review-panel]').waitFor();if(await p.locator('[data-ribbon-collapse]').getAttribute('aria-expanded')==='false')await p.locator('[data-ribbon-collapse]').click();assert(await p.locator('#reader-content').evaluate(n=>n.offsetHeight>innerHeight*2),'real long accepted chapter');
const shot=async(name,reset=true)=>{if(!out)return;fs.mkdirSync(out,{recursive:true});if(reset)await p.evaluate(()=>{scrollTo({top:0,behavior:'instant'});document.querySelectorAll('.writer21-notes').forEach(n=>n.scrollTop=0);});await p.waitForTimeout(300);if(!reset){const b=await p.locator('.writer21-manuscript').boundingBox();await p.mouse.move(b.x+b.width/2,600);await p.mouse.wheel(0,-40);await p.waitForTimeout(100);await p.mouse.wheel(0,40);await p.waitForTimeout(300);}await p.evaluate(()=>new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r))));const session=await c.newCDPSession(p);const capture=await session.send('Page.captureScreenshot',{format:'png',captureBeyondViewport:false,fromSurface:false});fs.writeFileSync(out+'/'+name+'-'+(pwa?'PWA':'browser')+'.png',Buffer.from(capture.data,'base64'));await session.detach();};
const shot=async(name,reset=true)=>{if(!out)return;fs.mkdirSync(out,{recursive:true});if(reset)await p.evaluate(()=>{scrollTo({top:0,behavior:'instant'});document.querySelectorAll('.writer21-notes').forEach(n=>n.scrollTop=0);});await p.waitForTimeout(300);if(!reset){const b=await p.locator('.writer21-manuscript').boundingBox();await p.mouse.move(b.x+b.width/2,600);await p.mouse.wheel(0,-40);await p.waitForTimeout(100);await p.mouse.wheel(0,40);await p.waitForTimeout(300);}await p.evaluate(()=>new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r))));const session=await c.newCDPSession(p);await session.send('Page.bringToFront');await p.waitForTimeout(500);const capture=await session.send('Page.captureScreenshot',{format:'png',captureBeyondViewport:false,fromSurface:true});fs.writeFileSync(out+'/'+name+'-'+(pwa?'PWA':'browser')+'.png',Buffer.from(capture.data,'base64'));await session.detach();};
await require('./review-layout-checks.cjs')(p,pwa,shot);
const form=p.locator('[data-review-form]');await p.locator('[data-review-new]').click();assert.equal(await form.locator('[name=Scope]').inputValue(),'','ambiguous scope is explicit');await form.locator('[data-review-cancel]').click();await p.locator('[data-review-scope-new=Chapter]').click();assert.equal(await form.evaluate(n=>n.closest('.writer21-notes').id),'review-chapter-notes');await form.locator('[data-review-cancel]').click();
assert.deepEqual(errors,[]);console.log('PASS deployed Review amendment '+(pwa?'simulated PWA':'browser')+': long chapter top/middle/bottom, permanent columns, both pointer and keyboard dividers, saved widths, independent notes scrolling, Focus restore, audio controls, diagnostics, explicit scope, four themes and responsive layouts');await c.close();}}finally{await browser.close();}})().catch(e=>{console.error(String(e.stack).replaceAll(who.Password,'[redacted]'));process.exitCode=1;});