PlotDirector/Docs/Writer/Main-Character-Workspace-20261123.md

17 KiB

Main Character workspace redesign — 23 November 2026

Phase 1 audit / preservation contract

Audit starts at CharactersController.Details → ICharacterService.GetCharacterDetailAsync → Views/Characters/Details.cshtml. The current GET loads every project character, relationship lookups/books, this character's relationship containers/events, the whole project character timeline and story timeline, all appearances, attribute events, knowledge and gallery images. This work precedes even the profile render. Existing URLs /Characters/Details/{id} must stay valid.

Existing capability Current persistence / source Workspace destination
Breadcrumbs, project ribbon, character/timeline return Existing navigation and authorised IDs Persistent shell/header
Portrait, thumbnail fallback, name Canonical Characters / shared _Avatar Compact persistent header
Major/supporting/minor importance CharacterImportance, existing character create/edit/save Header + Overview; explicit values preserved
Preferred name, aliases, set preferred CharacterAliases; SetPreferredName service/action Overview names dossier, same action
Description, sex, DOB, age/reference scene, height, eye colour, life status Character edit/save; canonical age display service Overview identity/profile; existing full edit
Generated summary, generated DOB/age/physical facts, status/message/last analysed Character enrichment persisted status, existing reanalyse POST and SI hub Overview analysis, separate from canonical profile; header reanalyse
Full character edit, merge Existing Edit/Save and Merge services/actions Header actions / Overview
Character export (normal/Markdown), archive/restore Existing Exports and canonical archive operations Header actions, archive retained
Gallery upload/caption, full image, crop/set avatar, remove avatar/image Existing UploadImage/CropAvatar/DeleteImage/RemoveAvatar Overview gallery disclosure and bounded page; same actions
Initial relationship add/edit; type, partner, state, intensity, reciprocity, reader awareness, initial book, notes SaveInitialRelationshipAsync → canonical Relationship_Save Relationships focused definition editor; advanced structural editing remains linked
Initial relationship removal/restore ArchiveRelationshipAsync → Relationship_Archive → Archive_Entity Direct confirmed Remove relationship on every related record
Current relationships, categories, direction, intensity/notes Canonical relationship definitions + verified ordered events Relationships Family/Story lenses + bounded records
Per-relationship initial/current state and event history RelationshipEvents, canonical ordering/evidence projection Selected relationship chronological history, bounded loading
All relationship events + related character/timeline links RelationshipEvent_ListByCharacter Relationship history filter and Evolution relationship category, preserving source links
Attribute history with values/descriptions/sources CharacterAttributeEvents / canonical classifications Evolution chronological explorer
Arc charts, scene metrics/markers, appearance/knowledge/relationship KPIs, continuity issues Existing Dynamics.Character, dynamics services Explicit Advanced arc / charts link in Evolution (existing endpoint retained)
Scene appearances, presence/role, outfit, condition/emotion, timeline/source SceneCharacters + scenes/chapters/books Appearances grouped, filtered, paged explorer
Canonical knowledge state, asset/thread, description, source point CharacterKnowledge + canonical KnowledgeStates / evidence Knowledge searchable/paged explorer with narrative cutoff
Existing knowledge timeline and continuity/review workflows Dynamics.Knowledge, canonical Scene editor / Review Centre Clear links in Knowledge; no generated prose reconstruction
Old fragment bookmarks #character-overview, #character-gallery, #character-relationships, #character-appearances Existing anchor navigation Mapped into the matching tab/disclosure by the workspace router

Removal audit

IsReciprocal is stored on one CharacterRelationships row. Canonical Relationship_Save updates/inserts that row; it does not manufacture a reverse row. Independently recorded reverse/different-type rows are separate authored facts and must be disclosed, not silently deleted. Relationship_Archive delegates to Archive_Entity, which marks only the definition archived with timestamps; dependent RelationshipEvents remain intact and restoration is available in Archived Items. This is the correct reversible removal operation for an erroneous parent/child definition, including one with historical events. The confirmation must name both characters, type, event count and separately recorded reverse/pair records retained.

RelationshipEvent_Delete is the existing single-event deletion operation. Event removal must stay distinct from definition archive. Dependencies/provenance must be checked before deletion and unsafe linked events must be blocked with their existing source/review route. New workspace management must wrap canonical operations with project permissions and original-record comparison under SQL locks, not introduce another delete implementation. No actual manuscript relationship is to be modified for testing.

Classification audit

Main character creation already defaults to Supporting (importance6). Scene quick-create currently leaves importance unrecorded, rather than explicitly Major. Existing author values and classification thresholds must not be migrated. Header labels will use Major ≥8, Supporting ≥4, Minor ≥1 and Unclassified otherwise; edit choices remain available through the existing editor.

