按外部分析报告(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:
1 parent
b344bd1dd6
commit
b046af4ba0
20 files changed
+187
-104
No files matched your search
@@ -1,51 +0,0 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
import { getSubmitButtonState } from '../src/oj/problem/components/submitButtonState.ts'
|
||||
|
||||
const idleInput = {
|
||||
isAuthed: true,
|
||||
hasCode: true,
|
||||
isFormatting: false,
|
||||
isSubmitting: false,
|
||||
isJudging: false,
|
||||
isCooldown: false,
|
||||
}
|
||||
|
||||
test('shows a disabled loading state while formatting', () => {
|
||||
assert.deepEqual(getSubmitButtonState({ ...idleInput, isFormatting: true }), {
|
||||
disabled: true,
|
||||
label: '格式化中',
|
||||
icon: 'eos-icons:loading',
|
||||
})
|
||||
})
|
||||
|
||||
test('shows submitting immediately after formatting', () => {
|
||||
assert.deepEqual(getSubmitButtonState({ ...idleInput, isSubmitting: true }), {
|
||||
disabled: true,
|
||||
label: '正在提交',
|
||||
icon: 'eos-icons:loading',
|
||||
})
|
||||
})
|
||||
|
||||
test('preserves existing login, judging, cooldown, and idle states', () => {
|
||||
assert.deepEqual(getSubmitButtonState({ ...idleInput, isAuthed: false }), {
|
||||
disabled: true,
|
||||
label: '请先登录',
|
||||
icon: 'ph:play-fill',
|
||||
})
|
||||
assert.deepEqual(getSubmitButtonState({ ...idleInput, isJudging: true }), {
|
||||
disabled: true,
|
||||
label: '正在评分',
|
||||
icon: 'eos-icons:loading',
|
||||
})
|
||||
assert.deepEqual(getSubmitButtonState({ ...idleInput, isCooldown: true }), {
|
||||
disabled: true,
|
||||
label: '正在冷却',
|
||||
icon: 'ph:lightbulb-fill',
|
||||
})
|
||||
assert.deepEqual(getSubmitButtonState(idleInput), {
|
||||
disabled: false,
|
||||
label: '提交代码',
|
||||
icon: 'ph:play-fill',
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user