Files
Genarrative/server-rs
suzmii 888ea76cb2
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
Merge origin/master (b1c89fbba) into chore/rust-compile-warnings:按「让路 master + 最小集恢复」收口跨文件契约冲突
解冲突口径(本次同步 master 16 个提交):

- `agent/generation/canvas_generation.rs`、`command_exec.rs` 两个冲突文件不再整文件取一边,改为按
  hunk 三分法:master 的功能 hunk 全量移植;我们的清理只在 master 调用方不依赖时才保留。
  未恢复整块模块 / 整文件,未新增任何 `#[allow]` / `#[expect]`。
- 成对回退我们的「摘掉 brief 传参空转」清理:master #628 等新代码仍按带 briefs 的契约调用生成链,
  故 cg 的 8 处签名与 6 个调用方(direct_runtime / direct_tool_bridge / commands / commands/desktop /
  asset_generation_tasks)回到 master 形状,并按最小集恢复 `main.rs` 的 `AgentRoleBrief` /
  `AgentGroupBrief`(未恢复其它已删模块)。
- master #628 已收敛切片用途判定:客户端不再暴露/发送 `sliceCount`,本次跟 master 走(
  `PlatformArtAssetGenerationOptions` 不再有该字段),只保留结果侧 256 上限门。
- command_exec 的 `project_command_actual_target` 采用 master 的 `Vec<OsString>` 字节精确契约,
  同时保留我们「调用点全在 Linux 编译面」的 `#[cfg(target_os = "linux")]` 收窄(与 master 调用方不冲突)。
- 脚本缺陷修复:`scripts/check-rust-warnings.mjs` 编译失败不再可能假通过(cargo 退出码非 0 一律 exit 1,
  并把 stderr 尾部提到前面打印;去掉 `warnings.length === 0` 条件)。
- 取 master 版本带来的回流告警 2 条(`main.rs` 两个 brief 结构体的字段未被读)已登记进
  `scripts/warning-baseline.json`(agc-windows 16 条 / agc-linux 71 条,server-rs 0 条);
  按既定口径「不修上游告警」,只做记账。
2026-10-07 21:01:34 +08:00
..
2026-07-17 16:56:46 +08:00
2026-07-17 16:56:46 +08:00

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:跨模块基础能力、日志和测试支撑。

开发规则

  1. server-rs/Cargo.toml 是 workspace 成员和依赖版本事实源;第三方依赖和 workspace 内 crate path 优先放在 [workspace.dependencies]。
  2. module-* 不直接依赖 Axum、SpacetimeDB table/reducer/procedure、reqwest、OSS、LLM、spacetime-client、tokio 或文件系统。
  3. api-server 不承接领域真相;发现领域规则时优先沉到对应 module-*。
  4. SpacetimeDB schema 变化必须同步 spacetime-module/src/migration.rs、生成绑定和当前后端架构文档的表目录。
  5. 人工命令、本地联调和文档示例不要使用 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。

当前文档