发布管理:maintenanceSummary 只看 job.state === 'failed' 就给 held 处置文案; 窗口已 released 的旧作业(libsync-internal-1793399248431728863)因此自相矛盾。 改为仅 held 时给 recoveryError,已释放时给 releasedFailure(如实记录失败,不提供强制成功)。 版本记录:LoadVersionHistorySyncState 把可空的 finished_at 扫进 time.Time; 部署重启触发的同步在"进行中"时该列为 NULL,扫描失败使整页 500 (nginx access log:GET /api/v1/version-history?limit=30 → 500,74 字节错误体)。 改为指针接值再判空。前端同时区分"未配置/加载失败"并显示服务端 code。 RED/GREEN:新增 Go 集成用例(NULL finished_at)、两条前端用例; make verify 16/16 通过(local 档案)。
This commit is contained in:
@@ -73,6 +73,40 @@ describe('维护级别/进度/恢复错误', () => {
|
||||
expect(html).not.toContain('按预备份恢复')
|
||||
})
|
||||
|
||||
it('窗口已释放的失败作业不再说"目标保持维护、入口未开"', () => {
|
||||
// 真实案例:libsync-internal-1793399248431728863 失败后窗口已 released、入口已开,
|
||||
// 页面却照样渲染 held 诊断文案(只按 failed 渲染),与维护状态自相矛盾。
|
||||
const released: LibraryMaintenanceView = {
|
||||
held: false,
|
||||
instance_maintenance: {
|
||||
...heldInstance.instance_maintenance!,
|
||||
released_at: '2026-11-01T03:40:00Z',
|
||||
state: 'released',
|
||||
ingress_state: 'open',
|
||||
},
|
||||
}
|
||||
const summary = maintenanceSummary(released, job)
|
||||
expect(summary.held).toBe(false)
|
||||
expect(summary.recoveryError).toBe('')
|
||||
expect(summary.releasedFailure).toContain('写入生产 chunks 失败')
|
||||
|
||||
const html = renderToStaticMarkup(
|
||||
<MaintenanceCard maintenance={released} job={job} canWrite onRecover={() => undefined} />
|
||||
)
|
||||
expect(html).not.toContain('目标保持维护')
|
||||
expect(html).not.toContain('收尾没有完成')
|
||||
expect(html).toContain('窗口已释放')
|
||||
expect(html).toContain('写入生产 chunks 失败')
|
||||
})
|
||||
|
||||
it('仍在持有的失败作业保留 held 诊断文案', () => {
|
||||
const html = renderToStaticMarkup(
|
||||
<MaintenanceCard maintenance={heldInstance} job={job} canWrite onRecover={() => undefined} />
|
||||
)
|
||||
expect(html).toContain('目标保持维护')
|
||||
expect(html).toContain('收尾没有完成')
|
||||
})
|
||||
|
||||
it('已释放的窗口不再提供恢复入口', () => {
|
||||
const released: LibraryMaintenanceView = {
|
||||
held: false,
|
||||
|
||||
Reference in New Issue
Block a user