# 任务书 · 前端优化九条的收尾(2026-08-29) 复核对象:`origin/staging` @ `3198fb6b`("perf(frontend): split chat streaming, load Inter, isolate admin CSS")。 上一轮交付基本属实,我逐条实测过:`tsc --noEmit` exit 0、`eslint` 0 error、`next build` exit 0、路由模式(`/` `○ Static`、`/login` `/admin/**` 仍 `ƒ`)、admin 路由确实不再引用含 `.message-list` 的 216 KB globals chunk、`public/` 只剩 logo、Inter 走 `next/font` 并生成独立 `@font-face` chunk、星盘库 effect 已合并成单 effect 三分支。**本轮不重做这些,只收三个尾巴。** --- ## 硬红线 1. **不得修改任何既有测试断言。** 本轮三条任务都不需要改断言 —— 如果你发现"必须改断言才能过",那是方案错了,停下来登记 `BLOCKED.md`,不要动断言。 2. **不得让 `error.tsx` / `not-found.tsx` 重新 import `globals.css` 或 `site-styles`。** 这两页与 admin 共享根布局段,一旦 import,admin 每条路由会重新背上约 33 KB gzip —— 上一轮 −32 KB 的成果会当场归零。`tests/site-style-isolation-contract.test.ts` 已锁这条,它必须保持绿灯且不被修改。 3. 不得手写 `useCallback` / `useMemo`。 4. 不得为迎合 React Compiler 改写代码;本轮不重开 React Compiler(理由见 `BLOCKED.md` 2026-08-17 记录)。 5. 推 staging 前必须 `./node_modules/.bin/tsc --noEmit` 通过(BUG-409 防复发)。**不要用 `npx tsc`**,本仓库环境下会装到空包 `tsc@2.0.4`。 6. 测试数不得低于基线 **2205**,且 `fail=0`、`skipped=0`(在有 Docker 的环境里跑)。 7. 不得改 `.gitea/workflows/**`。不得在有未提交改动的工作树上切分支。不得自行把 staging 提升到 main。 让步顺序:功能与测试不回归 > 可验证的修复 > 代码整洁。 ## 开工前置 ```bash git fetch origin --prune git worktree add -b codex/frontend-followup-20260829 \ ../.worktrees/frontend-followup-20260829 origin/staging ``` 基线必须是 `origin/staging`,不是任何本地 ref。读 `pre_work_error_ledger.md`,跑 `scripts/pre_work_check.py`,读 `frontend/AGENTS.md`(Next.js 版本与你训练数据不同,写代码前先看 `node_modules/next/dist/docs/`)。改前先在 `docs/BUG_HISTORY.md` 里检索是否有同类记录。 --- ## 任务 A(P0)· 根 404 / 错误页现在完全没有样式 ### 事实 `src/app/not-found.tsx` 和 `src/app/error.tsx` 的 markup 是纯 Tailwind 工具类,但上一轮把 globals 从根布局段摘掉后,这两页**一条 CSS 都不加载**。构建产物实证: ``` .next/server/app/_not-found.html → 只引用 3b67syn08d_z3.css(2,146 B,纯 Inter @font-face) `min-h-svh` / `text-muted-foreground` 的定义只在 0grkt280n67e_.css(216 KB),该页不加载它 ``` 用户看到的是浏览器默认裸 HTML:不居中、无配色、无间距,`