🐛 fix(vscode): 移交回滚顺序、done 信号与无 branch 守卫

Claude-Session: https://claude.ai/code/session_011cEyL6k351U2BzX1Qmygph
This commit is contained in:
cruldra committed 2026-08-26 16:28:44 +08:00
1 parent 605f69f6a5
commit e066c26583
3 files changed
+109 -23

No files matched your search

+33 -1
View File
@@ -5,6 +5,7 @@ import {
checkWorktreePushed,
handoffAcceptedStateExtra,
handoffAcceptedUiPatch,
handoffLocalTombstones,
handoffStartedStateExtra,
handoffStartedUiPatch,
} from './handoff'
@@ -52,10 +53,14 @@ describe('checkWorktreePushed', () => {
})
describe('payloads', () => {
it('移交落盘:两个共享字段 + 本机字段全部墓碑', () => {
it('移交落盘:只写两个共享字段,本机字段留到本机清理跑完后再墓碑', () => {
expect(handoffStartedStateExtra(9, 'chw')).toEqual({
handoffAttachmentId: '9',
handoffFrom: 'chw',
})
})
it('本机墓碑:keepWorktreePath=false 时九个本机字段全清', () => {
expect(handoffLocalTombstones({ keepWorktreePath: false })).toEqual({
sessionId: '',
implementSessionId: '',
reviewSessionId: '',
@@ -67,6 +72,20 @@ describe('payloads', () => {
prDiffFile: '',
})
})
it('本机墓碑:keepWorktreePath=true 时保留 worktreePath', () => {
const extra = handoffLocalTombstones({ keepWorktreePath: true })
expect(extra.worktreePath).toBeUndefined()
expect(extra).toEqual({
sessionId: '',
implementSessionId: '',
reviewSessionId: '',
testSessionId: '',
profilePath: '',
brainstormProfilePath: '',
testProfilePath: '',
prDiffFile: '',
})
})
it('移交 UI patch 用 null 清字段并更新 assignees', () => {
expect(handoffStartedUiPatch(9, 'chw', 'me')).toEqual({
handoffAttachmentId: '9',
@@ -108,4 +127,17 @@ describe('payloads', () => {
worktreeExists: true,
})
})
it('接管 UI patch:无 worktreePath 时显式置 null,不留旧值', () => {
expect(handoffAcceptedUiPatch({
sessions: { sessionId: 's' },
profiles: {},
worktreeExists: false,
})).toEqual({
handoffAttachmentId: null,
handoffFrom: null,
sessionId: 's',
worktreePath: null,
worktreeExists: false,
})
})
})