PlotDirector/docs/story-point.md

8.6 KiB

At This Point in the Story

Implementation map (audit before implementation)

Requirement Active authority Approach
Project, books, chapters, scenes and boundary TimelineRepository / Timeline_GetByProject; NarrativeSceneOrder view Reuse project-wide timeline; share Continuity Explorer ordering with SQL's full tie breakers.
Scene chronology Scene canonical StartDateTime, TimeModeName, RelativeTimeText; Calendar consumes these Display only canonical fields; no parsing or resolution.
Characters and previous appearance CharacterRepository.GetTimelineAsync / SceneCharacters One batch; selected attachments and strict earlier narrative index, including earlier books.
Age CharacterAgeDisplayService Reuse directly with selected chronology.
Character locations, asset state, location occupancy StoryStateService (active Scene Inspector and Continuity Explorer path) Expose reusable bounded projection; retain separate historical asset custody, location and state dimensions.
Knowledge CharacterKnowledge, KnowledgeStates; StoryStateService knowledge identity/regression Batch read; share identity and select latest state per character/fact through the boundary. No reader/character discriminator exists.
Relationships RelationshipMapService.BuildRelationship Expose projection using canonical scene indexes; exclude undated non-initial relationships in the new view.
Threads, questions and clues PlotThreads introduction/actual resolution scene IDs; ThreadEvents types Bounded structured lifecycle projection; no current status or global summary leakage. Questions and clues are existing thread types.
Continuity StoryStateService warning builders and acknowledgement repository Reuse builders on bounded inputs; focus relevant entities and selected scene.
Selection / partial updates Calendar partial/fetch; Relationship Map hierarchical controls Purpose-built lightweight dependent selects and reusable snapshot partial, normal GET fallback.
Ownership ProjectAccessFilter / IProjectAccessService Explicit service access check plus selected scene membership in project timeline.
Writing context / Word StoryContextService loads the full SceneEdit model; WritingController uses it and Word follow partials Avoid the heavyweight editing path; keep composition service and partial independently reusable. Do not change follow integration.

No AI, manuscript/synopsis parsing, import changes or chronology writes. New read-only stored procedure batches history that otherwise requires per-character/per-asset/per-scene queries. No table changes.

Behavior and boundaries

GET /StoryPoint?projectId=…&sceneId=… includes the selected scene. The same endpoint returns _Snapshot for fetch requests. The composition service checks project access first, then verifies scene membership before loading history. Book/chapter selectors filter locally; changing a scene fetches the snapshot, cancels stale requests, updates the URL and supports browser Back. A normal GET form remains usable without JavaScript.

The existing state service now exposes bounded read projections and independent asset holder/location/status fields. Relationship Map shares the full canonical narrative ordering and exposes its existing relationship projection with explicit start/end/initial-book boundaries. Undated non-initial relationships are withheld because there is no reliable point at which they become true. Current global relationship notes and thread summaries/statuses are not rendered. Knowledge states (including suspicion or unawareness) retain their actual labels rather than all being described as known facts.

Threads use introduction and actual-resolution scene IDs; a first recorded event can establish a thread when the introduction field is absent. Resolved and Payoff events close a thread, matching ThreadEvent_Save. Planned resolution dates do not close it. Questions/clues appear through the existing thread types, not a parallel model.

The service makes eight repository calls (access, timeline, six independent history batches), independent of character/asset/scene count. The six batches run concurrently on separate connections. It does not invoke SceneEdit, AI services, warning persistence, or Story Intelligence. Existing Timeline internals may make an additional batch for event targets; metrics and plot-line loading are disabled here.

Validation

Six focused behavioral test groups in PlotLine.Tests/StoryPointTests.cs cover presence, strict previous appearance across books, age and undated scenes, knowledge progression, relationship boundaries, independent asset state, active/future/resolved threads, warning future-evidence isolation, canonical ordering tie breakers, ownership rejection, partial rendering, and bounded repository calls without AI. They use generic unrelated characters and non-monotonic scene IDs.

Dev SQL: PlotLine/Sql/191_StoryPointHistory.sql adds one read-only stored procedure, using NarrativeSceneOrder to bound all event reads. No tables, manuscript data or chronology are changed. Applied and smoke-checked against PlotDirector_Development (procedure object ID 33435193).

Read-only acceptance on project 4085 (The Alpha Flame), before publication:

  • Scene 5244, Chapter 1 Scene 1: 7 May 1980, night; three attached characters; Beth age 15; no previous appearances; one introduced thread; three unknown-location warnings.
  • Scene 5400, Chapter 34 Scene 6: 16 April 1983, evening; eleven attached characters; Rosie age 18 years 3 months, Sophie approximate 21; previous appearances correctly point to earlier narrative scenes; six active threads and eleven unknown-location warnings.
  • All 299 scene IDs matched the SQL view's narrative ordering exactly. Presence and every previous appearance in both snapshots were independently checked against SQL. Composition took 694 ms on first read and 310 ms on second read.
  • The current project contains 31 canonical thread events but zero canonical knowledge, relationship events, asset events, custody events or asset-location rows. Primary locations and character appearance locations are also missing for these two scenes. Empty historical sections are therefore correct; live before/after verification of those empty domains is unavailable. Tests cover their populated behavior without changing dev data.

Deliberate limits

Reader knowledge is deferred: a few relationship reader-awareness flags do not form a reliable general reader knowledge model. Word Companion automatic following is deferred; the service and partial are reusable for that integration. No AI briefing is included. Unanchored thread/relationship status and asset current-only fields cannot establish historical truth. Entity names and canonical authored facts are not versioned against later author edits; this feature reconstructs narrative event history, not database edit history. Undated chronology and incomplete locations/ages remain explicitly unknown.

Deployed acceptance (7 September 2026): authenticated Chromium checked both scenes, navigation, chronology and ages, early versus later thread visibility, Scene/Timeline/Calendar links (all HTTP 200), dependent chapter/scene selection, AJAX responses, browser Back, no-JavaScript GET submission, invalid scene/project rejection (404), and anonymous login redirect (302). Calendar and Timeline continued to load. No browser exceptions or server error entries were observed. Visual review prompted duplicate participation-label removal, compact scene numbering, and scoped dark-theme action-link contrast. A direct SQL header check confirmed POV IDs even though Timeline omits their names; the composition now resolves Beth and Maggie from the already-loaded canonical character batch.

The initial /tmp publish failed on tmpfs quota before installation. Publication succeeded from temporary staging on /srv using the same dotnet publish and physical release/backup/rsync/systemd process; production was untouched. The prior dev directory remains backed up. The first post-restart request briefly returned 502 during startup; subsequent home and authenticated checks returned 200. All 347 tests passed; the solution build and Release publish succeeded. The Word Companion README permission-description correction is included at the user's request.

Independent SQL evidence confirmed Beth's DOB as 7 May 1965, Rosie's as 28 December 1964, and Sophie's approximate series-start age as 21. At narrative index 201, threads 26 and 29 had already resolved (indexes 144 and 99); 33, 35 and 36 had not yet been introduced (233, 261 and 287). The displayed active set was exactly 27, 28, 30, 31, 32 and 34. At index 1, only thread 34 had been introduced.