Implementation and phase validation evidence follows below.

Implemented workspace and phase acceptance

The existing Character URL and ribbon now lead to a compact persistent identity header and five primary tabs. The shell reads identity, permissions, counts and age candidates; tab fragments fetch only their required bounded data. Tab, query, page and narrative point survive navigation; the remembered tab is scoped to the signed-in user and project. Existing fragment bookmarks map to their destination. Native dialog forms retain drafts on validation/concurrency failure, protect navigation and use the shared toast service. Existing presence and Story Intelligence connections are reused; tabs do not open connections.

  • Overview: responsive dossier with all canonical profile/age/life-status fields, known names and preferred-name action; description disclosure; bounded canonical family/story definition summaries; counts and three recent changes. Persisted enrichment is separate from author profile. Gallery retains uploads, captions, full images, avatar crop/set/remove and image removal, paged at 25. Full edit retains all aliases beyond the 50-name overview bound.
  • Relationships: reuses ContextFamilyExploration, its topology, project tree reader and the shared genealogical layout engine, including biological/adoptive/step links, partnerships, vertical generations and expandable recorded relatives. Family remains global author reference and works without a book/scene. Story reuses the canonical Context reader, relationship projection and selected-scene ordering. The diagram is bounded at 128 people/256 connections; re-centering explores further. Records are paged at 25 with selection synchronised to the diagram. Independently authored relative-to-relative links are managed from the appropriate relative's workspace.
  • Evolution: narrative book/chapter/scene groups, expandable changes, previous attribute values, actual classifications, evidence flags, book/category/search filters and source links; 25 entries per page. Existing charts, metrics, continuity issues and scene markers remain in the clearly linked advanced Arc workspace.
  • Appearances: 25-entry searchable/grouped pages retain role/presence, POV, appearance notes, outfit, condition, emotion and knowledge notes, plus direct scene/timeline links.
  • Knowledge: uses actual canonical knowledge-state text, source/evidence and review flags; search, book/state filters and narrative cutoff. Author reference does not imply viewpoint knowledge. Existing knowledge timeline and review/source workflows remain linked.

Focused relationship management

Definition editing deliberately preserves pair, type, direction, book and narrative boundaries. It supports notes and, for initial definitions, state/intensity/reader awareness. Structural edits remain one clear link away in the existing full Relationships Editor. Individual history events have their own focused state/intensity/awareness/description editor; event removal is explicitly distinct from definition removal.

Removal confirmation names both characters/type, identifies definition versus single event, reports dependent event count and independently authored pair records, and requires explicit confirmation. Definition removal calls canonical Relationship_Archive, retaining all events and Archived Items restoration. Single-event removal calls canonical RelationshipEvent_Delete. Evidence, review provenance or possible knowledge-source dependencies block direct event editing/removal and link to the source workflow. No second store or deletion implementation was introduced.

The new stored-procedure wrapper revalidates Owner/Collaborator access, relationship membership and SHA-256 definition/history version under SQL locks before invoking canonical save/archive/delete procedures. New history invalidates stale previews. Successful writes log canonical project activity and publish existing Context invalidation hints; the active list and diagram refresh without a page reload. Viewer controls are hidden and writes are independently rejected server-side.

Database rollout

Forward-only migrations 306 (bounded reads), 307 (authorised/concurrency-safe canonical management) and 308 (bounded definition summaries) were applied only to the verified PlotDirector_Development database. Existing numbered files were not changed after application. Before application, unique COPY_ONLY/CHECKSUM backups completed and passed RESTORE VERIFYONLY:

  • /var/opt/mssql/backup/character-workspace-20261123T093043Z.bak

The additional summary migration backup /var/opt/mssql/backup/character-workspace-summary-20261123T095708Z.bak also passed verification. These backups were verified, not restored. Migrations add/alter routines, with no bulk character or manuscript relationship mutation. Main create remains Supporting6; new scene quick-created characters explicitly use Minor2; existing values are unchanged.

Integrity and regression evidence

CharacterWorkspaceTests adds 15 passing service cases covering a thin header, bounded data, canonical ordering and future-state exclusion, labels, invalid queries, dependency previews, confirmation, stale/protected records and permissions. The explicit --character-workspace-database <disposable-scope> mode validates effective Development plus the disposable account prefix before creating any fixture. Every case rolls back all newly created characters/relationships/events. It passed parent archive/restore with retained events, one-row reciprocal handling, independent reverse-record preservation, family/story edits, one-event removal, concurrent-history rejection, permission rejection, confirmation and source-linked blocking. Existing manuscript relationships were not changed.

