5.4 KiB
Context Threads — task 120
Implementation branch: feature/context-threads-120.
The Threads tab uses canonical Plot Lines, Threads, scene order, events and actual
milestones from IPlotLineWorkspaceRepository. Direct scene associations live in
dbo.SceneThreads; they do not create events or additional story entities. The
picker captures and displays the target scene, adds multiple threads atomically,
and uses the existing Context lifecycle guard and shared save notifications.
History includes every earlier associated scene in the selected book, deduplicated
in narrative order. Planned resolution alone is not a recorded pickup.
Knowledge remains in Characters. ContextCharacterPanels uses the selected
scene's AtPoint.Characters knowledge; _ContextCharacterDetail shows up to four
facts, distinguishes viewpoint knowledge from author reference, and links source
scenes. Refining the quantity/display is deferred as permitted by the brief.
Required Development schema release
Migration PlotLine/Sql/340_SceneThreads.sql is forward-only and has not been
applied or database-qualified. Do not deploy these binaries before the migration.
No Production change is authorised.
The code-only adapter in Tools/Deployment/development_release.py rejects changed
SQL against the approved baseline (the changed_sql gate). Follow
Docs/Codex/Database.md, Docs/Codex/Deployment.md, and the shared manifest/history
contract for a separately reviewed and qualified Development schema release.
Do not remove that gate, apply SQL manually, or edit the baseline to skip review.
The operator's qualification must:
- Verify
PlotDirector_Development, its current full migration ledger and schema; verify Atlas capacity, take and verify a unique backup, and qualify against an isolated restored copy. Do not restore/reset the live Development database. - Include the complete current ledger and exactly the new 340 migration in the
qualified manifest, using measured before/after fingerprints and real evidence.
Prerequisites include
Scenes,PlotThreads,PlotLines,ProjectUserAccess,SpatialContext_Scope, andProjectRestore_ApplyFromJson. The migration fails closed if the current restore procedure differs from its expected markers. - Verify the composite key, reverse index, cascade cleanup and the three new procedures
(
SceneThread_ListByBook,SceneThread_Add,SceneThread_Backup), plus the existing scoped procedure dependency. Verify runtime procedure permissions. - Test atomic multi-select insertion, duplicate/repeated saves, two concurrent inserts, owner/collaborator writes, reader denial, absent/inactive access, cross-project/cross-book/archived threads and scenes, and malformed/oversized selections. Invalid batches must insert nothing. Verify no ThreadEvents are created or changed by a direct association.
- Test export/restore and portable import of the new associations, including ID remapping, omission protection for older backups, cross-book/dangling/duplicate rejection, and permanent scene/thread/book/project cleanup. Existing restore constraints must finish enabled/trusted. The new table contains only the two canonical foreign keys; archiving preserves associations.
- Activate the exact committed application SHA through the existing Development
deployment worker, with idle-work checks, manifest admission and authoritative
receipt. Verify running full SHA, Development and
PlotDirector_Development. Reconcile any uncertain result before attempting another release. Updating the code-only baseline is an operator action after successful qualification/release.
The four procedure names introduced/used by this feature are
SceneThread_ListByBook, SceneThread_Add, SceneThread_Backup, and
SpatialContext_Scope (the last is existing, not newly created).
Live acceptance after the schema release
Use Docs/Codex/BrowserAcceptance.md and the permanent locked Development writer
helper. Create a registered disposable project with a book containing three
ordered scenes, two Plot Lines and at least three Threads through ordinary UI.
- In scene one, add two Threads from different expanded Plot Lines. Verify the target scene in the dialogue, search retaining the parent Plot Line, selection retention across search, and already-linked disabled state on reopening.
- In scene two, add the same Thread and another Thread. Reload and freshly sign in; verify both links persist and that scene one's pickup appears exactly once.
- In scene three, link the same Thread, then verify both previous scenes appear in narrative order. Return to scene one and verify later scenes are absent.
- Repeat in light/dark themes, single/split panes and a second Context window. Verify saved-data invalidation updates the other window, Hold/Follow and the selected scene remain correct, keyboard Cancel/Escape restores focus, and no action moves the Word caret. Native Word verification requires a real connected session; record a limitation rather than claiming a synthetic test proves it.
- Verify Characters still shows established knowledge and source scenes. Clean up the disposable project through the documented scoped lifecycle and preserve any pending cleanup journal on failure.
Record the exact SHA, receipt, URLs, real checks, cleanup and factual effort in CYJ. The isolated browser test uses mocked persistence and is not live acceptance.