d0176f48b7
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
按需求文档 revision 1554「发布设置页 → 二创信息区(必填项)」:衍生作品(有血缘行)发布新版本时**必须** 提供「本次核心改动说明」;母版(0 代)不需要——提供了也忽略、不校验、不落库。 - **存储**:`game_distribution_version` **表尾追加** `change_summary: Option<String>`(`#[default(None)]`); 列序属 wire format,`game_distribution_version_type` / `_version_snapshot_type` / `_create_version_input_type` 三个绑定同步重生成(仓外临时 out-dir,只回写受影响文件)。 - **请求**:`GameDistributionCreateVersionRequest.change_summary`(`#[serde(default, skip_serializing_if)]`: 缺省不序列化 `null`,保住旧客户端的幂等摘要)。 - **校验**:纯函数 `game_distribution_change_summary_violation(value, is_derivative)`,trim 后按**字符**计 **20..=500** —— 20 是「能写清改了什么」的下限,500 约 1 KiB 上限,兼顾详情页/族谱展示与存储; 超限或缺失**失败关闭**,错误码 `FORK_CHANGE_SUMMARY_REQUIRED` / `FORK_CHANGE_SUMMARY_INVALID`(均 **400**), 已登记进 api-server 的 `FORK_` 映射表并纳入「FORK 码由模块真实文案可达」的枚举测试(防上次那种不可达码)。 - **公开投影**:`currentVersion.changeSummary`(衍生为字符串、母版 `null`,发键不发值),版本负载键集合 逐字钉死为 id/version/entryUrl/sha256/publishedAt/controls/changeSummary,不带对象键/素材 id/审核字段。 - **契约与登记**:Rust DTO + TS 镜像 + parity(`version_summary_payload` 加 `mustEmit: ['changeSummary']`)。 - **文档**:技术方案 `§3.4`(请求增量 + 长度口径与理由 + 两个错误码 + 幂等摘要口径 + 公开投影)、数据契约 文档的版本表小节(表尾追加列)。 - **测试**:纯函数 5 条(衍生缺失/超短(ASCII 与汉字)/超长(ASCII 与汉字)/区间内 trim 边界/母版忽略)+ 事务 4 条 + 接口 3 条(含公开负载键集合与母版 null)。 门禁:`SPACETIME_SCHEMA_BASE_REF=9f4c7d76 npm run check:spacetime-schema` 0(98 表);`cargo check --all-targets` 0; `cargo test -p module-game-distribution` **119 passed**;`cargo test -p api-server game_distribution` **104 passed**; DTO parity 0(62 组 / 17 构建器 / 15 手拼类型);`check:encoding` 0(5535 files); `cargo fmt --all --manifest-path server-rs/Cargo.toml -- --check` 0;`git diff --check` 0。 注:本块**未提交** `scripts/check-game-distribution-lineage-e2e.mjs` / `check-game-distribution-theme-e2e.mjs` / `capture-game-lineage-visual.mjs` 的配套改动(属别的 session 的文件,工作区里保留未提交,需其 owner 决定: 衍生作品发布若不传 `changeSummary` 现在会 400,那三个脚本需要同步补字段)。
server-rs 工作区说明
更新时间:2026-05-15
server-rs/ 是当前唯一后端工作区,承载 Rust api-server、SpacetimeDB module、领域模块、平台副作用适配和共享契约。旧 server-node、Express、PostgreSQL、Go 服务端和 maincloud 口径均为历史残留,不再作为当前实现目标。
当前职责
crates/api-server:Axum HTTP / SSE / BFF 门面、鉴权、中间件、外部服务编排和 DTO 映射。crates/spacetime-module:SpacetimeDB 表、reducer、procedure、事务 adapter、row mapper 和迁移。crates/spacetime-client:后端访问 SpacetimeDB 的 typed facade。crates/module-*:领域模型、命令、应用规则、领域事件和领域错误。crates/platform-*:OSS、LLM、语音、认证等外部平台能力。crates/shared-contracts:前后端共享 DTO 与公开契约。crates/shared-kernel、crates/shared-logging、crates/tests-support:跨模块基础能力、日志和测试支撑。
开发规则
server-rs/Cargo.toml是 workspace 成员和依赖版本事实源;第三方依赖和 workspace 内 crate path 优先放在[workspace.dependencies]。module-*不直接依赖 Axum、SpacetimeDB table/reducer/procedure、reqwest、OSS、LLM、spacetime-client、tokio或文件系统。api-server不承接领域真相;发现领域规则时优先沉到对应module-*。- SpacetimeDB schema 变化必须同步
spacetime-module/src/migration.rs、生成绑定和当前后端架构文档的表目录。 - 人工命令、本地联调和文档示例不要使用
spacetime --root-dir。
常用命令
cargo check -p api-server --manifest-path server-rs/Cargo.toml
cargo test -p api-server --manifest-path server-rs/Cargo.toml
npm run check:server-rs-ddd
npm run check:spacetime-schema
npm run spacetime:generate
npm run dev:api-server
涉及 API smoke 时用 npm run dev:api-server 启动后端并检查 /healthz,不要使用旧 api-server:maincloud。
当前文档
- ../docs/【后端架构】server-rs与SpacetimeDB数据契约-2026-05-15.md:DDD 边界、API 分组、schema 变更规则和表目录。
- ../docs/【开发运维】本地开发验证与生产运维-2026-05-15.md:本地启动、检查、SpacetimeDB 操作和生产运维。