11 KiB
Main Characters attribute workspace
The directory retains its existing CharacterCardLayout.ColumnSpan, full DefaultDescription, portraits, names, details links, Edit links and Archive forms. There is no card-height or biography-length rule in this feature. Assignment never submits the Character Editor model.
Canonical model audit
- Story importance: nullable integer
CharacterImportance. The editor assigns Major 10, Supporting 6, Minor 2 and Unclassified NULL. Existing intermediate values are retained; display uses the existing workspace bands (8+, 4+, 1+, otherwise Unclassified). No import defaults change. - Life status: nullable
IsDeceased: false = Living, true = Deceased, NULL = Unrecorded. Independent ofIsArchivedand without inferred death date, scene or knowledge. - Sex:
SexValueIDplus canonical textSex, using active system values and the project owner's customCharacterSexValues. Existing catalogue values are reusable. “Add new…” stays in the editor and follows its existing owner-scoped get/create workflow. Legacy text without an ID is displayed as recorded and can be restored exactly by Undo. - Quick Add Bar: existing boolean
ShowInQuickAddBar(Included / Excluded). - Eye colour:
EyeColouris free text; there is no reusable canonical catalogue. It remains in the editor to avoid creating a competing vocabulary. Height, birth date, age, biographies, preferred names and aliases remain editor fields. - Other existing lookups (scene role/presence, relationship state, knowledge state) describe other records, not global character attributes; they are not directory assignments.
Shared character attribute icon standard
CharacterQuickAttributes.Definitions supplies IDs, canonical values, labels, icon keys and semantic theme tones for the sidebar, indicators and context menus. SVG paths come from ApplicationRibbon.Icon; attribute-specific additions use the existing ribbon SVG vocabulary. The directory fetches the catalogue once per authenticated refresh, never per card.
| Attribute | Icon key | Theme tone |
|---|---|---|
| Major (filled) | attribute-star-filled | warning (gold intention) |
| Supporting (half-filled) | attribute-star-half | info (blue intention) |
| Minor (outline) | attribute-star | secondary |
| Unclassified / unrecorded / not set | help | secondary |
| Living | attribute-heart | success |
| Deceased | attribute-flower | data-5 (existing purple theme palette) |
| Male (canonical system value) | sex-male (Mars) | info |
| Female (canonical system value) | sex-female (Venus) | data-7 (theme rose) |
| Other / custom / unrecognised recorded legacy sex | sex-other (combined Venus/Mars) | data-5 |
| Quick Add included | attribute-pin | primary |
| Quick Add excluded | attribute-unpin | secondary |
All indicators have the full attribute/value in their tooltip and accessible name. Shapes, labels, menu checks and selection outlines supplement colour. Unrecorded life status is visibly unknown; no Living default is inferred. Legacy sex text is never represented as “Not set”. Additional discrete fields require one definition plus explicit focused persistence and validation; this is not a generic entity framework.
Persistence, concurrency and Undo
Migration 323_CharacterQuickAttributes.sql adds two procedures, without new data stores or changes to historical migrations:
Character_QuickAttributes_Readreturns only active, authorised character attribute snapshots, without biographies.Character_QuickAttributes_Assignaccepts a project, acting user, attribute and a JSON selection. It locks and authorises every active character against the same active project and checks each exactUpdatedDate. Only Owner/Collaborator can write. A failure rolls back the complete selection. No-op rows do not change timestamps or produce invalidations. Only the selected column (and the canonical sex ID/text pair) changes;UpdatedDaterecords the update.
All drag, explicit Assign and menu interactions POST the same antiforgery-protected /CharacterAttributes/Assign endpoint. The returned snapshots update icons/counts/filter visibility without replacing cards, changing order or reloading the page. Stored snapshots are captured under the write locks and returned after commit.
The server returns a protected, author-bound, ten-minute Undo receipt containing each changed character's individual previous value and post-write timestamp. /CharacterAttributes/Undo verifies the receipt before using the same procedure. Restore also checks every current timestamp, so even an unrelated subsequent character edit conservatively prevents stale Undo. Legacy sex text and intermediate importance values can be restored exactly. A toast action captures its own receipt, rather than accidentally undoing a later operation. A persistent toolbar Undo button offers the same accessible operation.
Interaction and integration
- The sidebar is sticky, with bounded internal scrolling and collapsible groups. Its expanded preference uses the existing user/project-scoped local UI preference convention; narrow layouts use a compact panel above the unchanged responsive grid.
- Filters combine across attributes. Counts respect other active attribute filters. Select displayed includes only visible cards; hidden selections are removed when filtering. Checkboxes, Ctrl/Cmd-click and Shift-click ranges support bulk assignment. Dragging uses a separate handle, leaving biography selection, details links and existing form buttons intact.
- The existing
PlotDirectorContextMenusprovider handles individual and selected scopes, nested submenus, viewport positioning, dismissal and keyboard navigation. This feature adds optionalcheckedandtonecommand properties, and exposesopenAt/closefor component invocation. It does not add another menu framework or suppress context menus outside the existing shell policy. Ctrl-right-click and text selection retain existing shell/browser behavior. Open/Edit/Archive appear only for an individual; Archive submits its original confirmation-protected form. - The shared toast service accepts an optional
{action:{label,run}}; content remains plain text, with existing roles, bounds, timing and dismissal. There is no separate notification host. - Successful writes emit one lightweight existing
ContextInvalidatedhint (projectId,kind: characters) throughContextWorkspaceNotifications. The directory reusesPlotDirectorPresenceConnection, with authenticated snapshot retrieval and no per-card connections. The main-window fallback announces that same connection and its readiness even when the optional Word status control is hidden;context-presence-fallback.cjschecks one connection/event/subscription/registration. Existing Character Details and Context listeners continue their existing refresh behavior, including Held Context; no position/focus command is emitted.
Verification
Build and executable harness must run serially. CharacterQuickAttributesTests checks catalogue/custom/unknown semantics, biography-free snapshots, protected Undo author/expiry/tamper rejection and endpoint boundaries. PlotLine.Tests/Sql/CharacterQuickAttributes.sql refuses non-qualification databases and exercises atomic persistence on disposable characters in a disposable database copy.
With --toolbar-browser-host running, node PlotLine.Tests/Browser/character-attributes.cjs renders the actual compiled Characters Razor view and production scripts with isolated HTTP state. It covers 10/100/500 cards and records performance/screenshot artifacts in /tmp. xvfb-run -a node PlotLine.Tests/Browser/character-attributes.cjs --installed installs and launches a real Chromium app, asserting standalone display mode; it is not a matchMedia simulation. Neither browser fixture mutates an author's manuscript. character-attributes-held-context.cjs verifies the real Context Razor/scripts refresh character data at Held scene 22 while shared focus moves to scene 23, without another connection or a held-position change.
Fixture HTTP responses do not substitute for authenticated Development persistence smoke checks or manifest-based schema deployment qualification. Delivery evidence must distinguish these checks explicitly.
Character Type and species
Migration 324 adds canonical CharacterTypeCode (person, animal, supernatural, artificial, other, unclassified) and optional free-text Species (200 characters). Existing records receive only unclassified; no name/manuscript inference or AI work occurs. CharacterTypes.Values is the shared vocabulary, using person/paw/sparkles/robot/group/help SVGs. Type is another value group in the same assignment procedure, filtering, indicators, menu and protected Undo pipeline. Species stays in the editor and is never cleared by Type assignment.
The editor explicitly supplies classification with an original timestamp. Existing callers that do not opt in preserve Type/species; existing editor forms reject concurrent classification changes. Get/list/reference projections and project exports include the new fields; the existing schema-driven restore accepts them and supplies Unclassified for old backups. There is no type-dependent exclusion from appearances, relationships, life status, sex, importance, archival or Quick Add.
PlotLine.Tests/Sql/CharacterTypes.sql runs on a disposable qualification copy and covers no-inference migration, bulk/individual updates, species retention, independent attributes, Undo, editor persistence, old caller preservation and invalid codes. The normal harness checks the vocabulary, snapshot and server-side validation. Character browser fixtures now include Type assignment/Undo through the common UI.
The Character Editor concurrency version is sent explicitly as Dapper DbType.DateTime2, preserving the Characters.UpdatedDate datetime2(7) precision. SQL datetime rounding can otherwise produce a false stale-version failure after quick assignment. The isolated real-repository --character-editor-precision-database check covers a seven-digit fractional timestamp, a successful ordinary editor save, stale-version rejection and preservation of a newer concurrent biography. Legacy save callers retain the existing opt-in classification behaviour.
UI refinement standard
Shared group order is Story importance, Life status, Sex, Character Type, Quick Add Bar, on the sidebar, cards and attribute menus. Filled and half-filled stars use the shared ribbon icon Filled metadata with compound even-odd SVG geometry; the remaining star is outlined. The same presentation metadata reaches directory icons and the existing context-menu icon catalogue. Custom Sex values retain their IDs and labels; they use the combined symbol without inferring Male/Female from arbitrary labels. Legacy recorded sex uses the shared fallback rather than another group's icon by position.
Attribute gold/blue/neutral use existing --pd-warning, --pd-info, --pd-muted. Rose/purple data tones mix with theme text for contrast in light/dark palettes; no new hardcoded colour catalogue or wider icon migration is introduced.
Recorded Male/Female text without a SexValueID uses exact trimmed, case-insensitive matching metadata from the system catalogue definitions. It shares Mars/Venus icons, blue/rose tones, filters/counts and current-value menu ticks with catalogue-backed values. No record is rewritten or inferred. Other/custom legacy labels remain recorded, with the combined symbol. Female uses the theme rose data tone directly (or a danger/character-tone rose blend) to retain its pink hue.