The actual Dapper reader was exercised read-only against an existing manuscript character: 55 relationship definitions, 509 overview-source changes, 755 evolution entries, 246 appearances and 282 knowledge entries. Each explorer returned at most 25 rows; SQL and .NET canonical scene order agreed, selected-point knowledge excluded later records, the management preview mapped its version/dependencies correctly, and the relationship checksum was identical before and after. No AI reanalysis was requested.

The Playwright suite exercises the actual Razor shell/partials with isolated fixture responses: five lazy tabs, bounded histories/pages, cached page state, selected narrative position, back/forward, character links, old gallery fragment, keyboard tabs and modal focus/Escape/draft handling, full-width modal fields, explicit archive consequences, list/tree refresh, event controls and protected-source blocking. Widths 1366, 1024, 768 and 390 all pass without whole-page horizontal overflow. CDP touch events verify actual tablet pan and pinch transforms. Existing Context Family and Story browser suites also pass after the shared reader/tree extraction. Native/SI connection counts remain stable across tab switches.

Screenshots captured during acceptance: /tmp/character-workspace-overview-desktop.png, /tmp/character-workspace-family-desktop.png, /tmp/character-workspace-tablet-family.png, /tmp/character-workspace-mobile.png. The dossier and tablet diagram have been visually inspected.

Preservation reconciliation and practical limits

All rows in the Phase 1 matrix remain in the workspace or have an explicit link to their existing editor/advanced view. The redesign does not remove chart/continuity capabilities. The canonical archive limitation is made visible: removal hides a definition and retains history; independently authored pair records remain. Source-linked events require their source/review workflow, rather than unsafe direct deletion. These are explicit supported safety boundaries, not missing author functionality.

Physical-device touch, assistive-technology screen-reader usability and author judgement of visual family complexity remain useful manual acceptance; automated tests cover touch emulation, keyboard, focus and responsive geometry. Family life status is labelled global author reference and does not invent a death scene. Ordering metadata is capped at 20,000 books/chapters/scenes per list; larger projects receive an explicit full-editor route instead of silent truncation. No production changes are authorised or performed.

Final build: dotnet build PlotLine.slnx passed with zero warnings/errors. Full executable regression harness passed 786 checks. The prior preferred-name/enrichment source assertions were updated to follow their moved profile partial; both capabilities are also exercised in the rendered browser workspace. The separate enrichment browser check proves initial/reconnect completed-run replay is silent and each later completed run refreshes the workspace exactly once, without AI work or page navigation.

Development delivery verification

The first qualified release 7ff5306 passed service activity, local/public GET (normal TLS), assembly informational-version and DLL/changed-asset SHA-256 checks. Authenticated live acceptance created a new disposable Supporting character and successfully added/edited its initial Parent definition. The test's note-based locator was then corrected to retain the canonical relationship ID; its isolated leftover definition and character were soft-archived under explicit disposable-scope guards. This did not touch baseline fixture relationships or any manuscript relationship.

Final integration review also disabled the shared generic delete-confirmation handler for the bespoke relationship operation form: its own scope/dependency preview and checkbox are the sole removal confirmation. Build (zero warnings/errors), all 15 focused service cases and the full workspace browser suite passed again, including an explicit assertion that the generic confirmation stays closed. The complete 786-check regression run had already passed before this form-attribute-only integration fix.

The actual Context My Windows navigation suite passed on Development: existing main-window reuse for scene, character, Names and Relationships, no extra windows, no Word navigation, unchanged Context scene. Final release and authenticated create/edit/archive/peer-hint verification are recorded below.

Final deployed application commit: ce5182951298a9f31d095806b90e147c259a52c5 (ce51829). Release archive: /srv/apps/plotdirector-dev/releases/character-workspace-verified-ce51829-20261123T100632Z; preserved previous installation: /srv/apps/plotdirector-dev/current-before-character-workspace-verified-ce51829-20261123T100632Z. The immediate pre-stop background-work guard passed. The service is active; local GET and public HTTPS GET both returned 200; DLL and all changed/reused assets matched publish SHA-256; assembly informational version identifies this commit. Recent logs contain only the existing HTTPS-redirection port warning and no application failures.

Authenticated live acceptance passed on this final build: new Supporting character, all five tabs/empty states, canonical initial Parent add, definition edit, rejected unsaved navigation, explicit dependency preview, direct archive, Family/Story refresh, and exactly one existing Context peer invalidation per add/edit/archive (three total). The Context scene remained unchanged. The newly created character was archived, and no baseline fixture or actual manuscript relationship was removed. The final fixture integrity smoke confirms no new qualification character or relationship remains active and both baseline fixture characters remain active. Production was untouched.