Files
Jyotisha/docs/tasks/PROGRESS-gate-log-volume-20261004.md
T
Jesse_ChenandClaude Opus 5.5 1252de3e63
Independent Staging Quality Gate / validate (push) Successful in 26m0s
Independent Staging Quality Gate / publish (push) Successful in 5m15s
fix(frontend-tests): expand test files in run-tests.mjs so Node 20 still runs the suite (BUG-1230)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
2026-10-04 23:22:08 +08:00

79 lines
7.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PROGRESS:门禁日志体积 — 2026-10-04
基线 `origin/staging` `06bfae92`。分支 `codex/gate-log-volume-20261004`,工作树 `.worktrees/gate-log-volume-20261004`。未提交,未推送,未部署。Gitea 上各 step 页面是否打得开,留待推送后由产品确认。
## 做了什么
1. 快速门默认只打摘要。通过一行,失败打标记、退出码、最后 200 行,完整输出写到 `gate-logs/`。`--verbose` 恢复原来的整份输出。没有新加子进程超时。
2. 前端 `npm test` 本机仍是完整 TAP。门禁环境(`CI` 或 `GITEA_ACTIONS`)打点号进度,完整 TAP 写到 `gate-logs/frontend-tests.tap`,末尾打 tests / pass / fail / cancelled,以及每条失败的名字和报错正文(每条最多 60 行)。点号报告自己还会再打一遍整段堆栈,那一段不进日志,避免同一条失败打两遍。
3. 门禁 workflow 把原来的一个 step 拆成 7 个顺序 step。`python -m build` 的明细写入 `gate-logs/python-build.log`,失败打最后 200 行,退出码不变。触发条件、paths、job 依赖、runner、密钥、超时、发布和部署没动。
4. 记录:BUG-1230、CHANGELOG、本文件、状态板改为「已实现待验收」。
## 行数
任务书里的 26,800 / 14,000 / 2,900 是写任务书时的测量。下表「改前」里标「本轮实测」的,是这次在同一台 Windows 上、改代码前抓到的日志。
| 输出 | 改前 | 改后 |
| --- | --- | --- |
| 快速门 `--profile quick --skip-yoga-logic --skip-frontend-runtime` | 任务书约 14,000 行 | 18 行,退出码 0,用时 929 秒 |
| 同一条命令加 `--verbose` | 与改前同类(子进程整份输出直接打出) | 27,093 行。退出码 1:1,056 通过、1 失败、1 跳过。失败的是既有测试 `test_the_new_layer_leaves_every_existing_output_unchanged`(两次算盘对不上)。精简模式的全门是通过的;这条事后单独重跑也通过。不是这次输出改动引进的 |
| 本机 `npm test`(不设 CI) | 36,122 行;4,844 tests / 4,700 pass / 144 fail / 0 cancelled | 36,140 行;汇总相同;失败名字顺序与改前相同 |
| `CI=true npm test` | 先做的一版 7,128 行(点号进度的整段堆栈,再加上每条失败的完整诊断) | 1,144 行。没有 `Failed tests:` 那一段。汇总仍是 4,844 / 4,700 / 144 / 0。134 条失败名字与精简前相同,报错正文还在(例如迁移文件重名、EBUSY)。退出码 1 |
| `python -m build` | 任务书约 2,900 行 | 本机没再跑。workflow 改为写入日志文件,失败只打末 200 行 |
`CI=true` 在这台机器上是 1,144 行,超过任务书写的 600 行。原因是这台机器有 144 条失败,不是任务书里的 24 条。点号进度本身大约 248 行(Node 在非终端下每行 20 个点,4,844 个测试约 243 行)。每条失败平均再占 6.65 行。按这个长度,24 条失败大约 413 行,全绿大约 253 行,都低于 600。失败名字和报错正文没有拿掉。
这 144 条是这台 Windows 上本来就有的:迁移文件名重复(符号链接被检出成普通文件)、`G:\G:\` 路径、建符号链接没有权限、临时目录删不掉、没有 bash。改前改后的失败名单一致,不是这次改出来的。
## 检查集合对照
命令和参数没有增删。只是从同一步拆开,构建的输出改道。
| 检查 | 拆分前 | 拆分后 |
| --- | --- | --- |
| `ruff check` 那 5 个文件 | 唯一的 validate step | `Lint and compile Python` |
| `python -m py_compile scripts/*.py jyotish_vedic/*.py mcp_server.py` | 同一步 | 同一步 |
| `python scripts/run_quality_gate.py --profile quick --skip-yoga-logic --skip-frontend-runtime` | 同一步 | `Python quality gate (quick)` |
| `python scripts/commercial_privacy_artifact_scan.py --json` | 同一步 | `Privacy artifact scan` |
| `python -m build` | 同一步,明细直接打进该 step | `Build Python package`,明细进 `gate-logs/python-build.log`,失败 `tail -n 200` 后用原来的退出码退出 |
| `npm test --prefix frontend` | 同一步 | `Frontend and database tests` |
| `npm run lint --prefix frontend` | 同一步 | `Frontend lint` |
| 非 push 才 `timeout 600 npm run build --prefix frontend -- --webpack`,超时文案后 `exit 124`;push 只打原来那句 echo | 同一步 | `Frontend production build (non-push)` |
`mkdir -p gate-logs` 放在第一步里,不是第八个检查。没有用成功码吞掉失败,也没有 `continue-on-error`。三处 `npm test` / `lint` / `build` 仍各出现 1 次。
## 合同断言三栏
没有新增 `test()`。下面三处改的是原有测试里的字符串。
| 断言 | 原值 | 新值 | 原因 |
| --- | --- | --- | --- |
| 安装步骤的结束边界 | `Validate backend, package, frontend, and database contracts` | `Lint and compile Python` | 下一段改了名,安装步骤正文没变 |
| 提取 npm install 脚本的切分点 | 换行后 `- name: Validate backend` | 换行后 `- name: Lint and compile Python` | 切分点跟着下一段的名字 |
| `python -m build` | 整行就是 `python -m build` | 重定向到 `gate-logs/python-build.log`,失败时记下退出码再 `tail -n 200` | 明细写入文件,失败打末 200 行。仍然禁止 `--no-isolation` |
这两条测试重跑:2 tests,2 pass,0 fail,0 cancelled。
## 其他验收
| 项 | 结果 |
| --- | --- |
| `tsc --noEmit` | 0 错 |
| `npm run lint` | 0 error,126 条原有 warning,没改 |
| 英文对照 + 隐私标记 | 68 条通过,退出码 0 |
| 快速门里的 `tests/test_run_quality_gate_output.py` | 随快速门一起通过(退出码 0) |
| ruff(改过的两个 Python 文件) | 通过 |
| 前端测试总数 | 仍是 4,844,没有新增测试文件 |
| `next build` | 没跑。这次不改页面,任务书验收口径没有要求 |
| 推送 / 部署 / Gitea 页面 | 没做 |
快速门跑的时候改写了 `references/oracle/artifacts/pending_packets/` 下 5 个模板文件。那不是本单的改动,收尾时还原,不提交。
## Claude 验收与补修(2026-10-04)
- 实测:快速门 18 行(改前约 14,000 行);`CI=true npm test` 346 行,24 条已知失败的名字和报错都列出,退出码 1;本机 Node 22 `npm test` 输出 TAP,失败名单与开工基线逐条相同;快速门子步骤失败(假命令 exit 3)时打出 ✗、末 200 行、`gate-logs/01-fake-fail.log` 和退出码;`test_run_quality_gate_output.py` 10 条通过;workflow 合同测试唯二的失败(live staging sync 两条)本来就在基线 24 条里。
- workflow 拆成 7 步,原 7 条命令一条不少、参数不变,没有吞退出码。
- **补修(违反红线 4)**:`run-tests.mjs` 把 `tests/*.test.ts` 原样交给 `node --test`。Node 22 会自己展开,Node 20 不会,报「Could not find tests/*.test.ts」,一条测试都不跑;本机默认的 Node 就是 v20.19.2。改为脚本自己读 `tests/` 目录,`*.test.ts` 排序后接 `*.test.tsx` 排序,与 shell 展开的顺序相同。
- 补修后,Node 20 下 4,932 项、69 条失败,与旧写法 `tsx --test tests/*.test.ts tests/*.test.tsx` 在 Node 20 下的失败名单逐条相同(都是 Node 20 自身的旧问题)。
- Node 22 下 4,932 项、24 条失败,名单与基线相同;`CI=true` 时 346 行。