Files
Genarrative/server-rs
lhk229 bc28f00c2d
Project CI / Repository checks (pull_request) Successful in 1m6s
Project CI / Native shell tests (pull_request) Successful in 2m28s
Project CI / Backend tests (pull_request) Successful in 3m30s
Project CI / Frontend tests (pull_request) Successful in 1m14s
修复 inline 路径修复性回读缺少绝对 deadline
上一轮把修复性回读绑到外层 request_deadline,但 with_external_call_deadline
只在队列 worker 与 openai_image_generation 两处调用,inline HTTP 请求的
RequestContext 默认 external_call_deadline=None,于是 download_deadline 传下去
仍是 None,走无界 download.await——该修复实际只对队列模式生效。

守卫改为在 request_deadline 缺失时自行以 Instant::now() +
EDITOR_PIXEL_ART_MAX_PROCESSING_DURATION 重新计时派生上界,两种模式下都不再
出现无界 GET。结构断言同时要求出现 unwrap_or_else 兜底与该常量。

同时修正决策记录里「最多增加一次 OSS GET」的措辞:约束是不重复读取已成功
取得的对象,而非整个请求至多一次 GET;第一次回读失败或被像素预算掐断时
允许第二次也是最后一次尝试,不视为违规。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-29 13:12:21 +00: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-serverAxum HTTP / SSE / BFF 门面、鉴权、中间件、外部服务编排和 DTO 映射。
  • crates/spacetime-moduleSpacetimeDB 表、reducer、procedure、事务 adapter、row mapper 和迁移。
  • crates/spacetime-client:后端访问 SpacetimeDB 的 typed facade。
  • crates/module-*:领域模型、命令、应用规则、领域事件和领域错误。
  • crates/platform-*:OSS、LLM、语音、认证等外部平台能力。
  • crates/shared-contracts:前后端共享 DTO 与公开契约。
  • crates/shared-kernelcrates/shared-loggingcrates/tests-support:跨模块基础能力、日志和测试支撑。

开发规则

  1. server-rs/Cargo.toml 是 workspace 成员和依赖版本事实源;第三方依赖和 workspace 内 crate path 优先放在 [workspace.dependencies]
  2. module-* 不直接依赖 Axum、SpacetimeDB table/reducer/procedure、reqwest、OSS、LLM、spacetime-clienttokio 或文件系统。
  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

当前文档