🐛 fix(vscode): 状态分层读侧补漏——四处 handler 改走 readIssueState 叠加本地状态
This commit is contained in:
@@ -27,7 +27,7 @@ import {
|
||||
removeDependency,
|
||||
} from '../../gitea/api'
|
||||
import { isValidSpxFilePath, loadIssues } from '../../gitea/issueLoader'
|
||||
import { mergeStateJsonComment, readStateJsonComment } from '../../gitea/stateJson'
|
||||
import { mergeStateJsonComment } from '../../gitea/stateJson'
|
||||
import { logger } from '../../logging/logger'
|
||||
import { getSettings } from '../../settings/store'
|
||||
import { webhookCoordinator } from '../../webhook/coordinator'
|
||||
@@ -100,7 +100,7 @@ export async function handleColumnChange(panel: KanbanWebviewPanel, issueNumber:
|
||||
return
|
||||
}
|
||||
|
||||
// 1. 读最新 state JSON(从尾往前找已知字段,避免普通评论盖住 branch)。
|
||||
// 1. 读工单状态(共享评论叠加本机 workspaceState 记录)。
|
||||
let prStr: string | undefined
|
||||
let worktreePath: string | undefined
|
||||
let fromColumn: IssueColumn | undefined
|
||||
@@ -108,13 +108,7 @@ export async function handleColumnChange(panel: KanbanWebviewPanel, issueNumber:
|
||||
let testSessionId: string | undefined
|
||||
let featureBranchFromState: string | undefined
|
||||
try {
|
||||
const stateObj = await readStateJsonComment({
|
||||
host: remote.host,
|
||||
token,
|
||||
owner: remote.owner,
|
||||
repo: remote.repo,
|
||||
issueNumber,
|
||||
})
|
||||
const stateObj = await panel.readIssueState(issueNumber)
|
||||
if (typeof stateObj.pr === 'string' && stateObj.pr.length > 0)
|
||||
prStr = stateObj.pr
|
||||
if (typeof stateObj.worktreePath === 'string' && stateObj.worktreePath.length > 0)
|
||||
@@ -563,10 +557,10 @@ export async function handleColumnChange(panel: KanbanWebviewPanel, issueNumber:
|
||||
/**
|
||||
* Handle a "drag to in-progress" kanban move.
|
||||
*
|
||||
* Validates the issue has a valid `planFile` recorded in its state JSON,
|
||||
* Validates the issue has a valid `planFile` recorded in its state,
|
||||
* and that the file actually exists on disk, then delegates the full
|
||||
* implementation pipeline to `handleImplement` (which owns issue locking,
|
||||
* tab reuse, state JSON column/branch/worktreePath writes, gitea webhook
|
||||
* tab reuse, column/branch/worktreePath state writes, gitea webhook
|
||||
* registration, cc spawn). On any pre-flight failure, rolls the optimistic
|
||||
* column move back to the source column.
|
||||
*/
|
||||
@@ -621,17 +615,11 @@ export async function handleDropToInProgress(panel: KanbanWebviewPanel, issueNum
|
||||
return
|
||||
}
|
||||
|
||||
// Read latest state JSON to obtain source column + planFile + optional
|
||||
// profilePath / sessionId.
|
||||
// 读工单状态(共享评论叠加本机记录)拿 source column + planFile +
|
||||
// 可选的 profilePath / sessionId。
|
||||
let stateObj: Record<string, unknown> = {}
|
||||
try {
|
||||
stateObj = await readStateJsonComment({
|
||||
host: remote.host,
|
||||
owner: remote.owner,
|
||||
repo: remote.repo,
|
||||
token,
|
||||
issueNumber,
|
||||
})
|
||||
stateObj = await panel.readIssueState(issueNumber)
|
||||
}
|
||||
catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err)
|
||||
@@ -695,8 +683,8 @@ export async function handleDropToInProgress(panel: KanbanWebviewPanel, issueNum
|
||||
return
|
||||
}
|
||||
|
||||
const profilePath = typeof stateObj.profilePath === 'string' ? stateObj.profilePath : undefined
|
||||
const sessionId = typeof stateObj.sessionId === 'string' ? stateObj.sessionId : undefined
|
||||
const profilePath = typeof stateObj.profilePath === 'string' && stateObj.profilePath.length > 0 ? stateObj.profilePath : undefined
|
||||
const sessionId = typeof stateObj.sessionId === 'string' && stateObj.sessionId.length > 0 ? stateObj.sessionId : undefined
|
||||
try {
|
||||
await panel.handleImplement(issueNumber, planFile, profilePath, sessionId)
|
||||
}
|
||||
@@ -864,16 +852,10 @@ export async function handleDeleteIssue(panel: KanbanWebviewPanel, issueNumber:
|
||||
return
|
||||
}
|
||||
|
||||
// 3. 读 state JSON 拿 pr / branch / worktreePath
|
||||
// 3. 读工单状态(共享评论叠加本机记录)拿 pr / branch / worktreePath
|
||||
let stateObj: Record<string, unknown> = {}
|
||||
try {
|
||||
stateObj = await readStateJsonComment({
|
||||
host: remote.host,
|
||||
owner: remote.owner,
|
||||
repo: remote.repo,
|
||||
token,
|
||||
issueNumber,
|
||||
})
|
||||
stateObj = await panel.readIssueState(issueNumber)
|
||||
}
|
||||
catch (err) {
|
||||
const message = err instanceof Error ? err.message : String(err)
|
||||
@@ -1945,13 +1927,7 @@ export async function handleGeneratePrDiffSummary(panel: KanbanWebviewPanel, iss
|
||||
}
|
||||
|
||||
try {
|
||||
const state = await readStateJsonComment({
|
||||
host: remote.host,
|
||||
owner: remote.owner,
|
||||
repo: remote.repo,
|
||||
token,
|
||||
issueNumber,
|
||||
})
|
||||
const state = await panel.readIssueState(issueNumber)
|
||||
const pr = typeof state.pr === 'string' && /^\d+$/.test(state.pr) ? state.pr : undefined
|
||||
if (!pr) {
|
||||
panel.postMessage({
|
||||
|
||||
Reference in New Issue
Block a user