🐛 fix(vscode): 别的机器上开的会话在本机没有会话文件时,会话 id 行置灰不可双击,不再 resume 报错
This commit is contained in:
1 parent
2b1e660cc8
commit
bf4661e364
20 files changed
+508
-234
No files matched your search
@@ -83,7 +83,7 @@ export type ExtensionToWebview
|
||||
| { type: 'issues/loaded' }
|
||||
| { type: 'issues/update', issues: Issue[], scope: 'mine' | 'all', globalAutoReview: boolean, youtrackConfigured: boolean, me?: string, avatars?: Record<string, string> }
|
||||
| { type: 'issues/error', message: string }
|
||||
| { type: 'issue/patch', issueNumber: number, patch: { autoReview?: boolean, specFile?: string, planFile?: string, prototypeFile?: string, prDiffFile?: string | null, sessionId?: string | null, implementSessionId?: string | null, reviewSessionId?: string | null, reviewSessionFileExists?: boolean, testSessionId?: string | null, prototypeSessionId?: string | null, pr?: string | null, implementStatus?: 'running' | 'done' | 'failed' | null, column?: IssueColumn, worktreePath?: string | null, prMerged?: boolean, prMergedAt?: string | null, branch?: string | null, color?: string, worktreeExists?: boolean, brainstormTabOpen?: boolean, implementTabOpen?: boolean, reviewTabOpen?: boolean, testTabOpen?: boolean, prototypeTabOpen?: boolean, profilePath?: string | null, brainstormProfilePath?: string | null, testProfilePath?: string | null, prototypeProfilePath?: string | null, assignees?: string[], handoffAttachmentId?: string | null, handoffFrom?: string | null } }
|
||||
| { type: 'issue/patch', issueNumber: number, patch: { autoReview?: boolean, specFile?: string, planFile?: string, prototypeFile?: string, prDiffFile?: string | null, sessionId?: string | null, implementSessionId?: string | null, reviewSessionId?: string | null, missingSessionIds?: string[], testSessionId?: string | null, prototypeSessionId?: string | null, pr?: string | null, implementStatus?: 'running' | 'done' | 'failed' | null, column?: IssueColumn, worktreePath?: string | null, prMerged?: boolean, prMergedAt?: string | null, branch?: string | null, color?: string, worktreeExists?: boolean, brainstormTabOpen?: boolean, implementTabOpen?: boolean, reviewTabOpen?: boolean, testTabOpen?: boolean, prototypeTabOpen?: boolean, profilePath?: string | null, brainstormProfilePath?: string | null, testProfilePath?: string | null, prototypeProfilePath?: string | null, assignees?: string[], handoffAttachmentId?: string | null, handoffFrom?: string | null } }
|
||||
/** 某个会话 id 的开 tab 请求已处理完(开成、复用或被拒都算),webview 据此停掉行内 spinner。 */
|
||||
| { type: 'session/tab-settled', sessionId: string }
|
||||
| { type: 'issue/pr-diff-summary-done', issueNumber: number }
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { isSessionMissing } from './missingSession'
|
||||
|
||||
describe('isSessionMissing', () => {
|
||||
it('会话 id 在缺失列表里(忽略大小写)→ true', () => {
|
||||
expect(isSessionMissing({ missingSessionIds: ['ABC'] }, 'abc')).toBe(true)
|
||||
})
|
||||
|
||||
it('不在缺失列表、列表缺省、id 为空 → false', () => {
|
||||
expect(isSessionMissing({ missingSessionIds: ['abc'] }, 'def')).toBe(false)
|
||||
expect(isSessionMissing({}, 'abc')).toBe(false)
|
||||
expect(isSessionMissing(undefined, 'abc')).toBe(false)
|
||||
expect(isSessionMissing({ missingSessionIds: ['abc'] }, undefined)).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { Issue } from '../types'
|
||||
|
||||
/**
|
||||
* 会话 id 在本机没有会话文件(别的机器上开的会话),resume 必失败。
|
||||
* 详情面板的会话行和看板的键盘 resume 快捷键都据此跳过。
|
||||
*/
|
||||
export function isSessionMissing(issue: Pick<Issue, 'missingSessionIds'> | null | undefined, sid: string | undefined): boolean {
|
||||
return !!sid && !!issue?.missingSessionIds?.some(m => m.toLowerCase() === sid.toLowerCase())
|
||||
}
|
||||
Reference in new issue
Block a user