test(session): pin the other side of the presence rule

Widening the predicate to "always survives" passed the whole file — the
counterweight rides on the host-precedence ordering, not on the predicate, so
nothing objected to dropping the rule entirely. An emptied row is evidence the
workspace exists; no row on either side is not.
This commit is contained in:
Neil
2026-09-18 23:54:14 -07:00
parent dcb1479b02
commit eccd9ac0b6
@@ -386,6 +386,24 @@ describe('local rows the snapshot carries no answer for', () => {
expect(merged.activeWorktreeId).toBe(OTHER_WORKTREE)
})
it('does not stand the user in a workspace that survived in neither side', () => {
// The boundary the presence rule actually draws, and the only case that separates it from
// "always preserve": an emptied row is evidence the workspace exists, but NO row on either
// side is not. Preserving here would leave the user pointed at a workspace the merge has no
// record of, which is the home screen's job to catch.
const current = sessionState()
const remote = sessionState({
activeWorktreeId: null,
activeWorkspaceKey: null,
activeRepoId: null
})
const merged = merge(current, remote)
expect(merged.activeWorktreeId).toBeNull()
expect(merged.activeWorkspaceKey).toBeNull()
})
it('invents no row for a worktree neither side has one for', () => {
// The counterweight: presence has to come from a real local row, not from membership in the
// replace set, or a never-initialized workspace gets a tombstone it never earned.