PlotDirector/Docs/Writer/Spatial-Context-Acceptance.md

16 KiB

Integrated Spatial Context delivery

Implementation

Three self-contained Scene-scoped tools extend unified Context: Locations, Maps and Floor Plans. They share authoritative previous/current/next scene resolution, direct/nearest-containing resource resolution, canonical location taxonomy, window-local spatial inspection and ephemeral P/C/N highlighting. They work alone or in either split orientation alongside existing tools.

Locations supports adjacent-scene inspection without navigation, ancestry and immediate children, descriptions, rename, types, classification, child creation and explicit current-scene assignment/new-location creation. Description drafts and placement/association targets remain pinned through focus changes. Missing assignments remain unassigned; unavailable recorded assignments are explicitly distinguished.

Maps reuses the canonical renderer in a connection-free renderer iframe. Existing geometry, backgrounds and surrounding features remain visible. Context adds resource choice, zoom/pan/fit/centre, combined scene indicators, explicit existing-location placement/repositioning and native cross-pane drops. A validated featureId parameter supplies the reusable main-map reveal route.

Floor Plans reuses the extracted canonical stage, presentation helpers and wall/transition renderer. Context adds read-only viewport controls, floor selection, explicit room highlighting/inspection, existing-location/plan association and deliberate create-and-associate. Geometry and containment are not changed by association.

Existing Context owns focus, Hold/Follow, two panes, window identity, preferences and its one SignalR connection. Generic lifecycle extensions permit in-place refresh and guarded pane closure. Main spatial editors reuse their existing presence connection for persisted-data refresh; clean resources refresh while dirty editors retain drafts. Hidden tab caches are invalidated without loading resources, and stale responses cannot repopulate them. Shared map/plan mutations notify the project across books; scene assignment remains book-scoped. Unassociated map features can be inspected without inventing a location association. Advanced links reveal the exact feature/block.

See architecture and contracts and user help.

Data and safeguards

Migration 339_SpatialContext adds read/targeted-mutation procedures; it adds no tables, classification fields, competing geometry model or automatic data migration. All normal database access uses Dapper/stored procedures. Authorisation, active project/location validation, compare-and-swap, transaction and audit checks run on the server. Protected Undo is user-bound and expires after ten minutes. Create-and-assign uses one transaction so a failed assignment cannot leave an unintended location.

Scene assignment remains Scenes.PrimaryLocationID. Recorded character, asset and occupancy positions retain separate labels and do not fill missing primary assignments. Selection is local to each Context root and never broadcasts or writes manuscript focus. Paragraph movement does not reset it. Resource/viewport preferences are scoped to author/window/project/tool/resource; placement mode is not persisted.

The recursive ancestor query is cycle-safe and unrestricted by genre or location taxonomy. Direct associations win; otherwise the nearest explicitly associated containing location is labelled as inherited. Room associations take precedence at the same depth, and candidates can prefer adjacent-scene coverage. Descriptions, canonical identifiers, scene references, map geometry and floor-plan geometry are preserved.

No AI, routing, geocoding or automatic location/association creation is introduced by these tools. Traditional World editors and ribbon arrangements are retained.

Verification evidence

  • Normal solution build and executable regression harness: 889 PASS, no failures on the qualified candidate. The final clean-source gate also passed with zero build warnings or errors.
  • Final Development read-only DBCC CHECKCONSTRAINTS WITH ALL_CONSTRAINTS completed with zero constraint violations after fixture cleanup.
  • Two fresh database copies qualified migration 339. All 210 original business tables were unchanged; both integrity runs reported zero constraint violations.
  • Database contracts exercised authoritative first/last/chapter-boundary order, Dapper projections, nearest-ancestor availability, explicit scene assignment, marker placement/repositioning, room/plan association and exact Undo. Duplicate markers, stale room versions, absent confirmation, connected-room identity changes, unauthorised access and unavailable resources were rejected.
  • Synthetic browser checks used actual compiled Razor and the canonical renderers. They covered all three single tools, three spatial pairings, both split orientations, local coordination, independent windows, unavailable/unassigned/repeated locations, preserved drafts, paragraph stability, same-building renderer/viewport retention, native map/room drops and rejected-write recovery.
  • Authenticated final-release browser checks passed for cross-chapter scene order, adjacent inspection, explicit current-scene assignment, description/name/type/classification edits, protected Undo, atomic create rollback, placement/reveal, room association, geometry preservation, live room labels, main workspace navigation and the single-connection contract. Hold/Release was exercised through actual shared focus from another browser window.
  • The final release also passed an authenticated installed Chromium PWA run covering all three tools, shared highlights, side-by-side and stacked panes, with no page errors.
  • All seven themes were rendered in Chromium browser and an actual installed Chromium PWA. Browser fixtures contain no author manuscript data.
  • Main Maps browser/PWA workflow and Floor Plans browser/PWA save/error/unsaved-navigation regressions passed. Main clean map/floor live refresh and dirty-editor protection passed.
  • The legacy context-workspace-foundation.cjs timed out at its same-scene invalidation assertion against both baseline and current Context code. Its fake SignalR stores one handler per event while the real connection supports multiple subscribers. This suite is recorded as failed, not counted as passed. The new focused spatial suite passed.

