Keep the Line a Prop or Character was made from (#205) #216

Merged
crowmaki merged 2 commits from issue-205-source-line into main 2026-10-15 18:54:47 +00:00
Owner

Closes #205

What

A Prop or Character made from a selection in a Line's text now keeps that Line.

  • Storage: schema V50 adds source_line_id (FK to line) on prop and character. The link is part of the row snapshot, so undo/redo of a create, and undo of a delete, take it out and put it back.
  • Reads: source_line on CharacterView, CharacterDetail and PropView, and sourceLineId on CharacterDto, CharacterDetailDto and PropDto, list_entities and read_character. The MCP create_prop / create_character tools now return the stored link instead of echoing fromLineId.
  • App: the Prop and Character inspectors show "From Scene N, ", linked to the Scene in the Script.

Decisions

  • Merge: the surviving Character keeps its own source Line, or takes the absorbed one's if it has none, as with blank identity fields. Undo restores it. The tombstone keeps its own. Props have no merge.
  • Re-import: there is none (a second import is refused) and nothing deletes Lines, so a link always resolves. CONTEXT.md and the V50 comment say that anything that drops Lines must clear the links to them and keep the Entities. Until then, the foreign key makes deleting a linked Line fail instead of leaving a dangling link.

Tests

  • Core: entities (read-back, undo/redo of create and delete) and merge (survivor rule and undo).
  • MCP: mcp_entities (list_entities, read_character, undo).
  • Frontend: sourceLine.test.ts.
  • Full cargo test --workspace, bun test and svelte-check pass.
Closes #205 ## What A Prop or Character made from a selection in a Line's text now keeps that Line. - **Storage:** schema V50 adds `source_line_id` (FK to `line`) on `prop` and `character`. The link is part of the row snapshot, so undo/redo of a create, and undo of a delete, take it out and put it back. - **Reads:** `source_line` on `CharacterView`, `CharacterDetail` and `PropView`, and `sourceLineId` on `CharacterDto`, `CharacterDetailDto` and `PropDto`, `list_entities` and `read_character`. The MCP `create_prop` / `create_character` tools now return the stored link instead of echoing `fromLineId`. - **App:** the Prop and Character inspectors show "From Scene N, <line caption>", linked to the Scene in the Script. ## Decisions - **Merge:** the surviving Character keeps its own source Line, or takes the absorbed one's if it has none, as with blank identity fields. Undo restores it. The tombstone keeps its own. Props have no merge. - **Re-import:** there is none (a second import is refused) and nothing deletes Lines, so a link always resolves. CONTEXT.md and the V50 comment say that anything that drops Lines must clear the links to them and keep the Entities. Until then, the foreign key makes deleting a linked Line fail instead of leaving a dangling link. ## Tests - Core: `entities` (read-back, undo/redo of create and delete) and `merge` (survivor rule and undo). - MCP: `mcp_entities` (`list_entities`, `read_character`, undo). - Frontend: `sourceLine.test.ts`. - Full `cargo test --workspace`, `bun test` and `svelte-check` pass.
A Prop or Character made from a selection in a Line's text now stores
that Line as source_line_id (schema V50) and reads back with it: in
CharacterView, CharacterDetail and PropView, their DTOs, list_entities
and read_character. The link lives on the row snapshot, so undo of the
create, and undo of a delete, take it out and put it back.

Merging Characters: the survivor keeps its own source Line, or takes the
absorbed one's if it has none, like blank identity fields; undo restores
it. The tombstone keeps its own.

Re-import: there is none (a second import is refused) and Lines are
never deleted, so the link always resolves. The column is a foreign key,
and the migration notes that anything that drops a Line must clear it.

The Prop and Character inspectors show the source Line, linked to its
Scene in the Script. The MCP create tools now read the stored link
instead of echoing fromLineId.
crowmaki deleted branch issue-205-source-line 2026-10-15 18:54:47 +00:00
Sign in to join this conversation.
No description provided.