diff --git a/vscode/src/gitea/issueLoader.test.ts b/vscode/src/gitea/issueLoader.test.ts index 72fb06a..985f784 100644 --- a/vscode/src/gitea/issueLoader.test.ts +++ b/vscode/src/gitea/issueLoader.test.ts @@ -134,12 +134,10 @@ describe('loadIssues', () => { expect(issues[0].column).toBe('todo') }) - it('缺 state 评论时 POST 不挡住返回', async () => { + it('缺 state 评论时用默认列,不代别人发评论', async () => { const { loadIssues } = await import('./issueLoader.js') - listIssuesByFilter.mockResolvedValue([issue(3, { comments: 0 })]) - postIssueComment.mockReturnValue(new Promise(() => {})) + listIssuesByFilter.mockResolvedValue([issue(3, { comments: 0, user: { login: 'cruldra' } })]) - const started = Date.now() const { issues } = await loadIssues({ host: 'gitea.example', token: 't', @@ -147,8 +145,7 @@ describe('loadIssues', () => { repo: 'r', scope: 'all', }) - expect(Date.now() - started).toBeLessThan(500) expect(issues[0].column).toBe('todo') - expect(postIssueComment).toHaveBeenCalled() + expect(postIssueComment).not.toHaveBeenCalled() }) }) diff --git a/vscode/src/gitea/issueLoader.ts b/vscode/src/gitea/issueLoader.ts index 4e63ed7..c0e2304 100644 --- a/vscode/src/gitea/issueLoader.ts +++ b/vscode/src/gitea/issueLoader.ts @@ -6,7 +6,7 @@ * Flow: * 1. 拉工单列表(mine:先 /user 再 assigned+created;all:工单与 /user 并行)。 * 2. 每张工单只从评论末页往前翻,直到碰到带 column 的 state JSON。 - * 不拉整仓库评论。缺 state 时内存用默认列,POST 不挡返回。 + * 不拉整仓库评论。缺 state 时只在内存里用默认列,不发评论。 * 3. 非 done 工单并行补依赖和 PR 状态。 */ @@ -24,7 +24,6 @@ import { listIssueCommentsPage, listIssuesByFilter, PAGE_SIZE, - postIssueComment, } from './api' import { resolveAvatars } from './avatars' @@ -366,7 +365,7 @@ async function buildIssue(opts: { /** PR 的 merged_at(来自 PR API),仅用于完成列排序;查询失败/无 PR 为 undefined。 */ liveMergedAt?: string }): Promise { - const { host, token, owner, repo, workspaceRoot, issue, comments, prerequisite, liveMerged, liveMergedAt } = opts + const { owner, repo, workspaceRoot, issue, comments, prerequisite, liveMerged, liveMergedAt } = opts const id = `${owner}/${repo}#${issue.number}` const { column: fromComment, @@ -405,18 +404,8 @@ async function buildIssue(opts: { column = fromComment } else { + // 缺评论只在本机按工单开/关给默认列。不能在加载时补评论:谁的看板先刷到,评论就挂在谁名下。 column = defaultColumnForState(issue.state) - // 缺省列先用于本屏;POST 不挡返回,失败只记 warn。 - void postIssueComment({ - host, - token, - owner, - repo, - index: issue.number, - body: JSON.stringify({ column }), - }).catch((postErr) => { - console.warn(`[superpowers] failed to seed state comment on ${id}:`, postErr) - }) } // Synchronously stat the worktree path so the UI can render it as a