Files
Genarrative/docs/technical/SERVER_RS_DDD_WP_DEL_CLEANUP_2026-05-01.md

5.3 KiB
Raw Permalink Blame History

WP-DEL 旧层删除与命名收口

日期2026-05-01

目标

本轮 WP-DEL 只处理已被新主链完全替代的旧 HTTP contract、旧 route、旧前端 alias 和旧测试夹具,不新增业务能力,不恢复 server-node 兼容,不修改 SpacetimeDB 表结构。

已删除范围

  1. Runtime Story 旧 HTTP DTO
    • Rust RuntimeStoryStateResolveRequest
    • Rust/TS RuntimeStoryBootstrapRequest/Response
    • Rust/TS RuntimeStoryActionResponse
    • TS 泛型 RuntimeActionRequest/Response
    • RuntimeStorySnapshotPayload 只作为旧 HTTP 总入口快照结构删除;当前 story session scoped 写侧使用 StoryRuntimeMutationResponse.projection
  2. Runtime Story 前端旧命名:
    • beginRpgRuntimeStorySession
    • resolveRpgRuntimeStoryAction
    • getRpgStoryRuntimeProjection
    • getRpgRuntimeActionSnapshot
    • rpgRuntimeStoryClient 聚合对象
    • 其他 Rpg*RuntimeStory* alias 统一删除,前端只导出当前主链命名。
  3. Custom World 旧非 runtime 前缀路由:
    • POST /api/custom-world/entity
    • POST /api/custom-world/scene-npc
    • POST /api/custom-world/scene-image
    • POST /api/custom-world/cover-image
    • POST /api/custom-world/cover-upload
    • 当前主链固定为 /api/runtime/custom-world/*
  4. Puzzle 旧本地下一关入口:
    • POST /api/runtime/puzzle/runs/local-next-level
    • Rust/TS AdvanceLocalPuzzleNextLevelRequest
    • API 层本地 next-level 拼装 helper 与对应旧测试。
  5. /generated-* 资产直读代理:
    • GET /generated-character-drafts/{*path}
    • GET /generated-characters/{*path}
    • GET /generated-animations/{*path}
    • GET /generated-big-fish-assets/{*path}
    • GET /generated-puzzle-assets/{*path}
    • GET /generated-custom-world-scenes/{*path}
    • GET /generated-custom-world-covers/{*path}
    • GET /generated-qwen-sprites/{*path}
    • api-server 同源代理模块 legacy_generated_assets.rs
    • Vite 与发布静态服务器中的 /generated-* 直读转发配置。

保留边界

  1. /generated-* 字符串仍可作为历史 DTO 与测试夹具里的 legacyPublicPath 标识OSS object key 前缀和 LegacyAssetPrefix 继续保留但浏览器、Vite、本地发布静态服务器和 api-server 不再提供 /generated-* 裸读入口。
  2. 正式读取契约固定为 asset_objectGET /api/assets/read-urlResolvedAssetImage/useResolvedAssetReadUrl 或业务投影里的签名读 URL 字段。
  3. RuntimeStoryActionRequest 仍保留为 module-runtime-story 内部动作规则输入,不作为旧 HTTP route contract。
  4. RuntimeStoryViewModelRuntimeStoryPresentationRuntimeStoryPatch 和 battle presentation 仍作为当前投影/表现构件保留,不再代表旧 /api/runtime/story/* 总入口响应。
  5. 历史设计文档中对旧 route/DTO 的引用只作为时间点记录保留,不批量改写旧档案。

验收门禁

计划执行:

cargo fmt --all --manifest-path server-rs\Cargo.toml
cargo fmt --all --check --manifest-path server-rs\Cargo.toml
npm.cmd run check:server-rs-ddd
cargo check --workspace --manifest-path server-rs\Cargo.toml
cargo test --workspace --exclude spacetime-module --manifest-path server-rs\Cargo.toml
npm.cmd run test -- src/services/rpg-runtime/rpgRuntimeStoryClient.test.ts src/hooks/rpg-runtime-story/runtimeStoryCoordinator.test.ts src/services/ai.test.ts src/services/puzzle-runtime
npm.cmd run check:encoding -- docs/technical/SERVER_RS_DDD_WP_DEL_CLEANUP_2026-05-01.md docs/technical/README.md docs/technical/SERVER_RS_DDD_G1_CONTRACT_AND_ROUTE_MATRIX_2026-04-29.md docs/technical/SERVER_RS_DDD_PARALLEL_TASKLIST_2026-04-29.md server-rs/crates/shared-contracts/README.md server-rs/crates/api-server/README.md server-rs/crates/module-puzzle/README.md

实际结果:

  1. cargo fmt --all --manifest-path server-rs\Cargo.toml:通过。
  2. cargo fmt --all --check --manifest-path server-rs\Cargo.toml:通过。
  3. npm.cmd run check:server-rs-ddd通过15 个 module crate 边界检查通过。
  4. cargo check --workspace --manifest-path server-rs\Cargo.toml:通过;仅保留既有 runtime chat prompt dead code warning。
  5. cargo test --workspace --exclude spacetime-module --manifest-path server-rs\Cargo.toml:通过;api-server 207 个测试通过、4 个 live/外部依赖测试按既有条件忽略。
  6. npm.cmd run test -- src/services/rpg-runtime/rpgRuntimeStoryClient.test.ts src/hooks/rpg-runtime-story/runtimeStoryCoordinator.test.ts src/services/ai.test.ts src/services/puzzle-runtime通过4 个测试文件 45 个用例通过。
  7. npm.cmd run check:encoding:通过,全量 2816 个文件通过 UTF-8/乱码检查。
  8. npm.cmd run spacetime:generate -- --rust-only通过SpacetimeDB CLI 在 Windows 长路径格式化阶段触发已知失败后,项目脚本使用短路径分批 rustfmt fallback 完成。
  9. cargo check -p spacetime-module --manifest-path server-rs\Cargo.toml:通过。
  10. npm.cmd run api-server:maincloud:通过;后端拉起后 GET http://127.0.0.1:3100/healthz 返回 200 {"ok":true,"service":"genarrative-api-server"},随后已清理本次 smoke 进程并确认 3100 端口释放。启动期 Maincloud 订阅恢复出现两条 503 Service Unavailable 警告,不影响 healthz smoke。