Files
Jyotisha/docs/tasks/PROGRESS-chart-page-blocking-open-20260915.md
T
Jesse_ChenandClaude Fable 5 e7016551db docs(tasks): accept the chart-page unblocking (BUG-715~717)
/chart 从 ƒ Dynamic 变回 ○ Static——外壳预渲染、数据客户端取,整页不再阻塞
在五个引擎调用上。引擎超时 45s → 10s(实测单次最慢 0.60s)。postEngine 返回
ok/busy/http_error/timeout/bad_payload 并各留一条只含路径、状态码、耗时的
console.warn,不含出生资料。用户文案分两档:429 说「正忙,稍等几秒」,其它说
「算不出来,已经记录下来了」,不再把可能永不恢复的情况说成暂时的。eyebrow
只剩成功分支一处,改成「主盘直接算 · 分盘按需 · 不消耗点数」,去掉速度承诺。
引擎结果缓存也落地了,任务 3.2 未走让步。

门禁:tsc 0 错;lint 0 error / 119 warning;全量 fail 31 → 30 且零新增,总数
3275 → 3288;build exit 0、/ 仍 ○ Static;首屏 gzip +0.003%。

红线复核:page.tsx 未增长;限流名单与配额未动;四个体系数据一个没删。

欠:浏览器走查;staging 仍停在 2533d5a3 未部署。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0155nFCgCHtoA7jhSDGmZmMu
2026-09-15 14:57:12 +00:00

