diff --git a/Docs/Writer/Writer3/Help-Coverage.md b/Docs/Writer/Writer3/Help-Coverage.md index c40e7289..33508ad4 100644 --- a/Docs/Writer/Writer3/Help-Coverage.md +++ b/Docs/Writer/Writer3/Help-Coverage.md @@ -85,4 +85,10 @@ Existing workspace.overview now describes the preserved Writing desk at /Writer/ ## Phase 2B layout Help -`writer3.layout` uses the existing Markdown tag helper beside each split-destination heading. Covers pointer/keyboard resizing, minimum widths, collapse/restore, independent device preferences, responsive overlay/focus, storage failure and standalone-window separation. The five destination articles also explain the controls. Browser popup, PWA drawer and full article are qualification gates. +`writer3.layout` uses the existing Markdown tag helper beside the labelled layout controls on each split destination. Covers pointer/keyboard resizing, minimum widths, collapse/restore, independent device preferences, responsive overlay/focus, storage failure and standalone-window separation. The five destination articles also explain the controls. Browser popup, PWA drawer and full article are qualification gates. + +## Phase 2C Help review + +Destination Help remains at the heading. The layout tooltip/popup icon is grouped with Show/Hide companion and Layout Help, removing ambiguous adjacent heading icons. `writer3.layout` now explains browser modifier shortcuts, PWA Page Help with collapsed ribbon, and control locations. Five destination articles and Write session grouping are updated. Existing micro/quick/full content, popup, drawer and full article are exercised in rendered qualification. Standalone Context/Intent authority and media/accepted-text boundaries remain unchanged. + +Phase2C amendment: `writer3.write` explains the single working-focus selection, separate save/record/plan actions, actual objective/session mappings, explicit proofreading recording choice, recording-only activities, active-target differences and optional book-scoped planning. Existing working-context/session/native and planning Help remain authoritative; no data consolidation. diff --git a/Docs/Writer/Writer3/Implementation-Tracker.md b/Docs/Writer/Writer3/Implementation-Tracker.md index a2cef4a8..626ad77a 100644 --- a/Docs/Writer/Writer3/Implementation-Tracker.md +++ b/Docs/Writer/Writer3/Implementation-Tracker.md @@ -1,6 +1,6 @@ # Writer 3.0 implementation tracker -Baseline: `9a8b9a3`, shared branch `codex/word-companion-native-phase1-20261104`, 16 November 2026. The original kickoff authorised Phase 1 implementation and Development deployment; the master specification governs product direction even though its header says Proposed. The subsequent Phase2A kickoff explicitly authorised Home, navigation, destination shells and Development deployment; Phase2B was subsequently explicitly authorised for layout infrastructure and Development deployment; Phase2C remains unauthorised. No feature is retired. Unrelated investigation file is preserved. +Baseline: `9a8b9a3`, shared branch `codex/word-companion-native-phase1-20261104`, 16 November 2026. The original kickoff authorised Phase 1 implementation and Development deployment; the master specification governs product direction even though its header says Proposed. The subsequent Phase2A kickoff explicitly authorised Home, navigation, destination shells and Development deployment; Phase2B was subsequently explicitly authorised for layout infrastructure and Development deployment; Phase2C is explicitly authorised for inspection, bounded corrections and final Development qualification; Phase3 remains unauthorised. No feature is retired. Unrelated investigation file is preserved. ## Phase 1 screen and interaction states before implementation @@ -336,3 +336,7 @@ Home, five destination shells, Plan/Reflect Dashboard and contextual existing ri ## Phase 2B completion — 16 November 2026 Application `10bf9db9061fdec340acf7ff0df96f3dfd299814`, release `10bf9db-20261116T164516Z`. Shared viewport composition, pointer/keyboard split, collapse/restore, narrow overlay, per-actor/per-destination device preferences, compact Home spacing and existing-system layout Help delivered. No schema, author-story-data, native protocol or standalone-window changes. Build0warnings/errors; full harness584 PASS; isolated and authenticated Development workspace matrices200 cases each; navigation168 cases; legacy desk48 cases; Reader/Intent/native-follow/reference/audio preservation passed. Live scoped author-data hashes identical; fixture account/projects removed. DLL hash/metadata matched; service active, TLS GET200, warning journal clear. Physical Windows/installed PWA/real media/multi-monitor and assistive-technology checks remain manual. [Phase2B report and screenshots](Phase2B-Report.md). Phase2C not started. + +## Phase 2C authorised scope + +[Observed issue register](Phase2C-Issues.md). Pre-change authenticated Development capture complete; correcting observed Explore marker wrapping, collapsed reading widths, Help placement, session hierarchy and modified-key interception. Reuse current routes/ribbon/workspace and storage. No future feature integration. Full regression, browser matrices and Development acceptance pending. Phase3 not started. diff --git a/Docs/Writer/Writer3/Phase2C-Issues.md b/Docs/Writer/Writer3/Phase2C-Issues.md new file mode 100644 index 00000000..6a15c7a3 --- /dev/null +++ b/Docs/Writer/Writer3/Phase2C-Issues.md @@ -0,0 +1,27 @@ +# Phase 2C inspection and issue register + +Baseline: deployed10bf9db / source01c1197. Authenticated Development renders captured **before any layout changes** using a disposable author and saved scene, at1440×900,1024×900,390×844, Home and all five destinations; Write/Explore expanded/collapsed or narrow overlay variants. Existing six-screen mockup used for hierarchy/density, not literal controls. No horizontal/vertical document overflow in the18 baseline normal states. Before screenshots and geometry are retained in Phase2C evidence. + +| Issue | Evidence | Bounded correction | +|---|---|---| +| Explore number01 breaks into two lines at1024px | before/Explore-1024.png | Non-shrinking two-character marker; allow adjacent copy to wrap | +| Collapsed Write session descriptions/rules span the entire wide panel | before/Write-1440-collapsed.png | Limit content reading width while allowing the panel to use available space | +| Two anonymous Help icons beside destination title, plus separate Layout Help | before/Write-1440.png; same across destinations | Move existing Markdown layout Help icon beside labelled layout controls; retain destination Help at heading and existing drawer button | +| Session activity selector competes with saved focus without its own heading | before/Write-1440.png | Label the existing always-available session group; preserve DOM/controls and semantics | +| Divider consumes modified Left/Right including Alt+Left browser history | before-modifier.log: browserHistoryShortcutPrevented=true | Reserve only unmodified/Shift arrows for resizing; leave Ctrl/Alt/Meta navigation to browser/OS | + +Home cards are balanced, aligned, dominant and fit the desktop viewport; preserve them. Plan, Review and Reflect have clear primary actions and appropriate empty/evidence copy; apply shared utility/readability corrections only. Tall panels reflect viewport allocation, not permission to fill empty space with unrelated content. No mock insights, new planning engine, guided exploration or integrated Context/Intent editing. + +Qualification: existing matrices plus targeted rendered checks for marker wrapping, Help placement, reading width, modified-key preservation, reduced motion, independent panel scrolling, overlay tab exit and active audio-control reachability. Physical Windows/installed PWA/media/multiple-monitor acceptance remains manual. + +## Additional authorised Current Work correction + +The user’s mid-batch amendment identifies duplicated objective and session activity/chapter selectors, especially in the empty/edit state. Integrate into2C before qualification/deployment; retain completed visual work and shared branch. + +One editor now chooses activity/chapter/optional scene. Save working focus uses existing SaveObjective only. Record this session bridges that selection to the unchanged WriterWork session-start implementation, with its antiforgery, busy guard, stable retry UUID and canonical SQL. Plan writing time is an optional GET to the book-scoped planner with a validated activity-derived goal category, without saving/recording. Existing schedule chapter/scene allocation remains there; no new scene scheduling engine. + +Actual objective activities from WriterObjective model/SQL: Drafting, Revising, Editing, Researching, Proofreading. Actual session kinds from WriterWork controller/SQL: Writing, Editing, Planning, Reading, AudioReview. Preserve established Drafting→Writing, Revising/Editing→Editing and Researching→Planning adapters, and announce the recording type. Proofreading has no automatic adapter: require explicit Editing or Reading choice. Planning/Reading/AudioReview are recording-only options and cannot be saved to objective storage. AudioReview still requires a chapter. + +Saved focus is read-only on return, with a Change action and optional recording/planning actions. New Write renders no duplicate session selectors. Existing active controls remain in the same client-owned DOM and show actual activity/chapter; explicit text distinguishes the active recording from saved focus. Objective edits do not issue a session retarget. Legacy desk and other independent session entry points remain unchanged. No database consolidation, migration or native protocol change. + +Qualification also caught a tooltip overlay intercepting adjacent layout controls after regrouping; the existing tooltip receives a scoped non-interactive class, while the interactive Help popup/article are unchanged. Visual inspection of the unified form caught its inherited white-on-gold Save label; scoped existing theme tokens now provide the correct foreground, with an explicit four-theme contrast assertion. Neither correction changes global Help or button styling. diff --git a/PlotLine.Tests/Browser/writer3-focus-live.cjs b/PlotLine.Tests/Browser/writer3-focus-live.cjs new file mode 100644 index 00000000..9bc7f58c --- /dev/null +++ b/PlotLine.Tests/Browser/writer3-focus-live.cjs @@ -0,0 +1,15 @@ +// Explicit writes only to the supplied dedicated disposable Development fixture. +const{chromium}=require('playwright'),assert=require('node:assert/strict'),fs=require('node:fs'); +(async()=>{const w=JSON.parse(fs.readFileSync(process.env.PD_WRITER3_IDENTITY));assert(w.Database==='PlotDirector_Development'&&w.Email.endsWith('@example.invalid'));const b=await chromium.launch();try{for(const pwa of[false,true]){const c=await b.newContext({viewport:{width:1440,height:900}});await c.addInitScript(id=>localStorage.setItem('plotdirector.desktop.v1.'+id,JSON.stringify({dismissedAt:Date.now()})),w.UserID);if(pwa)await c.addInitScript(()=>Object.defineProperty(navigator,'standalone',{value:true}));const p=await c.newPage(),base='https://dev.plotdirector.com',url=`${base}/Writer/Write?projectId=${w.project}&bookId=${w.book}`; +await p.goto(base+'/Account/Login');await p.locator('[name=Email]').fill(w.Email);await p.locator('[name=Password]').fill(w.Password);await Promise.all([p.waitForURL('**/Projects'),p.locator('button[type=submit]').click()]);const state=async()=>await(await p.request.get(`${base}/Writer/Work/State?bookId=${w.book}`)).json(); +await p.goto(url+'&setup=true');await p.locator('[data-focus-activity]').selectOption('Drafting');await p.locator('[data-objective-chapter]').selectOption(String(w.chapter));await p.locator('[data-objective-scene]').selectOption(String(w.scene));await Promise.all([p.waitForURL(u=>u.pathname==='/Writer/Write'&&!u.searchParams.has('setup')),p.locator('[data-save-focus]').click()]);assert.equal((await state()).session,null,'save does not start session');assert(await p.getByRole('link',{name:'Open current scene',exact:true}).isVisible()); +await p.locator('[data-record-focus]:enabled').waitFor();await p.locator('[data-record-focus]').click();await p.locator('[data-work-current]:visible').waitFor();const active=(await state()).session;assert.equal(active.kind,'Writing');assert.equal(active.chapterID,w.chapter); +await p.goto(url+'&setup=true');await p.locator('[data-work-current]:visible').waitFor();assert(await p.locator('[data-record-focus]').isHidden());await p.locator('[data-objective-chapter]').selectOption('');await p.locator('[data-focus-activity]').selectOption('Editing');await Promise.all([p.waitForURL(u=>u.pathname==='/Writer/Write'&&!u.searchParams.has('setup')),p.locator('[data-save-focus]').click()]);await p.locator('[data-focus-session-difference]:visible').waitFor();assert((await p.locator('[data-focus-session-difference]').textContent()).includes('differs'));assert.equal((await state()).session.sessionID,active.sessionID);assert.equal((await state()).session.chapterID,w.chapter); +await p.locator('[data-work-note]').fill('Disposable unified workflow acceptance note');await p.locator('[data-work-end]').click();await p.locator('[data-work-current]').waitFor({state:'hidden'});assert.equal((await state()).session,null); +// Canonical endpoint rejects impossible scene/chapter combinations and unsupported objective activities. +const token=await p.locator('[data-work-start] [name=__RequestVerificationToken]').inputValue();for(const fields of[{Activity:'Editing',ChapterID:'',SceneID:String(w.scene)},{Activity:'AudioReview',ChapterID:String(w.chapter),SceneID:''}]){const response=await p.request.post(base+'/Writer/SaveObjective',{form:{__RequestVerificationToken:token,BookID:String(w.book),...fields}});assert.equal(response.status(),200);assert(response.url().includes('setup=True')||response.url().includes('setup=true'));} +await p.goto(url);assert.equal(await p.getByRole('link',{name:'Open current scene',exact:true}).count(),0,'invalid submissions preserve valid whole-book focus');assert.equal((await state()).session,null); +assert.equal((await p.request.post(base+'/Writer/SaveObjective',{form:{BookID:String(w.book),Activity:'Drafting'}})).status(),400,'antiforgery retained'); +await p.goto(url+'&setup=true');await p.locator('[data-focus-activity]').selectOption('Editing');await p.locator('[data-plan-focus]').click();await p.waitForURL('**/Writer/ScheduleSetup?*');assert.equal(new URL(p.url()).searchParams.get('bookId'),String(w.book));assert.equal(await p.locator('[name=GoalType]').inputValue(),'Revision');assert.equal((await state()).session,null); +await p.goto(url+'&setup=true');await p.locator('[data-focus-activity]').selectOption('Revising');await p.locator('[data-objective-chapter]').selectOption(String(w.chapter));await p.locator('[data-objective-scene]').selectOption(String(w.scene));await Promise.all([p.waitForURL(u=>u.pathname==='/Writer/Write'&&!u.searchParams.has('setup')),p.locator('[data-save-focus]').click()]);await c.close();} +console.log('PASS authenticated Development unified workflow: real objective create/change, explicit Writing session, active target/ID isolation, note/end, invalid scene and unsupported objective rejection, antiforgery400, optional scoped revision planning; fixture focus restored; browser/simulated PWA.');}finally{await b.close()}})().catch(e=>{console.error(e.message);process.exitCode=1}); diff --git a/PlotLine.Tests/Browser/writer3-focus.cjs b/PlotLine.Tests/Browser/writer3-focus.cjs new file mode 100644 index 00000000..1d84c9f9 --- /dev/null +++ b/PlotLine.Tests/Browser/writer3-focus.cjs @@ -0,0 +1,18 @@ +const{chromium}=require('playwright'),assert=require('node:assert/strict'); +(async()=>{const b=await chromium.launch();try{for(const pwa of[false,true]){ +const c=await b.newContext({viewport:{width:1440,height:900}});await c.addInitScript(()=>localStorage.setItem('plotdirector.desktop.v1.4',JSON.stringify({dismissedAt:Date.now()})));if(pwa)await c.addInitScript(()=>Object.defineProperty(navigator,'standalone',{value:true})); +let session=null,starts=[],saves=[],blockStart=null;await c.route('**/Writer/Work/**',async r=>{const action=new URL(r.request().url()).pathname.split('/').pop();if(action==='State')return r.fulfill({json:{session,defaultPauseOnEdit:true}});const d=Object.fromEntries(new URLSearchParams(r.request().postData()));assert(d.__RequestVerificationToken);if(action==='Start'){starts.push(d);if(blockStart)await blockStart;session={sessionID:d.requestId,kind:d.kind,chapterID:Number(d.chapterId)||null,chapterTitle:d.chapterId==='22'?'The harbour':'The crossing',startedUtc:new Date().toISOString(),engagedSeconds:0,playbackSeconds:0,uniqueSeconds:0,pauseOnEdit:true,live:false,sequence:0};}if(action==='End')session=null;await r.fulfill({status:200,body:''});}); +await c.route('**/Writer/SaveObjective',async r=>{saves.push(Object.fromEntries(new URLSearchParams(r.request().postData())));assert(saves.at(-1).__RequestVerificationToken);await r.fulfill({status:200,contentType:'text/html',body:'
Working focus saved by fixture
'});}); +const p=await c.newPage(),errors=[];p.on('pageerror',e=>errors.push(e.message));const url='http://127.0.0.1:5238/Writer/Write?projectId=7&bookId=12'; +await p.goto(url);await p.locator('[data-record-focus]:enabled').waitFor();for(const theme of ['modern-dark','modern-light','warm-dark','plotdirector']){await p.evaluate(t=>window.PlotDirectorApplyApplicationTheme(t),theme);await p.locator('[data-save-focus]').screenshot({animations:'disabled'});const contrast=await p.locator('[data-save-focus]').evaluate(n=>{const lum=s=>s.match(/[\d.]+/g).slice(0,3).map(Number).map(x=>{x/=255;return x<=.04045?x/12.92:((x+.055)/1.055)**2.4}).reduce((v,x,i)=>v+x*[.2126,.7152,.0722][i],0),c=getComputedStyle(n),a=lum(c.color),b=lum(c.backgroundColor);return(Math.max(a,b)+.05)/(Math.min(a,b)+.05)});assert(contrast>=4.5,'Save focus label contrast '+theme);} +assert.equal(await p.locator('select[name=ChapterID]').count(),1);assert.equal(await p.locator('[data-work-start] select').count(),0,'one chapter/activity selection');assert.equal(await p.locator('[data-focus-activity]').count(),1); +await p.locator('[data-objective-chapter]').selectOption('21');await p.locator('[data-objective-scene]').selectOption('31');await p.locator('[data-objective-chapter]').selectOption('22');assert.equal(await p.locator('[data-objective-scene]').inputValue(),'');assert(await p.locator('[data-objective-scene] option[value="31"]').evaluate(n=>n.disabled));await p.locator('[data-objective-scene]').selectOption('32'); +await p.locator('[data-save-focus]').click();assert.equal(saves.length,1);assert.equal(saves[0].ChapterID,'22');assert.equal(saves[0].SceneID,'32');assert.equal(starts.length,0,'saving never starts recording'); +await p.goto(url+'&objective=true');assert.equal(await p.locator('[data-focus-form]').count(),0,'saved focus is read-only by default');assert(await p.getByRole('link',{name:'Change working focus'}).isVisible());await p.locator('[data-record-focus]:enabled').waitFor();let release;blockStart=new Promise(r=>release=r);await p.locator('[data-record-focus]').click();await p.locator('[data-record-focus]').dispatchEvent('click');release();blockStart=null;await p.locator('[data-work-current]:visible').waitFor();assert.equal(starts.length,1);assert.equal(starts[0].chapterId,'21');assert.equal(starts[0].kind,'Editing');assert.equal(saves.length,1,'recording never saves objective');assert(await p.locator('[data-record-focus]').isHidden()); +const activeId=session.sessionID;await p.goto(url+'&objective=true&setup=true');await p.locator('[data-work-current]:visible').waitFor();await p.locator('[data-objective-chapter]').selectOption('22');assert.equal(session.sessionID,activeId);assert.equal(session.chapterID,21);assert(await p.locator('[data-record-focus]').isHidden()); +session={...session,chapterID:22,chapterTitle:'The harbour',kind:'Writing'};await p.reload();await p.locator('[data-focus-session-difference]:visible').waitFor();assert((await p.locator('[data-focus-session-difference]').textContent()).includes('differs'));assert((await p.locator('[data-work-bound]').textContent()).includes('The harbour')); +session=null;await p.goto(url+'&setup=true');await p.locator('[data-record-focus]:enabled').waitFor();await p.locator('[data-focus-activity]').selectOption('Proofreading');await p.locator('[data-record-focus]').click();assert.equal(starts.length,1);assert(await p.locator('[data-record-kind-choice]').isVisible());await p.locator('[data-record-kind]').selectOption('Reading');await p.locator('[data-record-focus]').click();await p.locator('[data-work-current]:visible').waitFor();assert.equal(starts.at(-1).kind,'Reading'); +session=null;await p.goto(url+'&setup=true');await p.locator('[data-record-focus]:enabled').waitFor();await p.locator('[data-focus-activity]').selectOption('AudioReview');assert(await p.locator('[data-save-focus]').isDisabled());await p.locator('[data-record-focus]').click();assert.equal(starts.length,2,'Audio Review requires chapter');await p.locator('[data-objective-chapter]').selectOption('21');await p.locator('[data-record-focus]').click();await p.locator('[data-work-audio]:visible').waitFor();assert.equal(starts.at(-1).kind,'AudioReview'); +session=null;await p.goto(url+'&setup=true');await p.locator('[data-focus-activity]').selectOption('Editing');await p.locator('[data-plan-focus]').click();await p.waitForURL('**/Writer/ScheduleSetup?*');assert.equal(new URL(p.url()).searchParams.get('bookId'),'12');assert.equal(new URL(p.url()).searchParams.get('focusActivity'),'Editing');assert.equal(saves.length,1);assert.equal(starts.length,3); +await p.goto(url+'&setup=true');await p.locator('#appBookMenu').click();await p.locator('[data-app-book-choice="13"]').click();await p.waitForURL('**bookId=13*');assert.equal(await p.locator('[data-objective-chapter] option[value="21"]').count(),0);assert.equal(await p.locator('[data-objective-scene]').inputValue(),'');assert.deepEqual(errors,[]);await c.close();} +console.log('PASS unified current work: one selector set, save-only, explicit recording/idempotent repeat, saved display/change, active/mismatched targets, explicit proofreading choice, AudioReview chapter rule, dependent scenes, optional scoped scheduling and book-switch clearing in browser/simulated PWA.');}finally{await b.close()}})().catch(e=>{console.error(e.stack);process.exitCode=1}); diff --git a/PlotLine.Tests/Browser/writer3-refinement.cjs b/PlotLine.Tests/Browser/writer3-refinement.cjs new file mode 100644 index 00000000..361347e2 --- /dev/null +++ b/PlotLine.Tests/Browser/writer3-refinement.cjs @@ -0,0 +1,22 @@ +const{chromium}=require('playwright'),assert=require('node:assert/strict'),fs=require('node:fs'); +const live=!!process.env.PD_WRITER3_IDENTITY,w=live?JSON.parse(fs.readFileSync(process.env.PD_WRITER3_IDENTITY)):null,base=live?'https://dev.plotdirector.com':'http://127.0.0.1:5238';if(live)assert(w.Database==='PlotDirector_Development'&&w.Email.endsWith('@example.invalid')); +const url=d=>`${base}/Writer/${d}?projectId=${w?.project||7}&bookId=${w?.book||12}${live?'':'&objective=true&populated=true'}`; +const settle=p=>p.evaluate(()=>new Promise(r=>requestAnimationFrame(()=>requestAnimationFrame(r)))); +(async()=>{const b=await chromium.launch();try{for(const pwa of[false,true]){ +const c=await b.newContext({viewport:{width:1440,height:900},reducedMotion:'reduce'});if(pwa)await c.addInitScript(()=>Object.defineProperty(navigator,'standalone',{value:true}));await c.addInitScript(id=>localStorage.setItem('plotdirector.desktop.v1.'+id,JSON.stringify({dismissedAt:Date.now()})),w?.UserID||4);const p=await c.newPage(),errors=[];p.on('pageerror',e=>errors.push(e.message)); +if(live){await p.goto(base+'/Account/Login');await p.locator('[name=Email]').fill(w.Email);await p.locator('[name=Password]').fill(w.Password);await Promise.all([p.waitForURL('**/Projects'),p.locator('button[type=submit]').click()]);} +else await c.route('**/Writer/Work/State?*',r=>r.fulfill({json:{session:null,defaultPauseOnEdit:true}})); +for(const d of['Write','Explore','Plan','Review','Reflect']){ +await p.goto(url(d));await settle(p);assert.equal(await p.locator('.writer3-title [data-help-key="writer3.layout"]').count(),0,'heading has destination Help only');assert(await p.locator('.writer3-layout-tools [data-help-key="writer3.layout"]').isVisible()); +const sep=p.getByRole('separator',{name:'Resize contextual companion'});assert(await sep.evaluate(n=>{for(const modifier of['altKey','ctrlKey','metaKey']){const e=new KeyboardEvent('keydown',{key:'ArrowLeft',[modifier]:true,bubbles:true,cancelable:true});n.dispatchEvent(e);if(e.defaultPrevented)return false;}return true;}),'browser/OS modified shortcuts remain available'); +await p.locator('.writer3-layout-tools button').first().click();const measures=await p.locator('.writer3-main').evaluate(n=>({width:n.clientWidth,max:Math.max(...[...n.children].map(x=>x.getBoundingClientRect().width))}));assert(measures.max