Materialize the trash — store, undo, and the container universe

Phase 2 swaps every consumer: Liveness and its ancestor walk are gone,
replaced by ItemContainer — a UUID set plus the container side it
lives on, presence the whole test, one selection boundary instead of
the old liveness law. Deletion stages by place: board cards move to
the trash at a store-minted head rank, trash-side delete is permanent
behind its confirmation, Delete Immediately skips the trash from
anywhere, lane delete captures the subtree and removes the folder.
Restore has no method at all — moveCards resolves members in either
container, so drag-out and cut-paste are the ordinary moves 13 calls
them, registering ordinary Move steps. The delete inverse moves the
card back to its captured lane and rank; redo replays the captured
trash rank, a value the gesture actually wrote; lane undo recreates
the subtree byte-faithfully in session. Purges register nothing —
where 13's trash section contradicts its own Rules on that, Rules
wins, filed for ruling. Staleness collapsed to present-or-absent: a
container is a path, so a foreign restore fails the delete step's
expectation structurally. Legacy tombstones migrate on the loose-file
tail hook, cards oldest-first so minting above top reproduces the
retired newest-first column, lanes returning live, one folded loss
row naming both directions. Put Back, restoreByDrag,
receiveRestoredCards, TrashEntry, and the kind machinery are deleted;
the trash column renders the container correctly with its full face
rework left to phase 3.

Claude-Session: https://claude.ai/code/session_01SR4XGjmBE16ZUYWpfFHXwY
This commit is contained in:
2026-07-28 17:47:56 -04:00
parent 16c10d61c3
commit 53bc71f7fb
53 changed files with 3459 additions and 3655 deletions
+7 -17
View File
@@ -46,20 +46,6 @@ enum DragKind: String, Codable, Sendable, Equatable {
/// stray drop into a text editor does something sane rather than nothing.
struct DragPayload: Codable, Sendable, Equatable {
/// Which side of the live/tombstoned boundary the drag started on a trash row's drag is a card
/// drag from the trashed side, and 04-interactions.md The trash gives it its own rules
/// (restore within the board, copy-out across boards).
enum Side: String, Codable, Sendable, Equatable {
case live
case trashed
init(_ liveness: Liveness) {
self = liveness == .live ? .live : .trashed
}
var liveness: Liveness { self == .live ? .live : .trashed }
}
/// One dragged item: its UUID, its folder on disk, and its title for the text representation.
struct Item: Codable, Sendable, Equatable {
var id: String
@@ -71,7 +57,11 @@ struct DragPayload: Codable, Sendable, Equatable {
var boardRoot: String
var kind: DragKind
var side: Side
/// Which container the drag started in a trash card's drag is a card drag from `.trash`, which
/// is the whole of what makes its within-board drop a restore (04-interactions.md The trash).
/// `ItemContainer` is `String`-backed and `Codable` precisely so it can ride a pasteboard.
var container: ItemContainer
/// The dragged items **in flatten order** "lane `order` first, then card `order`"
/// (04-interactions.md Drag and drop). The drop commits trust this order rather than
@@ -97,10 +87,10 @@ struct DragPayload: Codable, Sendable, Equatable {
try? JSONEncoder().encode(self)
}
init(boardRoot: URL, kind: DragKind, side: Liveness, items: [Item]) {
init(boardRoot: URL, kind: DragKind, container: ItemContainer, items: [Item]) {
self.boardRoot = boardRoot.path
self.kind = kind
self.side = Side(side)
self.container = container
self.items = items
}