Measurements

These are observed samples, not general performance guarantees or claims that a pre-existing spatial Context was faster/slower: the previous application had no such tabs.

Measurement Result
Initial synthetic Locations tab, one recorded browser run 83 ms in an early run; current results file records the final run
Paragraph movement within the same scene 0 spatial requests in the browser assertion
First/last and chapter-boundary reads, final recursive implementation 18 samples: median 11.0 ms, maximum 51.4 ms
500-level hierarchy plus 1,000 unrelated roots, initial candidate iterative query 2,274.3 ms; 501 relevant locations returned
Same stress fixture after recursive-query refinement 125.6 ms; 501 relevant locations returned, no unrelated directory load
Same-building scene change Existing map iframe and manually set 900-unit viewport retained
Authenticated Development: initial Locations / Maps / Floor Plans 127 / 89 / 90 ms (single observed run)
Authenticated Development: same-location / same-building scene change 78 / 52 ms
Alternative-map resolve/render / second split-pane mount 134 / 81 ms
Authenticated Development: 100 same-scene paragraph moves 0 spatial requests

These authenticated timings were measured on the final deployed application. Alternative-resource switching may establish a new viewport; the tested guarantee is retaining the existing viewport while its map remains relevant, rather than restoring every historical viewport across resource changes.

Cold compilation, concurrent host work and cache state affect these measurements. A full cross-device latency benchmark and physical Word event-rate test were not performed.

Acceptance matrix

Area Status Evidence / boundary
Three independently loadable spatial tabs Passed Actual compiled fragments and renderers
Authoritative three-scene sequence and chapter boundaries Passed Database tests against NarrativeSceneOrder
Unassigned, unavailable and repeated locations Passed Rendered browser assertions
Ancestor/child exploration and Return Passed Browser selection and shared resolver tests
Name/description/type/classification quick editing Passed Authenticated Development edits and Undo, including City taxonomy
Explicit current-scene assignment Passed Server version checks; browser DTO target assertions; deployed checks below
Hierarchical picker reuse Passed Actual shared picker and operation-specific confirmation
Direct versus inherited resources Passed Resolver tests, rendered inherited map caption
Map geometry/background renderer reuse Passed Existing Maps workflow regression; canonical Context renderer
Combined P/C/N map indicators Passed Actual rendered combined rings
Map zoom/pan/fit/centre and viewport retention Passed Canonical renderer; same-building viewport assertion
Map placement/repositioning and Undo Passed Database persistence/reposition/Undo; browser explicit mode/rejection
Native cross-pane map drop Passed Actual mouse drag, reviewed drop and Cancel
Floor renderer, floors, rooms and scene indicators Passed Shared stage/algorithms, rendered rooms and levels
Room/plan association and Undo without geometry changes Passed Database positive/negative contracts
Native location-to-room drop Passed Actual mouse drag and explicit review
Connected-room identity replacement Not implemented Rejected when door/window transitions reference old/new identities; main-editor review required
Unassociated room geometry with nullable location Not implemented Canonical blocks require LocationID; no competing Context-only model added
Local selection isolation and feedback-loop prevention Passed Source/revision contract, coordinated panes and independent windows
Paragraph refresh suppression and stale response guards Passed Zero-request assertion and response epoch checks
Active edits pinned across scene changes Passed Rendered draft preservation and deferred pane refresh
Main editor clean refresh / dirty protection Passed Focused actual-renderer browser checks
Seven themes and narrow/stacked presentation Passed Browser and installed-PWA screenshots
Authenticated Development / installed PWA Passed Actual logged-in browser and installed Chromium PWA, disposable fixtures only
Physical Windows / Word Companion Not verified Linux environment; synthetic focus events do not constitute physical Word testing
Legacy broad Context foundation browser script Failed Same baseline/current failure described above
Existing workspace directories and focused spatial workflows Passed Authenticated directory navigation, full harness and Maps/Floor Plans browser/PWA regressions
Full manual regression of every unrelated workspace workflow Not verified No claim of comprehensive manual coverage
Hold/Follow and held-window persisted updates Passed Actual shared focus published from another browser window; held position retained, data updated, Release followed
Hidden-cache invalidation and obsolete responses Passed Hidden tabs made no resource requests, reopened fresh; delayed response could not repopulate invalidated cache
Additional AI processing Passed No new AI service dependency, request or migration analysis
Production untouched Passed Atlas Development-only workflow; no Production operations

