Skip to content

[#903] Illegal draft: named error + recovery; hydration skeleton - #1065

Merged
jinjunnn merged 1 commit into
alphafrom
ready-903-kanpo-impl
Aug 22, 2026
Merged

jinjunnn merged 1 commit into
alphafrom
ready-903-kanpo-impl

Conversation

@jinjunnn

Copy link
Copy Markdown
Owner

Summary

Illegal draft routes get a named error + recovery action; hydration shows a skeleton instead of a blank page.

Fixes #903

Test plan

  • Claude local tests
  • Outer merge

Made with Cursor

`/new-session?draftId=…` 的两个非 happy-path 此前都是「什么都不显示」:
`<Show when={tabs.ready()}>` 无 fallback ⇒ 水合完成前空白页;找不到 draft 时
`fallback={<Navigate href="/" />}` ⇒ 静默弹回首页、零提示。REQ-085(#201)AC2
点名禁止的正是这两项。

改法(最小面):守卫本体抽成 `packages/app/src/pages/draft-route-gate.tsx` ——
零上下文依赖(不 useLanguage/不 useNavigate/不碰 `@/*` 别名),文案与恢复动作
由 `createDraftRoute` 注入。于是 ui-mac 的真组件 lane 能直接挂载它、断真 DOM,
判据断的是渲染结果而不是源码文本(ADR-037 决策 4)。

- 水合中:`DraftRoutePending` 骨架 + role=status/aria-busy/aria-label。
- 缺失/已删除/非法 draftId:`DraftRouteMissing` 具名错误(role=alert)+ 一个
  「返回首页」按钮;守卫**自己不导航** —— 静默跳转正是本票要修掉的行为。
- 文案走 app i18n(en + zh;其余 locale 按上游既有机制回落英文,该包 parity
  在 pin 849c259 上本就红且被上游 skipIf(CI) 治住,本次未加重也未修复它)。
- happy path(打开草稿 / promoteDraft 升级 / 关掉当前草稿页)一字节未变:
  两条路径在 tabs.tsx 里都把「改 store」与「导航」放在同一个 startTransition
  里,不会闪过缺失态。

判据(#903 退出条件,反向验证已实跑):
`test-component/draft-route-gate.cases.ts`(5 条,子进程,真挂载生产模块)+
宿主 `src/renderer/alpha-ui/draft-route-gate.component.test.ts`,并登记进
`scripts/gate-files.tsv`。三次反向:①摘掉 ready 的 fallback ⇒ hydrating 组红;
②摘掉 missing 的 fallback ⇒ missing 组红;③把文案写死并在 fallback 里自动
调 onRecover(等价于旧的静默 Navigate)⇒ missing 组红。
app.tsx 的接线另有一条 seam-contract 减速带(源码锚,非闸门),因为 app.tsx
结构上进不了 bun。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FuY4ooo93aqZcCQy6abbhM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][P2] 非法 draft 静默弹回首页,水合前渲染空白页

1 participant