From d9559713a5beef504f9ca595a8287693c8056256 Mon Sep 17 00:00:00 2001 From: Nick Beckley Date: Sun, 22 Nov 2026 17:44:29 +0000 Subject: [PATCH] Qualify Context refinements across live editing, navigation and touch --- Docs/Writer/Context-UX-Refinement-20261122.md | 21 +++++++++++++++++++ .../Browser/context-live-editing.cjs | 4 ++-- .../context-refine-live-navigation.cjs | 2 +- PlotLine.Tests/Browser/context-touch.cjs | 2 +- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Docs/Writer/Context-UX-Refinement-20261122.md b/Docs/Writer/Context-UX-Refinement-20261122.md index 219a731c..9d8a56b6 100644 --- a/Docs/Writer/Context-UX-Refinement-20261122.md +++ b/Docs/Writer/Context-UX-Refinement-20261122.md @@ -45,3 +45,24 @@ User explicitly approved a canonical deceased-status field in response to the da Database qualification: migration300 applied after verified backup `context-refine-stage3-20261122T170555Z.bak`. Life-status backup `context-refine-life-20261122T173415Z.bak` succeeded and VERIFYONLY passed. Migration301 installed the nullable field and save/read procedures, then stopped on differently formatted deployed projection headers. Migration302 stopped before projection changes because of a malformed comment. Both attempts are preserved unchanged. Forward303 completed projections, and standalone idempotent **304_CharacterLifeStatusCanonical.sql** consolidates the complete authorised definition for future environments. Use 304 directly for this field, not a blind replay of 301–303. Exact Character_Save preflight matched authoritative previous logic; all projection anchors were checked before applying. Final schema/procedure smoke passed. Transactional tests proved nullable CAS rejects stale saves, legacy full saves preserve status, explicit full-editor saves update it, and rollback leaves all canonical statuses unrecorded. No real manuscript records changed. Stage 3 qualification: solution build zero warnings/errors; 10 visual-domain assertions, 12 focused relationship assertions and 21 character/name/life-status assertions passed. Layout tests cover four generations, multiple spouses, half-siblings, adoption/step/Child reversal, unknown/cyclic/cross-generation records, reliable birth order and 120 nonoverlapping nodes; Story sizes 1–128 are checked for nonoverlap. Actual compiled Razor browser passed SVG hit selection, source-specific modal, 120-node family, dense 45-edge network, scene changes, independent panes, full/half/stacked/mobile, keyboard pan/zoom, read-only controls, and zero family layout recalculations on state-only notification. Family death indicator and Story omission are tested. Full integration and actual Development persistence follow installation. + +Stage 3 deployed at `01a7723`, archive `context-refine-stage3-01a7723-20261122T173935Z`. Clean active-job guard immediately before restart; local/public HTTP200; informational assembly commit and SHA-256 assembly/graph/form/navigation/CSS matches verified. Actual Development browser passed single-field life-status persistence, Family-only DTO status, Story omission and restoration of the original value on the disposable character. Relationship create/correction and selected-link refresh in a second authenticated browser session passed, with zero receiving success toasts, one native SignalR connection per Context and no Word navigation. Other real manuscript data was not edited. + +## Stage 4: integrated qualification and final delivery + +Full executable regression harness completed successfully with **748 PASS lines and exit0**. Final solution build passed with zero warnings/errors. Full harness includes the new Family/Story, character life-status and existing relationship/Names/routing/permissions/backup contracts. Compiled-browser acceptance passed all nine character/name modal variants plus relationship at desktop/mobile, one Save/Cancel, Escape, main-shell reuse/unsaved guard and bounded fallback. Names browser covered all criteria, 100 results, profiles/related forms/copy, usage/identity corrections, pagination, independent panes and full/half/stacked/narrow layouts. The live main/Context Names parity suite passed all ten equivalent queries again on this release, including unused-in-the-empty-other-book behaviour. + +Real-SignalR My Windows acceptance passed exact recipient/pane-only reload, no-handler behaviour, cross-user/book/story-point rejection and reconnect recovery. Actual Development navigation passed all four main workspaces with no extra window, no Context scene change and no Word navigation. Browser test adjustments use SVG attachment for zero-width vertical edge groups and dismiss the existing navigation toast through its normal accessible button before a later footer click; no forced clicks or product guard bypasses. Actual Development editing passed description/alias persistence, cancel/unsaved handling, retained failed inline name draft, life status, relationship correction, quiet second-window refresh and one connection per Context. + +Chromium touch emulation at 390px passed character/name disclosure taps, graph person selection, zoom buttons, real CDP touch drag and two-finger pinch, Family/Story switching and no document horizontal overflow. Full/half/stacked/mobile graph cases retain legible fixed node dimensions; complex family/network interactions were exercised rather than only HTML assertions. Visual review shortened graph captions and corrected selected-lens contrast using existing theme tokens. Physical phone/tablet, installed PWA/windowing differences and assistive-technology review remain manual acceptance items; no physical-device or PWA-installation claim is made. + +Development journal since Stage3 restart had zero error categories and only the existing HTTPS-redirection warning. Final Stage4 release records its source commit, archive, pre-restart guard and published/live hashes in deployment evidence. Existing open windows should reload once to receive the new modules. Production was not accessed or modified. The two original untracked investigation documents were preserved. + +### Practical limits / remaining manual acceptance + +- Browser focus is discretionary. Private/storage-isolated profiles cannot locate another profile's main window and use one named fallback; physical devices are never selected automatically. +- Author-reference Family truth and global life status can reveal author knowledge. Story excludes global death status and later narrative developments; reliable death-at-scene/POV knowledge is not modelled or invented. +- Inspect a representative author-owned complex family and dense scene for editorial readability. Ambiguous canonical/cyclic types are labelled; very large views use explicit bounds and recenter/expand rather than loading every record. +- Physical-device touch, installed desktop/mobile PWA behaviour and screen-reader acceptance remain manual. + +Key acceptance logs on this host: `/tmp/context-refine-stage4-regression.log`, `context-refine-stage4-build.log`, `context-refine-stage3-polish-browser.log`, `context-refine-stage3-shared-browser.log`, `context-refine-stage4-touch.log`, `context-refine-stage4-names-browser.log`, `context-refine-stage4-names-parity.log`, `context-refine-stage4-windows.log`, `context-refine-stage4-navigation-final.log`, `context-refine-stage4-live-editing-final.log`. These contain no credentials. SQL backup verification is not claimed as a restore test; life-status compatibility was checked by canonical JSON roundtrip, stored-field harness contracts and rollback-protected SQL save smoke. diff --git a/PlotLine.Tests/Browser/context-live-editing.cjs b/PlotLine.Tests/Browser/context-live-editing.cjs index ffea883b..7e926509 100644 --- a/PlotLine.Tests/Browser/context-live-editing.cjs +++ b/PlotLine.Tests/Browser/context-live-editing.cjs @@ -16,10 +16,10 @@ const {chromium}=require('playwright'),fs=require('node:fs'),assert=require('nod step='live inline validation retains failed draft';await p.locator(`[data-context-edit="name"][data-character-id="${id}"]`).click();await p.waitForSelector('[data-context-edit-form]');await p.locator('[name=Value]').fill('');await p.locator('[data-context-edit-form] [type=submit]').click();await p.waitForSelector('.validation-summary-errors');assert(await p.locator('[data-context-edit-dialog]').isVisible());assert.equal(await p.locator('[name=Value]').inputValue(),'');p.once('dialog',d=>d.accept());await p.click('[data-context-edit-cancel]'); if(process.env.PD_CONTEXT_RELATIONSHIPS==='1'){ step='live one-relationship create and correction';await p.selectOption('[data-context-tab]','relationships');await remote.selectOption('[data-context-tab]','relationships');await p.waitForSelector('[data-context-relationships]');await remote.waitForSelector('[data-context-relationships]'); - await p.locator('[data-relationship-lens="story"]').click();await remote.locator('[data-relationship-lens="story"]').click();await p.waitForSelector('[data-graph-node]'); + await p.locator('[data-relationship-lens="story"]').click();await remote.locator('[data-relationship-lens="story"]').click();await p.waitForFunction(()=>document.querySelector('[data-relationship-caption]')?.textContent.includes('Later developments are excluded'));await remote.waitForFunction(()=>document.querySelector('[data-relationship-caption]')?.textContent.includes('Later developments are excluded')); const existing=p.locator('[data-graph-edge]');if(await existing.count()===0){await p.locator('[data-relationship-add]').click();await p.waitForSelector('[data-context-edit-form]');await p.selectOption('[name=SourceID]',String(s.characters[0]));await p.selectOption('[name=TargetID]',String(s.characters[1]));const type=await p.locator('[name=TypeID] option').evaluateAll(ns=>ns.find(n=>n.value&&!n.textContent.includes('Family'))?.value);await p.selectOption('[name=TypeID]',type);const state=await p.locator('[name=StateID] option').evaluateAll(ns=>ns.find(n=>n.value)?.value);await p.selectOption('[name=StateID]',state);await p.locator('[name=Notes]').fill('Synthetic relationship evidence');await save();} async function selectConnection(page){await page.locator(`[data-graph-node="${id}"]`).click();await page.locator('[data-relationship-details] details summary').click();await page.locator('[data-inspect-connection]').first().click();} - await p.waitForSelector('[data-graph-edge]');await remote.waitForSelector('[data-graph-edge]');await selectConnection(p);await selectConnection(remote);await p.locator('[data-relationship-details] [data-context-relationship-edit="scene"]').click();await p.waitForSelector('[data-context-edit-form]');const note='Synthetic relationship correction '+Date.now();await p.locator('[name=Notes]').fill(note);await save();await remote.waitForFunction(note=>document.querySelector('[data-context-relationships]').textContent.includes(note),note);assert.equal(await remote.evaluate(()=>successes),0); + step='live relationship SVG ready';await p.waitForSelector('[data-graph-edge]',{state:'attached'});await remote.waitForSelector('[data-graph-edge]',{state:'attached'});await selectConnection(p);await selectConnection(remote);step='live relationship save modal';await p.locator('[data-relationship-details] [data-context-relationship-edit="scene"]').click();await p.waitForSelector('[data-context-edit-form]');const note='Synthetic relationship correction '+Date.now();await p.locator('[name=Notes]').fill(note);await save();step='live relationship remote update';await remote.waitForFunction(note=>document.querySelector('[data-context-relationships]').textContent.includes(note),note);assert.equal(await remote.evaluate(()=>successes),0); } assert(counts.every(c=>c.word===0&&c.hub===1));console.log('PASS Development canonical editing: focused persisted values, cancel/unsaved protection, alias add, failed inline name draft retained, one local success/quiet second authenticated session, one connection each, no Word navigation'+(process.env.PD_CONTEXT_RELATIONSHIPS==='1'?', relationship create/correct persisted through existing services':'')); diff --git a/PlotLine.Tests/Browser/context-refine-live-navigation.cjs b/PlotLine.Tests/Browser/context-refine-live-navigation.cjs index 19e84717..21088832 100644 --- a/PlotLine.Tests/Browser/context-refine-live-navigation.cjs +++ b/PlotLine.Tests/Browser/context-refine-live-navigation.cjs @@ -2,6 +2,6 @@ const {chromium}=require('playwright'),fs=require('node:fs'),assert=require('node:assert/strict'); (async()=>{assert(process.env.PD_CONTEXT_IDENTITY&&process.env.PD_CONTEXT_SCOPE);const who=JSON.parse(fs.readFileSync(process.env.PD_CONTEXT_IDENTITY)),s=JSON.parse(fs.readFileSync(process.env.PD_CONTEXT_SCOPE));assert.equal(who.Database,'PlotDirector_Development');assert.equal(who.UserID,s.user);assert(who.Email.startsWith('pwa-browser-'));const b=await chromium.launch();let step='login';try{const c=await b.newContext({viewport:{width:1366,height:900}}),main=await c.newPage();await main.goto('https://dev.plotdirector.com/Account/Login');await main.locator('[name=Email]').fill(who.Email);await main.locator('[name=Password]').fill(who.Password);await Promise.all([main.waitForURL(u=>u.pathname!='/Account/Login'),main.locator('button[type=submit]').click()]);await main.goto('https://dev.plotdirector.com/Projects/Details/'+s.project);let word=0;c.on('request',r=>{if(/\/(Writing\/Context|WriterWord)\/Navigate/.test(new URL(r.url()).pathname))word++;});const p=await c.newPage();await p.goto(`https://dev.plotdirector.com/Writing/Context?projectId=${s.project}&bookId=${s.book}&sceneId=${s.scene}`);await p.waitForSelector('[data-context-tab-fragment]');await p.waitForFunction(book=>document.querySelector('[data-context-workspace]').contextController.connection?.state==='Connected'&&document.querySelector('[data-context-workspace]').contextController.connection.invoke('MyContextWindows',book).then(rows=>rows.some(r=>r.kind==='main'&&r.environmentID===window.PlotDirectorContextEnvironment)),s.book); const count=c.pages().length;step='scene editor in existing main';await p.click('[data-context-editor]');await main.waitForURL(u=>u.pathname==='/Scenes/Edit/'+s.scene);assert.equal(c.pages().length,count); - for(const [tool,button,path] of [['characters',`[data-context-workspace-target="characters"][data-context-entity="${s.characters[0]}"]`,'/Characters/Details/'+s.characters[0]],['names','[data-context-workspace-target="names"]','/Names'],['relationships','[data-context-workspace-target="relationships"]','/RelationshipMap']]){step=tool+' existing-main reuse';await p.selectOption('[data-context-tab]',tool);await p.waitForSelector('[data-context-tab-fragment]');if(tool==='characters'){const row=p.locator(`[data-context-character="${s.characters[0]}"]`);if(!await row.evaluate(n=>n.open))await row.locator('summary').click();}await p.waitForTimeout(600);await p.locator(button).last().click();await main.waitForURL(u=>u.pathname===path);assert.equal(c.pages().length,count);} + for(const [tool,button,path] of [['characters',`[data-context-workspace-target="characters"][data-context-entity="${s.characters[0]}"]`,'/Characters/Details/'+s.characters[0]],['names','[data-context-workspace-target="names"]','/Names'],['relationships','[data-context-workspace-target="relationships"]','/RelationshipMap']]){step=tool+' existing-main reuse';await p.selectOption('[data-context-tab]',tool);await p.waitForSelector('[data-context-tab-fragment]');if(tool==='characters'){const row=p.locator(`[data-context-character="${s.characters[0]}"]`);if(!await row.evaluate(n=>n.open))await row.locator('summary').click();}await p.waitForTimeout(600);for(const toast of await p.locator('.pd-toast button[aria-label^="Dismiss"]').all())await toast.click();await p.locator(button).last().click();await main.waitForURL(u=>u.pathname===path);assert.equal(c.pages().length,count);} assert.equal(word,0);assert.equal(await p.locator('[data-context-scene]').inputValue(),String(s.scene));console.log('PASS Development main-window navigation: actual scene, character, Names and Relationships editors reused one existing main window; Context scene and Word position unchanged. Browser focus remains discretionary.'); } catch(e){console.error('FAILED '+step+': '+e.message);process.exitCode=1;}finally{await b.close();}})(); diff --git a/PlotLine.Tests/Browser/context-touch.cjs b/PlotLine.Tests/Browser/context-touch.cjs index 494db63a..6c3a2695 100644 --- a/PlotLine.Tests/Browser/context-touch.cjs +++ b/PlotLine.Tests/Browser/context-touch.cjs @@ -1,2 +1,2 @@ const {chromium}=require('playwright'),fs=require('node:fs'),path=require('node:path'),assert=require('node:assert/strict');const base=process.env.PD_BROWSER_BASE||'http://127.0.0.1:5238'; -(async()=>{const b=await chromium.launch();try{const c=await b.newContext({viewport:{width:390,height:844},isMobile:true,hasTouch:true,deviceScaleFactor:2});await c.route('**/cdn.jsdelivr.net/**signalr*',r=>r.fulfill({contentType:'application/javascript',body:fs.readFileSync(path.join(__dirname,'node_modules/@microsoft/signalr/dist/browser/signalr.min.js'))}));await c.route('**/native-companion/status',r=>r.fulfill({json:[]}));await c.route('**/native-companion/connection-state',r=>r.fulfill({json:{known:false}}));await c.route('**/Writing/Context/Position?*',r=>r.fulfill({json:{connected:false}}));await c.route('**/Writing/Context/Tabs/*',async r=>{const u=new URL(r.request().url());await r.fulfill({response:await r.fetch({url:base+'/context-tab-fixture/'+u.pathname.split('/').at(-1)+u.search})});});await c.route('**/Writing/Context/Relationships/Graph?*',async r=>{const u=new URL(r.request().url());await r.fulfill({response:await r.fetch({url:base+'/context-lenses-fixture'+u.search})});});const p=await c.newPage();await p.goto(base+'/Writing/Context');for(const tool of ['characters','names','relationships']){await p.selectOption('[data-context-tab]',tool);await p.waitForSelector('[data-context-tab-fragment]');if(tool==='relationships'){await p.locator('[data-graph-node="5"]').tap();await p.locator('[data-graph-zoom="in"]').tap();await p.locator('[data-relationship-lens="story"]').tap();await p.locator('[data-graph-node="5"]').tap();assert(await p.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));await p.screenshot({path:'/tmp/context-refinement-relationships-touch.png'});continue;}const first=tool==='names'?p.locator('[data-context-name-id] details').first():p.locator('.context-character-row').first();await first.locator('summary').first().tap();await first.locator('summary').first().tap();assert(await p.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));await p.screenshot({path:'/tmp/context-enhancement-'+tool+'-touch.png'});}console.log('PASS touch-emulated Chromium: all three tools, long names, summary tap and no horizontal overflow at 390px. Physical touch/PWA installation not exercised.');}finally{await b.close();}})().catch(e=>{console.error(e.message);process.exitCode=1;}); +(async()=>{const b=await chromium.launch();try{const c=await b.newContext({viewport:{width:390,height:844},isMobile:true,hasTouch:true,deviceScaleFactor:2});await c.route('**/cdn.jsdelivr.net/**signalr*',r=>r.fulfill({contentType:'application/javascript',body:fs.readFileSync(path.join(__dirname,'node_modules/@microsoft/signalr/dist/browser/signalr.min.js'))}));await c.route('**/native-companion/status',r=>r.fulfill({json:[]}));await c.route('**/native-companion/connection-state',r=>r.fulfill({json:{known:false}}));await c.route('**/Writing/Context/Position?*',r=>r.fulfill({json:{connected:false}}));await c.route('**/Writing/Context/Tabs/*',async r=>{const u=new URL(r.request().url());await r.fulfill({response:await r.fetch({url:base+'/context-tab-fixture/'+u.pathname.split('/').at(-1)+u.search})});});await c.route('**/Writing/Context/Relationships/Graph?*',async r=>{const u=new URL(r.request().url());await r.fulfill({response:await r.fetch({url:base+'/context-lenses-fixture'+u.search})});});const p=await c.newPage();await p.goto(base+'/Writing/Context');for(const tool of ['characters','names','relationships']){await p.selectOption('[data-context-tab]',tool);await p.waitForSelector('[data-context-tab-fragment]');if(tool==='relationships'){await p.locator('[data-graph-node="5"]').tap();await p.locator('[data-graph-zoom="in"]').tap();const svg=p.locator('[data-relationship-svg]');await svg.scrollIntoViewIfNeeded();const point=await svg.evaluate(n=>{const b=n.getBoundingClientRect();for(let y=b.top+20;ydocument.documentElement.scrollWidth<=innerWidth+2));await p.screenshot({path:'/tmp/context-refinement-relationships-touch.png'});continue;}const first=tool==='names'?p.locator('[data-context-name-id] details').first():p.locator('.context-character-row').first();await first.locator('summary').first().tap();await first.locator('summary').first().tap();assert(await p.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+2));await p.screenshot({path:'/tmp/context-enhancement-'+tool+'-touch.png'});}console.log('PASS touch-emulated Chromium: all three tools, long names, disclosure taps, graph selection, touch drag/pinch, zoom and lens switching with no horizontal overflow at 390px. Physical touch/PWA installation not exercised.');}finally{await b.close();}})().catch(e=>{console.error(e.message);process.exitCode=1;});