diff --git a/Docs/Geography/Corrections-2026-11-13.md b/Docs/Geography/Corrections-2026-11-13.md new file mode 100644 index 00000000..0283227a --- /dev/null +++ b/Docs/Geography/Corrections-2026-11-13.md @@ -0,0 +1,43 @@ +# Development geographical positioning correction — 13 November 2026 + +## Exact incident findings + +At 15:30–15:35 GMT, Birmingham, Rubery and Redditch were Pending with JobState `Awaiting hierarchy request`, generation 1, zero attempts and no queued work. Northfield alone had been submitted and successfully resolved by a real Nominatim request. The provider was enabled on the correct host (`atlas`); there was no request cooldown, active lease, provider failure or stale-result rejection. + +The blocking limit was **one admitted batch per author per rolling hour**. The affected author had **1/1** batches, containing just Northfield (one location), submitted at 15:15:07. The application limit was 6 batches/hour with only **1/6** used; the external budget was **1/200** requests/day. Birmingham's branch contained 16 locations but only three geographical types, of which Northfield was already resolved. Failed Resolve submissions rolled back: they did not create batch records or make external requests. Earlier dedicated test accounts had not consumed the allowance. The per-click author rule wasted the remaining capacity of the intended 20-location allowance. + +The old Save hook submitted only parent changes to existing locations. Creating a location with an explicitly assigned real-world parent left it unsubmitted. The UI rendered both unsubmitted and genuinely queued work as Pending. Finally, Maps allowed one resolved point to be centred and reported as a successful arrangement, while its confirmation dialog obscured the canvas proposal. + +## Corrections + +- Explicit parent assignments, including creating a child under a recognised root, automatically submit eligible work. Existing name/type changes and reparenting also re-evaluate the affected branch. Creating an unparented location alone does not submit lookup. Resolve remains a recovery action. +- Author admission now charges **new uncached location work**, not clicks or every descendant: 20 locations/author/rolling hour and 120 application-wide/hour, at most 20 new eligible locations per submission. These preserve the previous maximum capacities (1×20 and 6×20) while permitting successive small actions. Cached, confirmed/resolved, already-requested and duplicate entries are not charged; rejected submissions do not spend allowance. Cache-backed recovery is free of a new location charge. Actual HTTP attempts remain separately metered. +- The designated host, single persistent external-request slot, minimum 15-second interval and 200-request/day ceiling are unchanged. No cap was disabled or reset. +- Queue state, attempt count, next attempt and lease are returned by the authorised status endpoint. The UI distinguishes Not requested, Queued, Looking up, Retry scheduled and Lookup disabled. Action messages no longer overwrite the location's status heading. Safe job/candidate/cache/error diagnostics contain IDs/counts rather than query URLs or descriptions. +- Maps requires two distinct resolved, unlocked locations. A lone point is left unchanged and Apply is disabled with specific request/confirmation guidance. Maps can explicitly submit its missing linked locations and refresh status. +- A larger dialog contains a read-only clone of the actual proposed SVG, including its unchanged surroundings, rather than hiding the proposal behind a modal. Statuses, recovery links, north-up guidance, unchanged counts and attribution are visible. Cancel leaves the document untouched; Apply closes the dialog and creates one existing Undo checkpoint; Save uses normal persistence. No objects are recreated. + +## Bounded live-provider findings + +Three explicitly scoped live recoveries returned successful Nominatim responses: Birmingham and Redditch each had both a point and an administrative-area candidate; Rubery's full `Rubery, Birmingham, United Kingdom` query returned no geographical match. This was a successful HTTP search with an empty result, not a network failure. A book hierarchy need not reproduce administrative boundaries: the returned Rubery point belongs to Bromsgrove/Worcestershire. + +A full-context empty result now schedules **at most one country-scoped fallback**, using a separate cache key and the same central request gate. Its generation-bound stage survives restarts and cannot overwrite newer context. Relaxed-context results always require author confirmation. A scoped Development recovery through the production processor/provider/repository pipeline made exactly one further real HTTP request: the request counter moved **4 → 5**, and returned Rubery (`node:248191627`) at 52.3926619, -2.0166846, with zero failures and Needs confirmation. No arbitrary match was selected for the author. + +During verification the author confirmed Birmingham, Redditch and subsequently Rubery. The final real database check showed **all four reported places Resolved/Done with zero failed attempts**. These author choices, including the chosen Redditch administrative area, were preserved. No saved positions in the author's map were modified by this investigation. + +The dedicated authenticated acceptance account independently created the same public hierarchy through normal forms: all four explicit parent assignments automatically queued work without clicking Resolve. Worker diagnostics showed four initial cache hits plus Rubery's cached fallback. The account's billed-work count was **zero**. Its genuine Nominatim candidates were confirmed through normal Location Details controls and consumed by a real saved map, then the account and all fixture projects/locations were removed through normal deletion. + +The author continued normal hierarchy activity during verification. At the accounting snapshot the author had **8/20** newly required locations across **six** admitted actions in the rolling hour, rather than being locked out after one action. The application had made **10 actual requests that day**: the earlier Northfield request, three scoped recoveries, one Rubery fallback and five subsequent real-author requests. The acceptance account's cache hits were not additional network calls or allowance consumption. + +## Qualification and rollout + +- Solution build: passed, zero warnings/errors. Normal executable regression harness: passed all configured groups, 488 PASS output records including nested suites. +- Focused tests: eligibility/cache identity, bounded fallback, projection edge cases, one-point and duplicate-location refusal, safe candidate rendering and real-preview transactions passed. +- Rollback SQL regressions: durable claims, stale-result protection, confirmation/exclusion, accurate cached/resolved/queued/duplicate accounting, successive small actions and the retained 20-location budget passed. An initial test attempted nested INSERT EXEC through the existing authorization procedure; it was corrected to inspect transactional state directly. This was a test-harness issue, not a migration defect. +- Browser/PWA light/dark regressions: passed visible inline preview, insufficient-coordinate guidance, explicit missing requests/status refresh, Cancel/Escape, Apply closure, movement, Undo/Redo, Save and unrelated-object/lock preservation. +- Authenticated Development: automatic parent-assignment submission, real provider candidates/confirmation, visible preview, actual Apply closure and movement, Undo/Redo, real Save/reload, independent geographical coordinates, locks/drawings and the actual PWA action were verified. The first PWA assertion ran before the asynchronous preview request completed; adding the missing dialog wait corrected the test. A focused authenticated PWA rerun passed, including full-document preservation on cancellation. +- Forward-only migrations **257 and 258** were backed up, applied and tested against verified `PlotDirector_Development`; existing numbered migrations were not edited. Backup: `/var/opt/mssql/backup/PlotDirector_Development_geography_corrections_20261113.bak`, created with COPY_ONLY/COMPRESSION/CHECKSUM and verified nonempty in the SQL container. No restore/reset occurred. +- Deployed implementation commit: **dad70a1** on the existing shared branch. Release: `geography-fix-dad70a1-20261113T161751Z`. Qualified publish-to-authenticated-verification window: **16:17:51–16:27:37 GMT, 9 minutes 46 seconds**. No deployment blocker remained. +- Published/deployed `PlotLine.dll` hashes match: `5b8df4a389591885ad28163a40587621c157e4e50b41cca463a4a7546bc8f7ca`. Service active; local GET, public TLS-verified HTTPS GET, DLL metadata and authenticated routes verified. A loopback HTTPS-redirect-port warning was reviewed; there were no geographical processing errors. No active/queued import, Story Intelligence, synthesis or enrichment work was interrupted. Previous application snapshot and release archive are retained under the normal Development paths. + +Production, Word Companion, Context, Intent and manuscript persistence were not modified. The pre-existing untracked manuscript assessment document was preserved. Refresh the Maps page to load the corrected preview UI. diff --git a/PlotLine.Tests/Browser/geography-development.cjs b/PlotLine.Tests/Browser/geography-development.cjs index 51a9d98a..f9a3755b 100644 --- a/PlotLine.Tests/Browser/geography-development.cjs +++ b/PlotLine.Tests/Browser/geography-development.cjs @@ -69,7 +69,7 @@ const base='https://dev.plotdirector.com'; const pwa=await browser.newContext({viewport:{width:1700,height:1100},storageState:await context.storageState()});await pwa.addInitScript(()=>Object.defineProperty(navigator,'standalone',{value:true})); const app=await pwa.newPage();app.on('pageerror',e=>errors.push(e.message));await app.goto(mapURL);await app.waitForFunction(()=>!!window.PlotDirectorMapWorkspace); const action=app.locator('[data-pwa-context-controls] [data-command-identity="handler:mapsGeographic"]'),menu=action.locator('xpath=ancestor::details[1]'); - if(await menu.count()&&await menu.getAttribute('open')===null)await menu.locator(':scope > summary').click();await action.click();assert(await app.locator('#mapsGeographicPreview svg').isVisible());await app.locator('#mapsGeographicCancel').click(); + if(await menu.count()&&await menu.getAttribute('open')===null)await menu.locator(':scope > summary').click();await action.click();await app.locator('#mapsGeographicDialog').waitFor({state:'visible'});assert(await app.locator('#mapsGeographicPreview svg').isVisible());await app.locator('#mapsGeographicCancel').click(); assert.deepEqual(errors,[]);console.log('PASS authenticated Development: real Nominatim candidates/confirmation, visible preview, Apply closure/movement, Undo/Redo, real Save/reload, independent coordinates, untouched locks/drawings and actual PWA action.'); await pwa.close();await context.close(); }finally{await browser.close();}