PlotDirector/Docs/Writer/Context-Location-Correction-20261123.md

5.7 KiB

Context location selector and Hold button correction — 23 November 2026

Root cause and corrections

ContextCharacterEditing.Load reused SceneEditViewModel.LocationOptions. Context requests GetForSceneAsync(..., forWriting: true, includeNarrative: false), which uses the deliberately lightweight PopulateWritingDataAsync path. That path loads scene participation records but intentionally omits editor lookup choices. Consequently the correction modal received only its own “No recorded location” option, regardless of available library locations or character history.

The location correction now calls the existing ILocationRepository.ListByProjectAsync / dbo.Location_ListByProject after book, project edit-access, scene and character-scope validation. Active locations from that project populate the dropdown, using canonical hierarchy paths with a name fallback. The empty option clears the scene-specific location; an empty library also displays an explicit inline empty state. Save reloads the authorised choices and rejects foreign/archived values. It continues to use the existing UpdateSceneCharacterAsync persistence and Context data invalidation. No schema change, new location, scene-primary-location write or shared-focus publication was introduced.

The standalone Context toolbar renders no SVG for its existing Hold toggle, and specifies “Release” as its held label. Classes, placement, fixed width, availability gate and Hold behaviour remain unchanged. Main ribbon buttons retain their existing pause/play SVG and Hold/Resume text. Word VSTO and all three Word caret controls are unchanged; Focus Previous/Next/History are unchanged.

Verification

  • Solution build: zero warnings/errors.
  • Full executable regression harness: 809 PASS checks.
  • Focused service regression reproduces empty writing-model choices, with no recorded character location, while a canonical library exists. It verifies project-scoped lookup, hierarchical labels, scene-participation persistence, unrelated-field preservation, reopen, clear, foreign/archived exclusion, empty library and existing edit authorisation.
  • Existing chronology checks preserve canonical Previous/Now/Next ordering and exclude future information from current blanks.
  • Existing shared-focus reliability browser checks pass: connection/revision races, independent Hold/reconnect, genuine unavailable states and no adjacent status controls.
  • New real authenticated browser test PlotLine.Tests/Browser/context-location-correction.cjs passes against the isolated Development host with actual SQL and SignalR. It verifies library choices, hierarchy, assign/clear/reopen, chronology, another character and other scenes, single-pane and two simultaneous character panes, remote live refresh while held, preserved character expansion/scene/focus/Hold state, text-only Hold/Release, main ribbon icons/Hold/Resume and three retained Word caret actions.
  • Its --empty-library case also passes against a genuinely empty active fixture library and verifies the explicit empty message and clearing option.
  • Direct fixture checks confirm no duplicate locations, scene primary location unchanged and clearing persisted.

Testing uses disposable characters and scenes, not changes to Rick or the real manuscript. Development database identity was verified, and a unique copy-only checksum backup was created and verified before fixture preparation. The application principal could create the backup but lacked RESTORE VERIFYONLY permission; the existing protected administrator helper verified it successfully. No schema migration was needed. Existing unrelated untracked investigation files are preserved.

Delivery

  • Implementation commit ea0199a6b4254e252b7c0656de4e7d12c98b1a25 pushed to origin/codex/word-companion-native-phase1-20261104.
  • Development deployment UTC: 2026-11-23T22:02:55.798144+00:00.
  • Release archive: /srv/apps/plotdirector-dev/releases/shared-focus-context-location-ea0199a-20261123T220253Z.
  • Previous installation backup: /srv/apps/plotdirector-dev/current-before-shared-focus-context-location-ea0199a-20261123T220253Z.
  • Queued/active import, Story Intelligence, synthesis and enrichment gate passed immediately before restart.
  • plotdirector-dev active; local and public HTTPS GETs returned 200 with normal TLS verification. No warning/error journal entries during restart verification.
  • Assembly metadata contains the implementation SHA. Publish/deployment SHA-256 matches for the DLL and checked assets; DLL SHA-256 1ce0b5c877f7b1a9130717baef8438efda5ddd6ea36552b5dffa69bec32bc7ea.
  • Full real Context location-correction browser test passed again against public Development, including single/split panes and remote held updates. Real empty-library browser case also passed against public Development.
  • Fixture isolation checks passed again: no duplicate locations, scene primary location unchanged, and cleared character location persisted. Fixture locations and disposable project/book/characters archived; owned isolated host stopped. Development service remains active.
  • Main Focus controls and Word caret action markup, native Word/VSTO and installer source have no changes. Production untouched. No real Rick/manuscript data was edited.
  • /srv exhausted free space while writing final documentation. The report was restored from Git, and this task's two redundant publish scratch directories were removed after deployment hash verification, freeing approximately 757 MB. Live installation, release archives and rollback backups were retained. Space remains low; broader retention cleanup is outside these two corrections.

This final evidence is saved in a documentation-only follow-up commit; Development runs the implementation SHA above.