Commit the pending application, help and browser regression work. Pin the patched PKCS dependency for the production release.
29 KiB
Plot Line and Thread Health Investigation
Investigation date: 29 October 2026. Read-only development inspection; no implementation, SQL changes, data changes, regeneration or deployment.
Scope: existing lifecycle, event, health and author-intent capabilities. Previous architecture findings are reused from the Plot Lines investigation.
Live observations below were verified against PlotDirector_Development; they supersede older example counts, not domain contracts.
A. Executive Summary
- PlotDirector can already report activity, quiet stretches, unclosed questions/clues, and some event-order inconsistencies.
- There is no canonical Plot Line lifecycle/status field. Status is stored on each Plot Thread.
- Thread status is an ambiguous mixture of author-selected current state, planning, and limited event-save side effects.
- Seven existing statuses suffice for an initial implementation; no new event vocabulary is needed.
Introducedcontributions can advance Planned to Introduced;Resolvedcontributions set Resolved. Structural Start/Resolve/Abandon do not do this.- A Payoff fills an actual-resolution boundary without setting Resolved. Consequently, boundaries and status can disagree legitimately or accidentally.
- There is no single authoritative resolution signal shared by all consumers.
- Three health systems already exist: Timeline browser rules, Story Health analytics flags, and persisted Continuity validation warnings.
- Their dormancy thresholds differ: Timeline uses at least 10 scenes; analytics/Continuity use more than 8 scenes.
- Current gaps count all canonical contributions equally, including Mentioned and Note. They measure spacing, not meaningful progress.
- Story Point already evaluates activity at a narrative position and prevents future status leaking backward; reuse its ordering discipline and tests.
- Author-selected Dormant/Abandoned and intentional-warning decisions exist, but planned resumption and intended cross-book continuation are not structured intent.
- Canonical ordering spans books; chapter-number subtraction does not reliably measure cross-book or scenario chapter gaps.
- Existing data supports factual review findings now. Narrative adequacy, forgotten intent and weak endings cannot be safely decided automatically.
- Keep stored status, observed state and health separate. Do not silently rewrite status from a new health evaluator.
- The minimum eventual addition is explicit, scoped author intent with an optional review/resume point, not another lifecycle hierarchy.
B. Existing Lifecycle Model
Live dbo.ThreadStatuses lookup (IDs verified, not assumed from seed order):
| ID | Exact stored value | IsOpenStatus | IsResolvedStatus |
|---|---|---|---|
| 1 | Planned | 1 | 0 |
| 2 | Introduced | 1 | 0 |
| 3 | Developing | 1 | 0 |
| 4 | Dormant | 1 | 0 |
| 5 | Ready For Payoff | 1 | 0 |
| 6 | Resolved | 0 | 1 |
| 7 | Abandoned | 0 | 1 |
PlotThreads.ThreadStatusID is required; the status belongs to a thread, not its parent line. Abandoned shares the resolved lookup flag: that flag means closed, not necessarily paid off.
PlotLines has scope, importance, structure and archive fields, but no equivalent status. Archiving is record administration, not narrative resolution.
The canonical editing surface is Views/PlotThreads/Edit.cshtml: status, importance, summary and three optional boundary scene selectors.
PlotService in Services/CoreServices.cs defaults new threads to Planned and saves the selected fields through dbo.PlotThread_Save.
That procedure overwrites current values; it does not enforce a lifecycle transition graph or reconcile events.
No dedicated status transition history or PlotThreads database trigger was found. Generic ProjectActivity records Created/Updated thread activity, not old/new status or effective narrative position.
Latest dbo.ThreadEvent_Save is in migration 174; its live definition was checked:
| Saved contribution | Automatic effect |
|---|---|
| Introduced | Fill IntroducedSceneID only if null; change status only from Planned to Introduced. |
| Payoff | Fill ActualResolutionSceneID only if null; leave status unchanged. |
| Resolved | Fill ActualResolutionSceneID only if null; set status Resolved. |
| All other roles; all structural types | No status/boundary advancement from these values alone. |
Updates run these side effects too. COALESCE preserves the first saved boundary, not necessarily the earliest event in manuscript order.
Changing/deleting an event does not reverse/recompute old effects; ThreadEvent_Delete simply deletes its row.
Therefore “current state” in help is an intended human-facing meaning, not a guaranteed manuscript-derived invariant.
Live contribution IDs (ThreadEventTypes): 1 Introduced; 2 Mentioned; 3 Developed; 4 Complicated; 5 Clue Planted; 6 Question Raised; 7 Question Answered; 8 False Lead; 9 Revealed; 10 Payoff; 11 Resolved; 12 Contradicted; 13 Retconned; 14 Note.
Live structural IDs (PlotEventTypes): 1 Start; 2 Progress; 3 Reveal; 4 Twist; 5 Branch; 6 Split; 7 Merge; 8 Resolve; 9 Abandon.
Introduced/Resolved are explicit event signals; Developed/Complicated/Revealed/Payoff indicate recorded movement without proving whole-thread completion or readiness.
Mentioned/Note do not establish meaningful progress; Contradicted/Retconned describe a change, not an error or lifecycle stage. A resolved question/clue is not necessarily the whole thread's conclusion.
Story Intelligence acceptance (Services/StoryIntelligenceNarrativeReviewService.cs, ApplyReviewAsync) looks for status “Open”, absent from this lookup, then falls back to its first status (currently Planned).
It sets introduction from the first effective event/evidence SortOrder; canonical event saves can subsequently alter status/boundaries.
It preserves event roles, descriptions and provenance but assigns structural Progress. Candidate BookStatus/InferredState is review evidence, not canonical lifecycle.
Follow the single-system runtime: accepted canonical events are observations; pending/accepted/rejected candidate decisions are not thread resolution.
C. Existing Health Logic
| Owner / rule | Exact input and threshold | Scope/order and current surface | Reuse assessment |
|---|---|---|---|
Timeline site.js, healthFor: neglected |
No structural Resolve/Abandon anywhere; latest displayed scene index minus last event index >=10. | Entire rendered Plot Line row, despite “Thread” labels; displayed scene positions, affected by selected scope/filter/order. Timeline only. | Reuse the concept/evidence, not DOM geometry or threshold blindly. |
| Timeline: dangling | No Resolve, Abandon, targeted Merge, or Split with >=2 targets; timeline end >=last event. | Line-level endpoint test, not a target-existence/continuation validator. | Rename precisely; do not describe it as validated dangling branch detection. |
| Timeline: questionable resolution | Has Resolve but no targeted Merge, valid Split, or targeted Branch at/after first Resolve. | Line-level; any qualifying event can suppress it; no textual payoff assessment. | Do not adopt as a claim that ordinary resolution requires a branch/merge. |
| Timeline: abandoned | Any structural Abandon. | Line-level notice, even if later events exist. | Reuse as an explicit observation, respecting author intent. |
Story Health Analytics_StoryHealth_Remainder |
Open status and >8 scenes after latest event; importance >=8 plus open status; clue with no Payoff/Answer/Reveal/Resolved; question with no Answer. | Thread-level flags shown in Views/Analytics/Index.cshtml; canonical GlobalSceneIndex, optional book. No scenario parameter. |
Reuse existing flags/predicates and labels with scope limitations explicit. |
Continuity ContinuityValidation_ValidateProject |
Earliest Resolved/Payoff before earliest Introduced; earliest Answer before earliest Question. | Thread-level Warning; canonical project/book events; not a save rejection. | Reuse factual ordering checks. |
| Continuity: clue without payoff / dormant | Clue lacks any Payoff/Answer/Reveal/Resolved: Info. Open thread last event >8 scenes behind scope end: Info. | Canonical, optional book; persisted warnings surfaced through Continuity and consumers. | Reuse rather than creating duplicate warning identities. |
| Continuity: too many major open threads | Importance >=8, open status, count >10: Info. | Project-level aggregate, optionally matching book/project lines. | Existing workload heuristic, not a closure rule. |
| Dashboard attention threads | Stored Dormant OR open status with importance >=8. | ProjectDashboard_AttentionThreads, migration 088; does not calculate elapsed scenes. |
Preserve distinction from computed dormancy. |
Sources: Timeline healthFor and marker creation, analytics remainder, Continuity validation. Live analytics remainder and Continuity definitions confirm the >8 threshold. Analytics_StoryHealth's current wrapper is in migration 068; thread flags remain in its remainder procedure. Analytics/Continuity can inspect multiple books when no book is supplied, but end-of-scope silence is not explicit carry-over intent. Clue/answer existence subqueries can see events outside the filtered book, so a later-book answer may suppress a current-book open-clue flag. Timeline health is based on available rendered rows/scene slots, not a stable project-wide evaluation. Its branch/split connector renderer does not prove target continuation. No configurable plot scene/chapter/word/duration thresholds were found. Line importance Primary/Secondary/Minor does not adjust these rules; thread importance is 1–10. Severities come from existing warning lookups; these rules assign fixed Info/Warning labels, not per-author settings.
Scenario_Validate (migration 019) has a separate reveal/payoff-before-setup check against scenario order.
It searches role names containing “Setup”; none of the 14 active roles contain that word, so the current lookup cannot supply its FirstSetupIndex. This is not effective lifecycle validation.
Manual event saves do validate structural targets (PlotService.ValidatePlotEventTargets): Branch/Merge need a different target in the project; Split needs at least two distinct project targets excluding the source. This validates links, not future continuation.
Neither canonical save nor scenario validation detects the full introduced/developed/resolved/reopened/abandoned sequence.
Move/extract Timeline's plot-only computation into the dedicated workspace's eventual shared evaluator; leave Timeline untouched in this investigation.
Reuse Continuity warning handling and Story Health inputs, rather than adding a fourth independent set of health semantics.
D. Gap and Dormancy Behaviour
PlotLineWorkspaceComposer.Compose groups selected contributions by scene and sorts supplied NarrativeOrder. GapBefore is next order minus previous order minus one.
That combined gap is between any selected contributions; the map independently calculates per-line gaps between that line's scenes in _NarrativeMap.cshtml.
All roles reset these gaps equally. Mentioned, Note, a weak touch and a Payoff are identical for spacing; no significance score or meaningful-progress filter exists.
Thread filters change the composed view, so display gaps can change without any canonical data changing.
Neither display calculation includes leading silence before the first event or trailing silence after the last event; health needs those separately.
Canonical scope uses BookSceneIndex for one book and GlobalSceneIndex across the project (PlotLineWorkspace_Get, migration 204).
Scenario order is assigned from ScenarioSceneOrder, proposed chapter and proposed sort order; it must not be mixed with canonical indices in one result.
ChapterGapBefore uses floored chapter-number subtraction; the map uses integer chapter subtraction. Neither counts distinct intervening chapter identities.
Chapter numbering restarts across books; scenarios can reorder scenes/chapters. Scene gaps remain ordered measurements, while chapter subtraction can mislead or collapse to zero.
| Measurement | Existing capability | Health limitation |
|---|---|---|
| Scenes | Already calculated, including global cross-book positions. | Count distinct scene positions; several events in one scene do not create extra distance. |
| Chapters | ChapterID/BookID and ordered scene sequence exist. | Count intervening chapter identities explicitly; decide treatment of partially traversed chapters. |
| Manuscript words | SceneManuscriptSources.SourceWordCount exists. | Requires an ordered prefix sum from the relevant source per scene; absent from workspace gap DTOs. Missing source counts must remain unknown. |
| Pages | No stable manuscript pagination in this gap model. | A word-count conversion would be an estimate, not measured pages. |
| Story time | Scene dates, time mode/confidence and relative text exist. | Only known comparable dates support elapsed time; flashbacks and undated/relative scenes prevent a universal threshold. |
Current gap length is useful evidence, insufficient by itself to distinguish intentional quiet from forgotten narrative work.
E. Resolution and Boundaries
IntroducedSceneID, PlannedResolutionSceneID and ActualResolutionSceneID are nullable FK scene references. Manual thread editing exposes all three. No relative-order/event-boundary agreement validation was found in the editor view model, PlotService save or PlotThread_Save; FK existence is not narrative validation. Story Intelligence acceptance supplies introduction, not planned end; event-save side effects can supply actual end. They are not consistently maintained first/last event boundaries. There is no canonical line-level resolved flag. Structural Resolve, contribution Resolved, actual boundary, thread status and candidate BookStatus can contradict one another. Review decision status means accepted/rejected processing, never “resolved story”. Payoff can close a question or phase while broader work continues.
Existing position-sensitive code worth reusing: StoryPointContextService.BuildThreads.
It gates introduction by the selected prefix, removes threads whose actual-resolution boundary lies in that prefix, and otherwise closes on the latest Introduced/Payoff/Resolved role if that role is Payoff/Resolved.
It displays the last event role and does not apply a globally Resolved status backward through the manuscript.
This can treat Payoff as closed while canonical status stays Introduced, or treat a later Introduced as reopening if no actual boundary blocks it.
PlotLine.Tests/StoryPointTests.cs, ThreadsAndWarnings, covers future-state isolation and closure without an actual boundary; workspace tests cover composition/gaps/scenario ordering, not full lifecycle reconciliation.
Reuse that temporal discipline, but explicitly reconcile its Payoff-as-closure assumption before promoting it into universal health semantics.
Boundary-based Not Started, expected-end overdue and continued-beyond-end are derivable comparisons when the boundary exists in the selected order. Missing boundaries, partial scenarios or absence of events must produce unknown/incomplete evidence rather than definite lifecycle failure. A first/last event can be compared with boundaries now; it cannot prove which conflicting stored value the author intended.
F. Book vs Project Scope
PlotLines.ProjectID is required and BookID optional; a thread inherits its parent's scope. Book selectors include project lines plus lines for that book.
A null BookID means available across the project, not “author explicitly intends a sequel continuation”. A book-owned line is not a database guarantee that all child events belong to that book.
Books carry ordering (SortOrder/BookNumber), archive and workflow status; NarrativeSceneOrder supplies each current book's final scene and the project's current final scene.
Thus current book end, next existing ordered book, current project end and line ownership are identifiable without a new schema.
The end of currently recorded scenes is not proof that a book/project is finished or that a sequel will never be added.
Later-book events can prove observed continuation; they cannot establish intentionally deferred closure before that later book is written.
Structured intended completion scope/resumption and expected cross-book closure are missing. Candidate BookStatus or prose Summary may suggest them but are not author-confirmed scope policy.
G. Intentional Dormancy / Author Intent
Exists: manually selected Dormant; manually selected Abandoned; planned/actual end scenes; free-text Summary/event descriptions.
Dormant currently remains an open status and is not an automatic suppression of the >8 scene rules.
Persisted ContinuityWarnings support IsIntentional/IsDismissed (ContinuityWarning_MarkIntentional, SetState). This records a decision about a warning, not a thread's planned resumption.
ContinuityWarningAcknowledgements (migration 065) additionally supports warning type, scene, character, asset, user and notes; it has no PlotThread/PlotLine key or resume-until scene.
These mechanisms should be reused where identities fit; existing acknowledgements must not be assumed to suppress Timeline SVG warnings or analytics flags.
No structured “resume after scene/book”, “intentionally unresolved here”, “continues in another book”, “resolved off-page”, or “review only after point X” was found.
Free text can record any of those intentions today, but reliable automatic interpretation is missing. Abandoned explicitly expresses dropping work, not a warning-worthy defect.
H. Health Check Feasibility Matrix
“Already supported” means an existing flag/rule, with the limitations above; “derivable” means a factual observation, not an automatic writing-error verdict.
| # | Candidate check | Classification | Qualification |
|---|---|---|---|
| 1 | No contribution since introduction | Derivable with existing data | Introduction boundary/role plus no later scene touch. |
| 2 | No contribution for N scenes | Already supported | >8 thread / >=10 rendered-line heuristics; all roles count. |
| 3 | No contribution for N chapters | Derivable with existing data | Use ordered BookID/ChapterID, not chapter-number subtraction. |
| 4 | No contribution for N manuscript words | Derivable with existing data | Source word counts plus prefix sums; unavailable counts remain unknown. |
| 5 | Long story-time silence | Not currently reliable | Calculate only when chronology is sufficiently explicit/comparable. |
| 6 | Introduced but never developed | Derivable with existing data | A documented role set can detect absent development; not semantic inadequacy. |
| 7 | Question raised but never answered | Already supported | Thread-level existence flag; no per-question pairing or guarantee an Answer answers this question. |
| 8 | Clue planted without apparent payoff | Already supported | Coarse thread-level closure-role existence, not evidence of actual payoff. |
| 9 | Ready For Payoff but not paid off | Derivable with existing data | Stored status plus absence of closure roles; readiness itself remains manual. |
| 10 | Resolved then later development | Derivable with existing data | Choose explicit resolution signal and compare distinct narrative positions; status has no effective-position history. |
| 11 | Abandoned then later development | Derivable with existing data | Structural Abandon gives a position; stored Abandoned alone does not date the decision. |
| 12 | Branch has no continuation | Derivable with existing data | Check stored target and later target events; causal adequacy remains unproved. |
| 13 | Split target never develops | Derivable with existing data | Inspect each explicit target's events after split; do not infer missing targets. |
| 14 | Merge target missing | Derivable with existing data | Missing/archived/out-of-scope target must be distinguished; hidden lane is not missing data. |
| 15 | Thread at book end unresolved | Derivable with existing data | Report unresolved under named signal at that book cutoff, not “should resolve here”. |
| 16 | Book-owned line at book end unresolved | Derivable with existing data | Aggregate child/event evidence; line closure policy is not stored. |
| 17 | Project line deliberately continues after this book | Needs small model addition | Later events prove observed continuation only; deliberate carry-over requires intent. |
| 18 | Project line unresolved at final project end | Needs small model addition | Current-end observation is derivable; intended final completion scope is not established. |
| 19 | No events inside declared boundaries | Derivable with existing data | Optional boundary availability and inclusive/exclusive convention required. |
| 20 | Events outside declared boundaries | Derivable with existing data | A disagreement finding, not automatically invalid membership. |
| 21 | Long silence then sudden resolution | Derivable with existing data | Spacing plus explicit role; “suspiciously weak” is not derivable quality. |
| 22 | Line has only one contribution | Derivable with existing data | Specify one event versus one distinct scene. |
| 23 | Line has threads that never start | Derivable with existing data | No events/introduction observable; future planning may be healthy. |
| 24 | Line marked resolved with open children | Not currently reliable | No canonical line status; structural Resolve can supply only a proxy contradiction check. |
| 25 | All children resolved, no line resolution | Derivable with existing data | Compare child statuses against absence of structural Resolve, including zero-child guard; absence is not itself unhealthy. |
I. Discovery Examples
Read-only snapshot: project 4085 / book 6097, both titled “The Alpha Flame”; the earlier data audit identifies this as Discovery. One active book; current final global scene index 299. Only four thread examples and one line gap are used here; no new complete manuscript audit was performed.
- Sisters, line 16: largest current canonical line gap is index 113 to 233: 119 intervening scenes, chapters 20 to 39 (the display formula gives 18 whole chapters). This demonstrates quiet spacing, not forgotten intent.
- First Sparks: Recognition Before Proof, thread 29: status Introduced; introduction boundary index 20, but actual first event index 3. Payoff and actual-resolution boundary at 99; later Developed at 113 and Introduced through 273. Status, boundary and position-sensitive closure do not provide one consistent answer.
- Proof and Belonging, thread 35: status Planned; Developed at 256, Revealed at 261, Payoff at 262; introduction boundary at 261 and actual resolution at 262. No Introduced/Resolved role exists. “Not Started because Planned” would be wrong; Payoff does not advance status.
- Edges of Tenderness, thread 28: status Resolved; introduction boundary 41, earlier Introduced event at 5, final Resolved at 298. Resolution evidence agrees at the end, but the stored introduction omits earlier contributions.
- Bent Lines, Straight Cop, thread 27: status Planned despite Developed at 160/285 and Clue Planted at 212; no payoff/reveal/answer/resolution role. At index 299, latest touch is 14 positions behind, so existing analytics can flag both computed dormancy and clue-without-payoff despite stored Planned.
All five active parent lines in this inspected project are book-owned (6097); no active next book exists. There is no genuine project-line/cross-book example here to validate intended continuation; do not invent one.
J. Gaps in the Current Model
- No common resolution precedence or reconciliation contract across status, roles, structural events, actual boundaries and Story Point.
- No formal meaningful-progress role policy; all-touch measurements currently mask silence through mentions/notes.
- No structured scoped author intent, scheduled review/resumption, or intended final closure book/project point.
- No status effective-position history; timestamps/activity cannot reconstruct manuscript-relative author decisions.
- No matched question/answer or clue/payoff identity within a thread; existing flags are coarse existential checks.
- Display chapter arithmetic, partial order coverage and current-vs-final scope require explicit handling before health claims.
- Existing independent warning identities/suppressions and thresholds need one documented policy, not another parallel system.
K. Minimum Recommended Design
Keep three outputs separate: stored author status, observed narrative state at a cutoff, and health/review findings with evidence. Existing data can immediately support Not Started/no recorded touch, Active/recorded contributions, measured silence, explicit resolution/abandon observations, and status/boundary disagreements.
| Possible observed state | Direct stored signal | Safe derivation / remaining uncertainty |
|---|---|---|
| Not Started | Planned is a planning signal only. | No touch before cutoff; unknown if associations are incomplete. |
| Introduced / Active | Introduced or Developing status; introduction boundary. | Ordered introduction/development roles support observed activity; define meaningful roles explicitly. |
| Dormant | Dormant status. | Measured silence is available; intentionality and expected resumption are missing. |
| Ready for Payoff | Ready For Payoff status. | No reliable automatic readiness derivation; keep author judgement. |
| Resolved | Resolved status, actual boundary, Resolved role, structural Resolve. | Show each signal and cutoff; competing signals need an explicit precedence policy. |
| Abandoned | Abandoned status or structural Abandon. | Event supplies a narrative position; undated status alone cannot locate abandonment. |
Missing events do not prove Not Started; Note alone does not prove Active meaningful development. Label these as recorded evidence with coverage, not omniscient state. Stored Dormant/Ready For Payoff/Abandoned are direct signals; elapsed silence is derivable, but intentional dormancy, readiness, satisfactory resolution and deliberate carry-over are not inferable reliably. Reuse canonical event roles, thread fields, narrative ordering, Story Point cutoff discipline, analytics predicates and Continuity decisions. A runtime evaluator need not persist another state field. Roll line observations up from child threads and explicit structural events without inventing a canonical line status or letting one resolved child resolve every sibling. For intentional monitoring, the smallest eventual model addition is an optional author-intent policy attached to a line or thread: disposition/reason, intended closure scope and optional resume/review scene or book. Reuse existing planned-resolution boundaries rather than duplicating them. Do not require that addition for the first factual, read-only health pass; do require explicit author intent before claiming deliberate continuation or suppressing until an expected point. Keep readiness, intentional silence, off-page/open endings, abandonment and completion expectations manual. Story Intelligence may later propose evidence-backed interpretations for review, not overwrite those decisions. Never automatically declare a gap, ordinary resolution without a merge, or unresolved book ending a writing error. Never auto-resolve records, alter membership, or infer branch causality from adjacency.
L. Recommended Next Implementation Pass
Implement one bounded read-only workspace health evaluator over canonical events/threads and the selected complete order/cutoff; no prompt changes or regenerated intelligence.
Return separate stored status, observed role/boundary evidence and review findings keyed by entity/rule/scope/order. Report missing order/boundary coverage explicitly.
First rules: scene silence using existing thresholds with their provenance; contribution counts; unstarted recorded threads; coarse unanswered question/clue flags; before-introduction resolution; status/boundary contradictions; later events after explicit closure; explicit target existence/continuation.
For chapter silence, count ordered chapter identities. Defer word/time thresholds, semantic weak-ending judgements and new intent editing to a later focused pass.
Document role sets and closure precedence before implementation; retain separate Payoff and Resolved evidence and expose disagreements rather than silently treating them as interchangeable.
Do not port Timeline's “resolution requires merge/split/branch” heuristic or call its endpoint rule a validated dangling-target check.
Keep Plot Threads management authoritative for status/boundary editing; the map/inspector, Story Health, Timeline and dashboard display observations. Scene/thread event editors remain authoritative for contribution edits; Continuity retains warning decisions.
Add focused tests for the live-style contradictions above, empty/no-event threads, all-touch versus meaningful-role spacing, book cutoff versus project end, partial/scenario order, shared-scene deduplication and existing intentional-warning handling.
Reuse/extend StoryPointTests and PlotLineWorkspaceTests; current tests do not certify a complete health system. No builds/tests were executed during this documentation-only investigation, and no stateful validators were invoked.
The only repository file created by this pass is this report; pre-existing implementation changes were preserved. No database writes, schema changes, SQL edits, production access or deployment occurred.