fix(form): B-7 修复 tokenStore.peek 未定义引用 + 完整 retry/exit 逻辑
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
This commit is contained in:
1 parent
0879effbe0
commit
2dec33611f
1 file changed
+2
-1
@@ -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 <TOKEN>'}" -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 <TOKEN>'}" -H "Content-Type: application/json" -d '{}'`,
|
||||
)
|
||||
if (opts.json) printJson({ id: newId, enCode: opts.enCode, type, webType, releaseError: rr.msg })
|
||||
process.exit(1)
|
||||
|
||||
Reference in new issue
Block a user