refactor: 收口创作直达恢复判定

This commit is contained in:
2026-06-04 01:43:31 +08:00
parent 75593b8860
commit 0d2d391cb2
6 changed files with 98 additions and 19 deletions

View File

@@ -7,9 +7,9 @@
## 决策
- 新增 `src/components/platform-entry/platformCreationUrlStateModel.ts` 作为 Creation URL State Module。
- 该 Module 的 Interface 收口为各玩法 `build*CreationUrlState`、拼图 `buildPuzzle*RuntimeUrlState``normalizeCreationUrlValue``hasCreationUrlStateValue``hasPuzzleRuntimeUrlStateValue``buildPuzzleRuntimeUrlStateKey`
- 该 Module 的 Interface 收口为各玩法 `build*CreationUrlState`、拼图 `buildPuzzle*RuntimeUrlState``normalizeCreationUrlValue``hasCreationUrlStateValue``hasPuzzleRuntimeUrlStateValue``buildPuzzleRuntimeUrlStateKey` 与初始创作 URL 恢复判定 `resolveInitialCreationUrlRestoreDecision`
- 新增 `src/components/platform-entry/platformPuzzleIdentityModel.ts` 作为拼图稳定身份 Module统一 `puzzle-session-*``puzzle-profile-*``puzzle-work-*` 的互推规则。
- `PlatformEntryFlowShellImpl.tsx` 保留 React state、路由、登录门禁、网络请求和 URL 写入副作用 Adapter不再在壳层内定义各玩法 URL 状态构造函数。
- `PlatformEntryFlowShellImpl.tsx` 保留 React state、路由、登录门禁、网络请求和 URL 写入副作用 Adapter不再在壳层内定义各玩法 URL 状态构造函数,也不直接内联初始恢复的已处理 / 等待 / 可恢复判定
## Interface 约束
@@ -18,11 +18,12 @@
- work-backed 玩法优先使用后端 work summary 的公开 `workId` / `profileId`;仅缺失时才回退 session draft。
- 拼图 runtime query 独立使用 `mode``runtimeSessionId``runtimeProfileId``runtimeLevelId``publicWorkCode`,不与创作恢复 query 混写。
- 拼图 draft runtime 若没有 `sourceSessionId`,只允许从 `puzzle-profile-*` 反推出 `puzzle-session-*`
- 初始创作 URL 恢复只在未处理、当前路径属于创作恢复路径、私有 query 有值、平台配置加载完成且受保护数据可读时执行;非创作路径或无私有 query 时标记已处理,加载中或暂不可读时等待。
## Depth / Leverage / Locality
- **Depth**:调用方只传玩法快照或作品摘要,即可得到规范化 URL state各玩法字段优先级藏在 Module Implementation 内。
- **Leverage**:新增或调整玩法恢复规则时,优先补 Module Interface 测试,再接壳层 Adapter。
- **Leverage**:新增或调整玩法恢复规则、恢复等待条件时,优先补 Module Interface 测试,再接壳层 Adapter。
- **Locality**:恢复 query、拼图 runtime query 和拼图稳定身份规则集中在两个小 Module避免散落在页面壳、作品架和 runtime 打开逻辑中。
## 验收