93 lines
6.6 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-09-15)
工作树:`.worktrees/chart-page-blocking-open-20260915`
分支:`codex/chart-page-blocking-open-20260915`
任务书基线:`origin/staging` @ `8caa2a2b`(任务书本身;代码基线 `2533d5a3`
本机 Windows。
Skill **未 bump**。未改 `scripts/**``deploy/**``vendor/**``frontend/src/app/page.tsx``vedic-chart-svg.tsx`。未放宽 `HEAVY_COMPUTE_PATHS` / `JYOTISH_HEAVY_COMPUTE_CONCURRENCY`
## 开工基线
| 项 | 数字 |
| --- | --- |
| `frontend/src/app/page.tsx` | **1951** 行 |
| 最大 BUG 号 | **BUG-714**(本单占用 715717 |
| `tsc --noEmit` | 收尾 0 错 |
| `npm run lint` | 0 error(全仓既有 warning 119;本单新文件 0 warning |
`frontend/node_modules` 用 junction 指向主仓。
## 任务状态
| 任务 | 状态 | 说明 |
| --- | --- | --- |
| 1 BUG-715 失败可诊断 | 完成 | `ok / busy / http_error / timeout / bad_payload`;非 ok 打 `console.warn`(路径、状态码或错误名、耗时;不含资料);429 与其它分档文案;`catch {}` 去掉 |
| 2 BUG-716 开页不阻塞 | 完成 | `/chart` 改为静态壳;进页只算 `/api/chart`;四个后续按 tab / 非 D1 chip 按需;超时 **10 秒** |
| 3 BUG-717 配额与文案 | 完成 | 开页不再打 western / qizheng;内存缓存 5 分钟,键含 ayanamsa + `node_mode`;失败页无眉标;成功眉标去掉「打开即有」 |
| 4 测试与文档 | 完成 | BUG-715/716/717、DESIGN、VOICE、CHANGELOG、真人清单、PROGRESS |
## 实现要点
- `postEngine` 不再 `return null`。分类在 `chart-view-engine.ts`,日志在 `assembleChartView``callEngine` 包装层,mapper `catch (error)``errorName` + `message`
- `/chart` 不再 `force-dynamic`、不再 `await loadChartView()``ChartPageRoute` 先画外壳,再 `GET /api/chart-view`。未登录仍跳 `/login`
- `GET /api/chart-view?layers=varga,chara,western,qizheng` 按需取后续。缺省 layers 只有 `/api/chart`
- 等待态沿用星历页静态句:「这一张盘还没拿到。」「这一栏还没拿到。」「这一分盘还没拿到。」揭幕后无 spinner / 骨架 / 「正在加载」。
- 引擎结果缓存在 Next 进程内存(与 rate-limit / feature-flag 同一做法)。`api_scratch` 在 API 容器上,BFF 没有这个卷,没有新依赖。失败不写缓存。TTL 5 分钟。
## 超时取值
`CHART_VIEW_ENGINE_TIMEOUT_MS = 10_000`。任务书实测 `/api/chart` 0.60 秒、五个合计 0.75 秒。45 秒大两个数量级,只会让人盯空白。10 秒大约是实测的 16 倍,给冷启动和跨容器网络留余量;挂起时十秒内落到失败文案。
## 既有断言改动
| 文件 | 原值 | 新值 | 原因 |
| --- | --- | --- | --- |
| `chart-page-view.test.tsx` 成功页眉标 | `直接计算 · 打开即有 · 不消耗点数` | `主盘直接算 · 分盘按需 · 不消耗点数` | BUG-717:打开即有是速度承诺,且曾印在失败页上 |
| `chart-view-route.test.ts` western/qizheng 是否被调用 | 无 layers 也会打 `/api/western``/api/qizheng` | 只有请求对应 layer 才打;无 layers 时路径只有 `/api/chart` | BUG-716/717 开页不得占满重计算配额 |
| `assembleChartView``postEngine` 形状 | `Record \| null` | `EngineCallResult` | BUG-715 失败必须带原因 |
未弱化其它既有断言。未改 `page.tsx`(仍 1951 行)。
## 测试
| 命令 | 结果 |
| --- | --- |
| `npx tsx --test tests/chart-view-engine.test.ts tests/chart-view-route.test.ts tests/chart-page-view.test.tsx` | **27 pass / 0 fail**(本单相关;其中新增约 12 条) |
| `./node_modules/.bin/tsc --noEmit` | **0 错** |
| `npm run lint` | **0 error**119 条既有 warning,本单新文件未新增) |
| `page.tsx` | 仍 1951 行,未改 |
| `npx next build --webpack` | compile + TypeScript 过;Collecting page data 死在既有 `SkillPackageRegistryError`EPERM symlink `/api/birth-time-guide`),与本单无关。未能从本机构建表确认 `/``/chart``○ Static`。源码合同:`chart/page.tsx` 已去掉 `force-dynamic` / `loadChartView`。 |
| `npm test` 全量 | `# tests 3101 / # pass 3014 / # fail 73 / # skipped 14`。失败集中在无 Docker 的 database-*、部署/Caddy、Skill SHA、Windows 路径。失败清单不含本单文件。本机不是 Linux 验收机。 |
## 环境缺口
- 无登录态、无 Chrome:真人走查见 `docs/testing/chart-page-open-20260915.md`
- `next build` 收集页面数据时 symlink EPERM,无法在本机核对路由表。
## 验收(Claude2026-09-15`origin/staging` @ `5a8328e5`
**通过,零未通过项。**
| 项 | 结果 |
| --- | --- |
| `/chart` 路由类型 | **`ƒ Dynamic``○ Static`**,外壳预渲染,数据客户端取 |
| `tsc --noEmit` | 0 错 |
| `npm run lint` | 0 error / 119 warning(全既有) |
| 全量 `npm test` | `a38a9415` fail 31 → **fail 30****零新增**;总数 3275 → 3288 |
| `npm run build` | exit 0`/``○ Static` |
| 首屏 JS gzip-9 | 584,494 B(对 584,476 B+0.003% |
逐条对照任务书:
- **BUG-716**`/chart` 变 Static`ChartPageRoute` 是客户端组件,`useChartPage` 先画外壳再取数。`CHART_VIEW_ENGINE_TIMEOUT_MS` 45,000 → **10,000**(实测单次最慢 0.60 秒,取值合理)。
- **BUG-715**`postEngine` 返回 `ok / busy / http_error / timeout / bad_payload``console.warn("chart_view_engine_failed", …)` 只记路径、状态码或错误名、耗时,**不含出生资料**(合 `AGENTS.md` §8)。用户文案分两档,与任务书 1.3 要求的语义一致:429 →「算盘的服务正忙,稍等几秒再打开就好。」其它 →「这张盘算不出来,我们已经记录下来了。」——后者不再说「过一会儿再打开」。
- **BUG-717**eyebrow 只剩成功分支一处(`chart-page-view.tsx:84`),失败页不再印;文案改成「主盘直接算 · 分盘按需 · 不消耗点数」,**不含速度承诺**。引擎结果缓存(`chartViewEngineCacheKey` / `readChartViewEngineCache`)已落地,任务 3.2 未走让步。
- 红线复核:`page.tsx` 未增长;`HEAVY_COMPUTE_PATHS``JYOTISH_HEAVY_COMPUTE_CONCURRENCY` 未动;四个体系数据一个没删;全仓该路径上不再有 `catch {}`
## 仍然欠着
- **浏览器实测**`docs/testing/chart-page-open-20260915.md`。代码级已确认「不再整页阻塞」,但「点下去多久看到外壳 / 多久看到主盘 / 切 tab 各自表现」只能真机走查。
- **staging 未部署**`deployment.gitCommit` 仍是 `2533d5a3``5a8328e5` 尚未上线。