chore(部署): push 后先过检查再部署;判题机重启那几秒交的题不再变成系统错误;worker 挂了看得出来
Deploy / deploy (push) Canceled after 0s

按外部分析报告(reports/analysis)挑出来做的几条:
- CI 在编完前端之后跑 `bunx vp run verify`,有一项不过就不部署(必须排在编前端之后:
  前端类型检查要的 auto-imports.d.ts / components.d.ts 是 vite build 时才生成的)
- 连不上判题机(连接被拒、解析不到、被重置)时,正式判题等 2/5/10 秒重试,不再当场记成
  系统错误;超时、判题机回错、页面上的运行和自测不重试
- worker 每 10 秒刷一次「还活着」,compose 加 `oj2-api healthcheck --worker`,deploy.sh 起栈后
  也等 worker 健康(docker 不会因 unhealthy 自动重启,只是看得见、部署时拦得住)
- 三套 compose 的容器日志限 10MB × 3
- `/public/%` 这类畸形编码回 404 而不是 500;找不到的接口回统一的 JSON 错误
- 删掉没人用的「停用判题机」接口,契约不再给 task_number / is_disabled(列留在库里)
- 删掉腐化的 apps/web/tests/submitButtonState.test.ts;契约包 zod 范围对齐到 ^4.6.6
- 修几处和实际对不上的注释与文档(表数、编译并发、AST 语言数、deploy.sh 流程、校验处数)

⚠️ 改了 compose 的日志配置,这次部署会把 postgres / redis / 判题机也重建一遍,各停几秒

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-11-02 20:59:19 +08:00
1 parent b344bd1dd6
commit b046af4ba0
20 files changed
+187 -104

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@
".": "./src/index.ts"
},
"dependencies": {
"zod": "^4.4.3"
"zod": "^4.6.6"
},
"sideEffects": false
}
-7
View File
@@ -334,9 +334,7 @@ export const judgeServerSchema = z.object({
cpuUsage: z.number(),
lastHeartbeat: z.string(),
createTime: z.string(),
taskNumber: z.number().int(),
serviceUrl: z.string().nullable(),
isDisabled: z.boolean(),
/** 心跳在 6 秒内才算在线,与 dashboard 的判活口径一致 */
status: z.enum(['normal', 'abnormal']),
})
@@ -346,10 +344,6 @@ export const judgeServerListSchema = z.object({
servers: z.array(judgeServerSchema),
})
export const updateJudgeServerRequestSchema = z.object({
isDisabled: z.boolean(),
})
export const orphanTestCaseSchema = z.object({
id: z.string(),
createTime: z.number(),
@@ -1247,7 +1241,6 @@ export type ImportUsersRequest = z.input<typeof importUsersRequestSchema>
export type DeleteUsersRequest = z.input<typeof deleteUsersRequestSchema>
export type ResetPasswordResponse = z.infer<typeof resetPasswordResponseSchema>
export type UpdateWebsiteConfigRequest = z.input<typeof updateWebsiteConfigRequestSchema>
export type UpdateJudgeServerRequest = z.input<typeof updateJudgeServerRequestSchema>
export type UploadImageResponse = z.infer<typeof uploadImageResponseSchema>
export type CreateContestRequest = z.input<typeof createContestRequestSchema>
export type UpdateContestRequest = z.input<typeof updateContestRequestSchema>
+2 -2
View File
@@ -285,8 +285,8 @@ export const AST_OPERATOR_TARGETS_BY_LANGUAGE: Record<string, Record<string, str
}
/**
* 判题机真正能做 AST 检查的语言。设计文档写的是"支持全部 6 种语言",落地的只有
* 这两种 —— 其余语言 judge/ast.ts 的 loadLanguage 返回 null,规则一条都不会跑。
* 判题机真正能做 AST 检查的语言(C / C++ / Python 三种,就是上面这张表的键)。设计文档写的是
* "支持全部 6 种语言",其余语言 judge/ast.ts 的 loadLanguage 返回 null,规则一条都不会跑。
* 所以后台不给别的语言开 tab,题目页也不把它们的规则展示成「要求」。
*/
export const AST_SUPPORTED_LANGUAGES = Object.keys(AST_NODE_TARGETS_BY_LANGUAGE)