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

3.9 KiB
Raw Blame History

WP-ST SpacetimeDB Adapter 收尾记录2026-05-01

1. 收尾目标

本次关闭 SERVER_RS_DDD_PARALLEL_TASKLIST_2026-04-29.mdWP-ST SpacetimeDB Adapter 当前稳定范围已经落地的表、reducer、procedure、event table 和上下文 adapter 必须完成 migration.rs、表目录、Rust bindings 与自动门禁闭环。

收尾后,WP-ST 不再以“多个上下文和绑定生成仍待推进”的口径挂起;后续只有新增 table / reducer / procedure 或 row shape 时,才按增量切片重新认领。

2. 已完成内容

  1. asset_event 已作为 public event 表进入资产主链,覆盖资产对象确认和实体槽位绑定变更事件。
  2. asset_event 已对齐 migration.rsSPACETIMEDB_TABLE_CATALOG.md 和 Rust module_bindings
  3. SPACETIMEDB_TABLE_CATALOG.md 补齐 database_migration_operator、邀请/推荐/会员/充值等 profile 表,以及 asset_event 的结构、索引和查询模板。
  4. scripts/check-server-rs-ddd-boundaries.mjs 新增 SpacetimeDB 表漂移检查,自动核对 table accessor、migration.rs 白名单和表目录项,阻止新增表漏迁移或漏文档。
  5. scripts/generate-spacetime-bindings.mjs 在 Windows 下继续先输出短临时目录;当 SpacetimeDB CLI 已生成文件但自身 formatter 失败时,由脚本分批 rustfmt 后再同步生成目录。
  6. spacetime-client/src/module_bindings 已通过 npm.cmd run spacetime:generate -- --rust-only 重新生成,包含 asset_event_table.rsasset_event_type.rsasset_event_kind_type.rs
  7. spacetime-client/README.md 已同步生成物维护口径:禁止手写 generated code格式化 fallback 只能由仓库生成脚本托管。

3. 边界说明

  1. 本次收尾不把未稳定的新 story action 写接口、前端迁移或旧 compat 删除并入 WP-ST
  2. database_migration_operator 是迁移权限表,本身不导出到业务迁移包;其他业务表必须纳入 migration.rs
  3. spacetime-client/src/module_bindings/** 仍是生成物,不承载手写 facade 或领域规则。
  4. 后续若新增 SpacetimeDB 表,必须同时更新表目录、migration.rs、绑定生成结果,并让 DDD 边界检查通过。

4. 验收命令

本轮收尾至少执行:

npm.cmd run spacetime:generate -- --rust-only
cargo fmt --all --check --manifest-path server-rs\Cargo.toml
cargo check -p spacetime-module --manifest-path server-rs\Cargo.toml
cargo check -p spacetime-client --manifest-path server-rs\Cargo.toml
npm.cmd run check:server-rs-ddd
npm.cmd run check:encoding
npm.cmd run api-server:maincloud

执行结果以本次任务清单记录为准。

5. 本次执行结果

已执行并通过:

npm.cmd run spacetime:generate -- --rust-only
cargo fmt --all --check --manifest-path server-rs\Cargo.toml
cargo check -p spacetime-module --manifest-path server-rs\Cargo.toml
cargo check -p spacetime-client --manifest-path server-rs\Cargo.toml
cargo test -p module-assets --manifest-path server-rs\Cargo.toml
cargo test -p spacetime-client --manifest-path server-rs\Cargo.toml
cargo check -p api-server --manifest-path server-rs\Cargo.toml
npm.cmd run check:server-rs-ddd
npm.cmd run check:encoding
npm.cmd run api-server:maincloud

结果:

  1. Rust bindings 已生成并同步,asset_event 三个生成文件已落盘。
  2. spacetime-modulespacetime-client 编译通过,module-assets 8 个测试通过,spacetime-client 10 个测试通过。
  3. DDD 边界检查通过 15 个 module crate编码检查通过 2815 个文件。
  4. api-server:maincloud 启动后 /healthz 返回 200 {"ok":true,"service":"genarrative-api-server"},本次启动进程已清理并释放 3100 端口。

已知 warningmodule-runtime-storyapi-server 仍有非本次 WP-ST 引入的未使用 helper / prompt warning后续按对应工作包收口不阻塞本次 WP-ST 关闭。