Known limits

  • A maximum of forty immediate children is shown for local exploration. Open Locations for a larger directory.
  • Canonical room blocks already require a location; explicit replacement is supported only when existing transitions can be preserved safely. Connected identity reconciliation remains in the main Floor Plans editor.
  • Context mutations/Undo use compare-and-swap. The existing main Floor Plans full-layout save has no document-wide version contract; simultaneous full-layout editing from another device was not verified. Its existing concurrency architecture has not been redesigned.
  • Physical Windows/Word integration, cross-device simultaneous editing and a rendered 500-level path benchmark are not verified. SQL stress resolution was tested.
  • No routing, travel-time computation or inferred room matching is supplied.

Representative screenshots

Scenario Evidence
Locations single pane Locations
Maps single pane and combined P/C/N highlight Maps
Floor Plans single pane and three room highlights Floor Plans
Locations + Maps, room inheriting building map Pair
Locations + Floor Plans Pair
Maps + Floor Plans Pair
Stacked panes Stacked
Repeated scene location Repeated
Unmapped location Unmapped
Explicit map placement / native drop Placement, drop
Room association / native drop Association, drop
Unassigned current scene Unassigned
Narrow pane Narrow
Light and dark Modern light, modern dark
Actual installed Chromium PWA Spatial pair, dark, stacked
Authenticated Development Locations / Maps / Floor Plans Locations, map pair, plan pair
Development alternative map Alternative map
Development before deployment Existing Overview

All seven browser and installed-PWA theme captures are retained in the evidence directory. Authenticated post-deployment evidence and release identifiers follow below.

Development release

Activated 27 November 2026 at 18:17 UTC, Development only. Health confirmed Development, PlotDirector_Development and application source ebc9c2b41389d55372ab1ae1ad3d454b0397b48a.

  • Release: development-spatial-context-ebc9c2b41389-20261127T181607Z.
  • Deployment receipt: 20261127T181646Z-a639d86614f5; verified COPY_ONLY/CHECKSUM backup, no activation failures.
  • Final clean-source build: 0 warnings, 0 errors (40.27 s); executable regression harness: 889 PASS (95.64 s); Release publish passed (32.58 s).
  • Migration 339 was activated in the initial spatial release. The final release executed zero migrations, preserving schema 3d6e163f7cb8fff6bd17834ae8097dcf68be03894ce644844621dc191336cb7a.
  • Two fresh copies qualified the migration; two further copies qualified the identical code-only SQL plan. The final client/cache/notification patch reused the latter qualification because its immutable SQL plan and schema were unchanged. All copies were removed afterwards. The dedicated authenticated test account and its owned fixture project were removed through the normal hard-delete workflow; its private credential file was deleted.
  • Implementation commits: 01757170, 587f067d, 802b9892, 0e875934, 1b9d231a, c8ea6446, ebc9c2b4. All pushed to the existing task branch. This report and its disposable-fixture test corrections are a subsequent documentation/test-only commit.

Sanitised release and gate evidence. Production was neither accessed nor deployed.