The seams unbind — the provider is always native, and the git stack compiles dead
Step 4 of strategy/01-git-excision.md, the entangled one: AppModel's makeHistoryProvider collapses to the native provider (the seam stays injectable per the reversibility posture), the session's git state and its wiring go (wireGitUndo, wireBranchSwitching, the card-session staging threading), BoardStore sheds commitSeam and the identity-history ranker (the loader's nil-safe rung now tops out at birth date — today's no-git behavior), SessionSettleGate keeps the gate and inherits the path utility it borrowed, BoardRegistry drops the persisted operation stamp (decode-safe), and the git banner family leaves BannerCenter with its announcer and accessibility phrases. One missed harvest tie severed (the narrator's root subject is its own now). Nothing outside Kanban/Git/ references the stack — proven by sweep. 2,855 tests green. Claude-Session: https://claude.ai/code/session_014PtZdPwqZuqEDLc6wZMtEy
This commit is contained in:
@@ -62,49 +62,6 @@ private func openBoard(_ model: AppModel, at url: URL) throws -> BoardWindowRef
|
||||
return ref
|
||||
}
|
||||
|
||||
/// The same board with a **real repository** at its root, root commit and all — what a Pro session
|
||||
/// detects as mode `git`, and therefore the only shape that composes a branch switcher to test the
|
||||
/// settle step's seams through.
|
||||
@MainActor
|
||||
private func makeProGitBoard() throws -> WriterFixture {
|
||||
let fixture = try makeMixedBoard()
|
||||
guard case .success = GitRepository.create(at: fixture.root) else {
|
||||
fixture.tearDown()
|
||||
Issue.record("could not initialize a repository for the fixture board")
|
||||
throw CocoaError(.fileWriteUnknown)
|
||||
}
|
||||
return fixture
|
||||
}
|
||||
|
||||
/// Opens a card window the way its host does — registered with the board's session — and leaves it
|
||||
/// holding one fine step and an open Edit session, so it both *has* a stack to lose and answers the
|
||||
/// save-or-discard step's `needsSettling` with `true`.
|
||||
///
|
||||
/// The step is registered through `BoardStore.registerStep` rather than pushed onto the provider, so
|
||||
/// it is routed by the same line production routes a card-window gesture with (`on:` → the window's
|
||||
/// stack) and carries the raw write the close fold would look for.
|
||||
@MainActor
|
||||
@discardableResult
|
||||
private func openCardWindow(
|
||||
_ model: AppModel,
|
||||
board: BoardWindowRef,
|
||||
card id: String,
|
||||
store: BoardStore
|
||||
) -> CardWindowSession {
|
||||
let window = CardWindowSession()
|
||||
model.registerCardWindow(CardWindowRef(board: board, cardID: ItemID(rawValue: id)), session: window)
|
||||
window.body.beginEditSession()
|
||||
store.registerStep(
|
||||
"Edit Card",
|
||||
on: window.undo,
|
||||
undoExpects: [.present(.card(ItemID(rawValue: id)), .body("after\n"))],
|
||||
redoExpects: [.present(.card(ItemID(rawValue: id)), .body("before\n"))],
|
||||
undo: { _ in },
|
||||
redo: { _ in }
|
||||
)
|
||||
return window
|
||||
}
|
||||
|
||||
// MARK: - Tests
|
||||
|
||||
@MainActor
|
||||
@@ -319,101 +276,6 @@ struct AppModelTests {
|
||||
model.storeRegistry.release(try #require(model.session(for: ref)?.store))
|
||||
}
|
||||
|
||||
// MARK: The branch switch's settle
|
||||
|
||||
/// **"The settle also clears each open card window's fine undo stack"** (06-history-undo.md
|
||||
/// ▸ Branch switching, ruled 2026-07-31): "pre-switch steps describe the branch being left — Save
|
||||
/// All and Discard alike end with every window's stack empty … the windows stay open, following
|
||||
/// their cards onto the new branch with fresh stacks."
|
||||
///
|
||||
/// This is an `AppModel` test rather than a `GitBranchSwitcher` one because the clear is a fact
|
||||
/// about the **composition**: the switcher's settle seam, the card-window registry and the stacks
|
||||
/// themselves only meet in `wireBranchSwitching`, and a switcher wired by hand would be a test
|
||||
/// asserting its own wiring (the `a381fac` lesson, applied one card later).
|
||||
@Test(
|
||||
"The branch switch's settle empties every open card window's fine stack",
|
||||
arguments: [SessionSettleChoice.saveAll, .discard]
|
||||
)
|
||||
func theSettleClearsEveryFineStack(answering choice: SessionSettleChoice) async throws {
|
||||
let board = try makeProGitBoard()
|
||||
defer { board.tearDown() }
|
||||
let (model, tearDown) = try makeModel()
|
||||
defer { tearDown() }
|
||||
model.currentTier = { .pro }
|
||||
|
||||
let ref = try openBoard(model, at: board.root)
|
||||
let session = try #require(model.session(for: ref))
|
||||
let switcher = try #require(session.git?.switcher)
|
||||
|
||||
let windows = [Ident.card1, Ident.card2].map { id in
|
||||
openCardWindow(model, board: ref, card: id, store: session.store)
|
||||
}
|
||||
#expect(windows.allSatisfy { $0.undo.stack.canUndo })
|
||||
#expect(windows.allSatisfy { $0.undo.netEffect() != nil }, "a session with a net effect to fold")
|
||||
|
||||
model.settleAsk = { _ in choice }
|
||||
#expect(await switcher.settleSessions?() == .proceed)
|
||||
|
||||
for window in windows {
|
||||
#expect(!window.undo.stack.canUndo, "the stack describes the branch being left")
|
||||
#expect(!window.undo.manager.canUndo, "and ⌘Z in that window answers with it")
|
||||
}
|
||||
// "The windows stay open, following their cards onto the new branch with fresh stacks."
|
||||
#expect(model.session(for: ref)?.cardRefs.count == 2)
|
||||
}
|
||||
|
||||
/// **Closing the stack is not closing the window.** The coarse step a card window owes its board is
|
||||
/// registered at *close*, folded from this stack (13-native-undo.md ▸ Rules ▸ "Window close
|
||||
/// coarsens"); a settle clear registers nothing at all, which is exactly what
|
||||
/// `registerCardSession` answering `false` — and the deferred purge staying the caller's — says.
|
||||
@Test("A settle clear registers no coarse step — the fold that would have run finds nothing")
|
||||
func theClearRegistersNoCoarseStep() async throws {
|
||||
let board = try makeProGitBoard()
|
||||
defer { board.tearDown() }
|
||||
let (model, tearDown) = try makeModel()
|
||||
defer { tearDown() }
|
||||
model.currentTier = { .pro }
|
||||
|
||||
let ref = try openBoard(model, at: board.root)
|
||||
let session = try #require(model.session(for: ref))
|
||||
let switcher = try #require(session.git?.switcher)
|
||||
let window = openCardWindow(model, board: ref, card: Ident.card1, store: session.store)
|
||||
|
||||
model.settleAsk = { _ in .saveAll }
|
||||
#expect(await switcher.settleSessions?() == .proceed)
|
||||
|
||||
#expect(window.undo.netEffect() == nil, "nothing left to fold")
|
||||
var purged = false
|
||||
let registered = session.store.registerCardSession(
|
||||
window.undo,
|
||||
inCard: ItemID(rawValue: Ident.card1),
|
||||
retiring: { purged = true }
|
||||
)
|
||||
#expect(!registered, "a close arriving right after the switch registers nothing")
|
||||
#expect(!purged, "and the deferred purge is still the caller's, not a step's")
|
||||
}
|
||||
|
||||
/// "**Cancel** keeps the current branch and the sessions" — and now their stacks with them. The
|
||||
/// same `if` that withholds the staging release withholds this.
|
||||
@Test("Cancel clears nothing")
|
||||
func cancelKeepsTheFineStacks() async throws {
|
||||
let board = try makeProGitBoard()
|
||||
defer { board.tearDown() }
|
||||
let (model, tearDown) = try makeModel()
|
||||
defer { tearDown() }
|
||||
model.currentTier = { .pro }
|
||||
|
||||
let ref = try openBoard(model, at: board.root)
|
||||
let session = try #require(model.session(for: ref))
|
||||
let switcher = try #require(session.git?.switcher)
|
||||
let window = openCardWindow(model, board: ref, card: Ident.card1, store: session.store)
|
||||
|
||||
model.settleAsk = { _ in .cancel }
|
||||
#expect(await switcher.settleSessions?() == .cancelled)
|
||||
#expect(window.undo.stack.canUndo)
|
||||
#expect(window.undo.netEffect() != nil)
|
||||
}
|
||||
|
||||
// MARK: Launch restoration
|
||||
|
||||
/// App ▸ Settings…'s "Restore open boards at launch" (11-command-nexus.md) gates the flagged set
|
||||
|
||||
Reference in New Issue
Block a user