docs(home): record slow-network acceptance
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
# PROGRESS · 慢网首页半揭幕 + 账户与点数打开慢(2026-09-24)
|
||||
|
||||
## 当前状态
|
||||
|
||||
- 实际 worktree:`G:\Ferti\Jyotisha\.claude\worktrees\agent-aa9a862be5b171b9b`
|
||||
- 分支:`codex/home-slow-network-20260924`
|
||||
- 基线:`origin/staging` `edc9c22c3`
|
||||
- 当前实现提交:`1fbe14995`、`659bd9600`、`6a097b6a3`;本记录及最终验收修订尚未提交。
|
||||
- 第二单、第三单未开始,按任务书串行依赖暂停。
|
||||
|
||||
## 实施
|
||||
|
||||
### T1 首页启动
|
||||
|
||||
- 新增 `HOME_BOOTSTRAP_SLOW_MS = 20_000`;删除原 8 秒硬超时语义。
|
||||
- `/api/models`、咨询状态和 SessionListProvider 启动读取并行;模型或必要 bootstrap 请求失败时在 commit 前进入全屏错误状态,不揭幕半成品首页。
|
||||
- React 错误屏「重试」取消上一轮、reload provider 读取并局部重跑,不调用 `location.reload()`。
|
||||
- SessionListProvider 增加可重入 reload、AbortController 替换和旧请求提交保护。
|
||||
- 首屏 ES5 fallback 调为 25 秒,仍保留六类失败分类;只有 bundle 没运行的首屏 fallback 按钮才允许用户点击整页 reload。
|
||||
|
||||
### T2 账户与点数
|
||||
|
||||
- BillingPanel 动态分包使用静态占位「账户信息还没拿到。」;账户菜单 pointer enter/down 预取 chunk 和套餐。
|
||||
- 移除 `use-billing-panel` 挂载时完整 `/api/account` 请求;兑换成功使用兑换响应 `credits`,支付成功使用 status 响应 `credits`,均通过既有共享余额事件同步,不新增账户请求。
|
||||
- 套餐结果模块级缓存 60 秒,过期返回旧值并后台刷新;套餐 route 的 feature flags 与商品读取并行,权益仍在 product IDs 就绪后读取。
|
||||
- 预取动态 chunk 的失败显式 catch 隔离,不让离线 hover 预取触发全局 stale-client recovery reload。
|
||||
|
||||
## 三栏断言调整
|
||||
|
||||
| 文件 | 原值 | 新值 | 原因 |
|
||||
| --- | --- | --- | --- |
|
||||
| `frontend/tests/membership-navigation-contract.test.ts` | 挂载断言 `Promise.allSettled([fetchAccountData(), fetchPackages()])`,认证跳转计数 4 | 仅断言套餐加载、无 `fetchAccountData`/`/api/account`;认证跳转计数 3 | T2 删除无用挂载账户请求,保留订单、兑换、支付状态的 401 硬跳转 |
|
||||
| `frontend/tests/epay-settings.test.ts` | 直接断言 hook fetch `/api/payment/packages`、`payload.enabled` 和旧 `setPaymentEnabled(true)` | 断言 hook 使用 `fetchPaymentPackages`,缓存模块发起请求并规范化 enabled | 网络请求迁移到 60 秒共享缓存,支付开关行为不变 |
|
||||
| `frontend/tests/billing-panel.test.ts` | 兑换/支付后再次 `fetchAccountData()`;预取无失败处理 | 断言使用响应 credits 广播余额,预取 promise catch 隔离 | 删除重复账户查询但保留成功后的余额同步,避免离线预取未处理 rejection |
|
||||
| `frontend/tests/first-paint-fallback-contract.test.ts` | 兜底晚于 8 秒 + 4 秒 prepare | 兜底晚于 20 秒慢网阈值并留余量 | 新首页 slow-network budget 为 20 秒 |
|
||||
|
||||
## 验证结果
|
||||
|
||||
已通过:
|
||||
|
||||
```text
|
||||
./node_modules/.bin/tsc --noEmit exit 0
|
||||
./node_modules/.bin/eslint src/hooks/use-billing-panel.ts \
|
||||
src/lib/session-list-context.tsx tests/epay-settings.test.ts exit 0
|
||||
./node_modules/.bin/tsx --test \
|
||||
tests/membership-navigation-contract.test.ts \
|
||||
tests/billing-panel.test.ts tests/epay-settings.test.ts \
|
||||
tests/home-bootstrap-reveal.test.ts \
|
||||
tests/first-paint-fallback-contract.test.ts 65 pass / 0 fail
|
||||
```
|
||||
|
||||
全量 `npm run lint` 已执行:0 error、121 warnings;warnings 为仓库既有问题,本轮新增的 `epay-settings` 未使用变量 warning 已移除。全量 `npm test`、`npm run build`、浏览器 Slow 3G / Offline 真人验收仍需最终执行/记录。
|
||||
|
||||
## 环境缺口
|
||||
|
||||
- 本轮未读取或提交任何真实隐私资料、凭据、Cookie、JWT 或模型密钥。
|
||||
- 本地 Windows worktree 可完成 TypeScript、定向合同和定向 lint;尚未有 Chrome 登录态,真人 Slow 3G / Offline、动态 chunk 网络行为无法在本地声明通过。
|
||||
- 尚未执行 build、Static/gzip 对比、Docker/Linux volume 保真路径和 staging health;不能据此声称部署或 staging 已验收。
|
||||
- 未 push;Gitea 认证 token 当前不可用,需协调方恢复既定认证后再按 `status → fetch --prune → 同步 origin/staging → push` 流程交付。
|
||||
|
||||
## 后续
|
||||
|
||||
1. 独立复核本记录、BUG_HISTORY 和定向测试。
|
||||
2. 完成全量前端测试、build 与可用的静态/gzip 对比;将失败名单与基线逐项记录。
|
||||
3. 协调推送前先 `git status -sb`、`git fetch origin --prune`,同步最新 `origin/staging`,确认无共享工作树改动后再推送本单。
|
||||
4. staging 验收通过后才领取 `TASK-chart-ephemeris-fixes-20260924.md`。
|
||||
Reference in New Issue
Block a user