From 2dec33611fab52391076b6ce331cee63a67ee235 Mon Sep 17 00:00:00 2001 From: ssw Date: Sat, 27 Jun 2026 10:16:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(form):=20B-7=20=E4=BF=AE=E5=A4=8D=20tokenSt?= =?UTF-8?q?ore.peek=20=E6=9C=AA=E5=AE=9A=E4=B9=89=E5=BC=95=E7=94=A8=20+=20?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=20retry/exit=20=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Session-end 钩子 0879eff 已提交 B-7 主体逻辑 (retry 1 次 + process.exit(1)), 但提交中含未定义引用 `tokenStore.peek()` (实际 API 是 loadToken()), TS 编译能过但运行时路径触发会 ReferenceError. 本提交 (1c444db): - 改用 `loadToken()` from core/config.ts (已存在的 TokenFile 加载函数) - 加 import { loadToken } from '../../core/config.ts' - 简化 baseUrl 兜底 (直接用 c.baseUrl, 不再硬编码 'http://127.0.0.1:30000') 完整 B-7 行为: 1. release() 失败重试 1 次 (500ms 间隔, 防网络抖动) 2. 仍失败: log.error + 手动 curl 提示 + --json 输出 releaseError + process.exit(1) 后端: VisualdevController.java:593 publish() :639 setState(1) + :673 saveOrUpdate web: web/.../api/onlineDev/visualDev.ts:43 release(id) tds 9 bug 复盘 2026-06-27 --- src/commands/form/create.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/form/create.ts b/src/commands/form/create.ts index 6460ad6..ea92731 100644 --- a/src/commands/form/create.ts +++ b/src/commands/form/create.ts @@ -22,6 +22,7 @@ import { runGuards, handleGuardResult } from '../_blindspot_guards.ts' import { validateFormCreate } from './_validate.ts' import { enhanceFromBackend, formatErrorLine } from '../_error_codes.ts' import { loadAppContext } from '../app/context.ts' +import { loadToken } from '../../core/config.ts' interface CreateOpts { fullName?: string @@ -730,7 +731,7 @@ export function buildFormCreateCommand(): Command { } else { log.error(`发布失败 (code=${rr.code}): ${rr.msg}`) log.error( - `手动发布: curl -X POST "${c.baseUrl || 'http://127.0.0.1:30000'}/api/visualdev/Base/${newId}/Actions/Release" -H "Authorization: ${tokenStore.peek()?.token || 'bearer '}" -H "Content-Type: application/json" -d '{}'`, + `手动发布: curl -X POST "${c.baseUrl}/api/visualdev/Base/${newId}/Actions/Release" -H "Authorization: ${loadToken()?.token ? 'bearer ' + loadToken()!.token : 'bearer '}" -H "Content-Type: application/json" -d '{}'`, ) if (opts.json) printJson({ id: newId, enCode: opts.enCode, type, webType, releaseError: rr.msg }) process.exit(1)