fix(web): preserve saved writes across refresh failures

This commit is contained in:
2026-07-22 13:13:03 +08:00
parent 7980943660
commit 89d2f4659f
11 changed files with 304 additions and 74 deletions

View File

@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs'
const requiredFiles = [
'src/app/App.tsx',
'src/app/mutation-refresh.ts',
'src/pages/login.tsx',
'src/pages/workspace-body.tsx',
'src/pages/workspace-home.tsx',
@@ -28,6 +29,8 @@ const requiredFiles = [
'src/api/ai.ts',
'scripts/api-client.test.mjs',
'scripts/workspace-refresh-gate.test.mjs',
'scripts/mutation-refresh.test.mjs',
'scripts/mutation-wiring.test.mjs',
]
const failures = requiredFiles.filter((file) => !existsSync(file)).map((file) => `missing ${file}`)
@@ -212,6 +215,21 @@ if (appStyles.includes('.brand-symbol')) failures.push('legacy brand-symbol styl
if (!appStyles.includes('@media (max-width: 1179px)')) failures.push('channel sidebar must collapse below 1180px')
if (!appStyles.includes('.project-stack-scroll')) failures.push('long project rails need a dedicated scroll region')
if (!appStyles.includes('.mobile-search-button')) failures.push('mobile workbench must retain a global search entry')
const mapperSource = readFileSync('src/api/mappers.tsx', 'utf8')
if (mapperSource.includes("plan.enabled ? '运行中' : '暂停'")) {
failures.push('Cron enabled metadata must use 已启用/已停用 instead of execution-state wording')
}
const cronSource = readFileSync('src/pages/projects/project-cron.tsx', 'utf8')
if (cronSource.includes('运行中') || cronSource.includes('暂停</Tag>')) {
failures.push('Cron summary must describe enabled metadata as 已启用/已停用')
}
const projectOverviewSource = readFileSync('src/pages/projects/project-overview.tsx', 'utf8')
if (
projectOverviewSource.includes('<span>进度 {task.progress}</span>')
&& !projectOverviewSource.includes('{task.progress && <span>进度 {task.progress}</span>}')
) {
failures.push('project overview must hide task progress when the backend provides no real progress')
}
for (const file of ['src/pages/login.tsx', 'src/pages/projects/project-topbar.tsx', 'src/pages/projects/project-rail.tsx']) {
const source = readFileSync(file, 'utf8')
if (!source.includes('/senlinai-icon.svg')) failures.push(`${file} must use the brand icon`)