8.3 KiB
Locations workspace
The current hierarchical picker, data-driven taxonomy and shared Attributes composition are documented in Locations refinements and the shared Attributes standard. The mutation/merge safeguards below remain in force.
The main directory uses the existing dbo.Locations identifiers. LocationWorkspaceController
reads a flat directory and recorded associations using Dapper and Location_WorkspaceRead, with LocationTypeTaxonomy_Read for canonical presentation.
The browser builds hierarchy paths and child indexes without a recursive SQL view or per-location
queries. The initial MVC request reads the authorised project only. Associated manuscript prose
is never loaded. Existing Details/Edit, archive, scene assignment and relationship forms remain.
The three panels reuse workspace-surface.js (a Locations profile), shared theme tokens,
PlotDirectorContextMenus, PlotDirector.toast and ContextWorkspaceNotifications.Invalidate.
Browser and installed PWA use the same commands and same-window links. Nothing changes narrative
focus or invokes AI/geocoding. Location images are not currently a canonical location attribute;
there are no fabricated image placeholders.
Canonical attributes
Existing types: Country, Region, Town, Village, Street, Building, Floor, Room, Outdoor Area, Vehicle Interior, Landmark and Other. Migration 335 adds Planet, District, Natural Feature and City without changing existing IDs or values. Existing aliases, description, Quick Add inclusion, Word Companion exclusion and detection priority are retained. Quick Add and detection exclusion are suitable quick switches; numeric detection priority remains in the full form.
Locations.Classification is optional: NULL (Unclassified), Real, Fictional, Fictionalised.
It is independent of type. No existing location is classified automatically. Classification
is edited in the workspace and preserved by existing full forms, which do not update this column.
LocationItem.Classification and the existing export selector preserve it through project backups;
the generic restore contract already accepts the additional column. LocationWorkspaceIcons adapts canonical taxonomy metadata to opt-in shared ribbon icons without
changing other consumers. Migration 338 adds 81 further assignable types and a 105-node metadata
hierarchy while retaining every existing ID/name; see the refinements catalogue/extension contract.
Mutation and hierarchy safety
Location_WorkspaceAssign validates project role (Owner/Collaborator), active project/location,
canonical values, parent membership and optimistic UpdatedDate versions inside a transaction.
Only the selected attribute is written. Permanent containment can be arbitrarily nested.
The final parent graph is checked on the server, including Undo; cycles and self/descendant moves
are rejected. Root is NULL. For ordinary bulk moves, selected descendants whose ancestor is also
selected are omitted, retaining complete branches. Undo restores only the roots actually changed.
No-op assignments do not update timestamps or audit history. Unavailable ancestors are shown as
“Parent unavailable”; original parent IDs are retained, and the Root filter means an actual NULL
parent. Recorded unavailable types remain visible in Details rather than being relabelled Unclassified.
Each mutation records the established project audit. Audit result sets are captured internally. The response returns exact post-save versions and changed values. A user-bound, protected receipt expires after ten minutes; Undo compares the current version before applying the original value. A stale receipt cannot overwrite later edits. The workspace offers one-step Undo, not a redo toggle. The browser updates its directory, counts and details without navigating/reloading. Live invalidations refresh other windows; dirty descriptions defer refresh. Local attribute changes refresh the rest of Details while retaining the existing description editor and its draft. Explicit Save/Cancel and discard confirmation protect unsaved descriptions.
Migration 336 gives the traditional Location_Save procedure the same project-first locking,
project membership and cycle checks, while preserving unchanged historical archived-parent references.
Its alias writes stay transactional; import callers retain their outer transaction. Full-form validation
errors return the posted draft with an inline message rather than silently moving a self-parent to root.
Migration 337 makes every existing location writer advance UpdatedDate strictly, even when the
clock has not advanced. Merge also versions children whose parent changes, so an older parent Undo
cannot overwrite their post-merge containment. Binary and length comparisons retain case-only and
trailing-space description differences; no existing record is rewritten by this migration.
Location_WorkspaceCreate validates ownership/parent and creates a child transactionally from only
a name. Naming matches existing forms (required, 200 characters; repeated names are allowed).
Aliases and manuscript text are never rewritten by rename. Traditional creation remains available.
Merge
Workspace merge is explicit, reviewed and has no Undo. The author chooses the survivor and sees
both descriptions and type/classification conflicts. Location_WorkspaceMerge validates both
record versions and the editing role, then wraps the established Location_Merge transaction.
That operation transfers scene/character/asset references, children, aliases, floor plans,
import references and non-hierarchical links; direct source/survivor links are archived. The forward-only extension to the established merge
also transfers MapFeatures.LocationID and increments affected map revisions without changing any
feature ID or geometry. Different descriptions are retained together with a source label.
An unclassified survivor inherits source classification; otherwise survivor classification wins.
Survivor name, type and parent remain. Source records and original information stay archived.
Geographic confirmation evidence stays with its original record and is not inferred for the survivor.
The older full merge form remains available and receives the same preservation safeguards. The
workspace additionally previews conflicts and rejects records changed since review. Dapper merge
parameters explicitly use DbType.DateTime2, preserving the seven-digit reviewed timestamps.
Filters, associations and preferences
Map/floor-plan indicators come from MapFeatures and direct plan/floor/block links. Multiple links are listed individually rather than selecting one implicitly. Map links open the existing selected map; floor-plan links open its existing editor. Location/feature reveal inside those editors is limited to their current route contracts. Scene use counts distinct recorded primary, character current/entry/exit and asset scene assignments; it is not textual name matching. Relationship, explicitly located character and current asset counts come from authoritative records; full evidence remains on Details. Derived filters are read-only. Branch-filter results retain ancestors without modifying permanent expansion state.
pd.locations.workspace.v1.<user>.<project> stores view, sorting, expanded branches, collapsed
panels and expanded attribute groups. The shared divider key is independently scoped to the same
user/project. Dragging dividers writes local preferences only on completion. Narrow displays stack
the panels, without horizontal page overflow. Tree keyboard commands: arrows, Home/End, Enter,
Space selection, F2 rename, Shift+F10/context-menu key. Shared menus handle focus/dismissal.
Boundaries and limitations
Permanent containment is separate from sensory/travel relationships and SceneAssetLocations /
asset current location. A vehicle temporarily parked somewhere must not become its permanent child
unless the author explicitly chooses that hierarchy. No temporal asset tracking is added.
No Context, Maps, Floor Plans, Assets, Characters or Names workspace is redesigned.
Geography confirmations are not regenerated after workspace changes. Existing explicit geography
review remains available. Large trees render only expanded branches; card view renders matching
cards, with complete descriptions and variable height. There is no card virtualization.
See Acceptance.md for measured verification and remaining limitations.