升级 SpacetimeDB 工具链到 2.8.3 #200
@@ -51,7 +51,7 @@ SpacetimeDB 是数据和事务层,不替代 `api-server` BFF、`spacetime-clie
|
||||
- 授权使用上下文中的 `ctx.sender()`(或当前语言对应 API),不信任调用参数传入的身份。
|
||||
- Auto-increment ID 不是排序依据;需要顺序时使用时间戳或显式序列字段。
|
||||
- Private table 是后端事实;用户可见状态通过 BFF、投影或明确的 public table/view 暴露。公共表仍只能由 reducer/procedure 写入。
|
||||
- Procedure 在 2.7 已稳定,可使用显式事务和 `ctx.http`;Genarrative 默认仍把外部 provider 协议放在 `platform-*`,把编排放在 `api-server`,除非当前架构明确要求 module procedure。
|
||||
- Procedure 在 2.8 已稳定,可使用显式事务和 `ctx.http`;Genarrative 默认仍把外部 provider 协议放在 `platform-*`,把编排放在 `api-server`,除非当前架构明确要求 module procedure。
|
||||
- Event table 必须显式订阅,按插入事件消费;不要依赖其持久化行或 `OnUpdate`。需要更新回调时使用持久表或带主键的 procedural view。
|
||||
- Standalone MCP 是 operator/developer 集成面,不是 BFF、facade 或公开 read model 的替代品。MCP/SQL/CLI 的写入都必须有明确授权;日常 smoke 优先只读。
|
||||
|
||||
@@ -78,13 +78,13 @@ Event table 的较宽松自动迁移规则不适用于 persistent table,不能
|
||||
- 不新增 `maincloud` / `MAINCLOUD` 命令、环境变量、脚本或文档;历史残留只按历史处理。
|
||||
- 人工命令、本地联调、排障步骤和文档示例禁止使用 `spacetime --root-dir`;本地数据隔离使用项目脚本或 `--data-dir`。
|
||||
- `spacetime publish` 的 `--delete-data=always` 只在明确授权的破坏性操作中使用;schema 冲突优先按项目脚本和受控迁移流程处理。
|
||||
- 项目 SpacetimeDB crate、SDK、CLI/standalone 和生成 bindings 按 `2.7.0` 对齐;官方 `v2.7.0-hotfix3` 是发行资产标签,运行时二进制仍应报告 `2.7.0`,当前 hotfix3 CLI commit 为 `d220349adb7af7eefa810eb08a185609356b83f6`,裸 tag commit `a08663c7b94688a2542577532d472f751e641f5b` 即使版本号相同也必须拒绝。升级时核对 Cargo 精确 pin、实际 CLI 和运行中服务二进制,不把本地 CLI 重装当作仓库升级。
|
||||
- 项目 SpacetimeDB crate、SDK、CLI/standalone 和生成 bindings 按 `2.8.3` 对齐;官方发行资产、Rust crates 和容器镜像使用 `v2.8.3` 版本标签,仓库额外固定 CLI commit `8e410d2842147bd8e5a32a9589cc00c19f7478e2`。升级时核对 Cargo 精确 pin、实际 CLI 和运行中服务二进制,不把本地 CLI 重装当作仓库升级。
|
||||
|
||||
本地开发默认由项目启动器管理端口;实际监听地址以 `.app/dev-stack.json` 和启动日志为准,不能从文档默认端口推断当前目标。发布后确认 api-server 使用的是同一 database、server 和 token。
|
||||
|
||||
## MCP 与运行时核验
|
||||
|
||||
如果当前会话暴露 SpacetimeDB MCP 工具,读取运行中的数据库优先使用 typed MCP:先 `list_databases` / `get_schema`,再做只读 SQL 或 `ping`;调用 reducer 或 SQL 写入前确认目标、身份和授权。没有 MCP 工具时使用显式目标的 CLI。2.7 standalone 的 MCP HTTP endpoint 是 `POST /v1/database/{name_or_identity}/mcp`,提供 `ping`、`get_schema`、`sql`、`call`;升级 smoke 在隔离数据库中只做 `initialize`、`tools/list`、`ping`、`get_schema`,除非写入明确属于任务范围。
|
||||
如果当前会话暴露 SpacetimeDB MCP 工具,读取运行中的数据库优先使用 typed MCP:先 `list_databases` / `get_schema`,再做只读 SQL 或 `ping`;调用 reducer 或 SQL 写入前确认目标、身份和授权。没有 MCP 工具时使用显式目标的 CLI。2.8 standalone 的 MCP HTTP endpoint 是 `POST /v1/database/{name_or_identity}/mcp`,提供 `ping`、`get_schema`、`sql`、`call`;升级 smoke 在隔离数据库中只做 `initialize`、`tools/list`、`ping`、`get_schema`,除非写入明确属于任务范围。
|
||||
|
||||
排查“服务健康但业务不可用”时按顺序核对:
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ Linux Docker Engine 若要从宿主机 CLI 连到容器内服务,直接用 `ht
|
||||
|
||||
## 构建工具链
|
||||
|
||||
`api-server` 容器镜像只构建 Linux release API 二进制,不构建 `spacetime-module`。当前 `api-server -> spacetime-client -> spacetimedb-sdk 2.7.0` 依赖链继续兼容 Rust 1.93,因此 `deploy/container/api-server.Dockerfile` 的 Rust builder 固定为 `rust:1.93-bookworm`。Web builder 显式安装并校验 npm `10.9.7`,再按唯一根 workspace lock 执行一次 `npm ci`,不依赖 Node 基础镜像隐含的 npm 版本。镜像构建阶段会同时复制 `public/`,用于满足 API 二进制里 `include_bytes!` 引用的内置素材;不要把 `public/generated-*` 放入镜像上下文。如果本机 Docker Hub 拉取失败,可以先在本机准备同名本地 builder 镜像,但不要把临时 bootstrap 容器或私有 registry 凭据写入仓库。
|
||||
`api-server` 容器镜像只构建 Linux release API 二进制,不构建 `spacetime-module`。当前 `api-server -> spacetime-client -> spacetimedb-sdk 2.8.3` 依赖链继续兼容 Rust 1.93,因此 `deploy/container/api-server.Dockerfile` 的 Rust builder 固定为 `rust:1.93-bookworm`。Web builder 显式安装并校验 npm `10.9.7`,再按唯一根 workspace lock 执行一次 `npm ci`,不依赖 Node 基础镜像隐含的 npm 版本。镜像构建阶段会同时复制 `public/`,用于满足 API 二进制里 `include_bytes!` 引用的内置素材;不要把 `public/generated-*` 放入镜像上下文。如果本机 Docker Hub 拉取失败,可以先在本机准备同名本地 builder 镜像,但不要把临时 bootstrap 容器或私有 registry 凭据写入仓库。
|
||||
|
||||
### Jenkins 预览 secrets 镜像边界
|
||||
|
||||
@@ -164,7 +164,7 @@ npm run container:worker-smoke -- status
|
||||
npm run container:worker-smoke -- smoke --force
|
||||
```
|
||||
|
||||
`container:worker-smoke` 默认会把本机 `spacetime` 2.7.0 CLI 打成轻量 SpacetimeDB 镜像,避免首次 smoke 必须拉取官方大镜像;普通 `npm run container:*` 压测默认使用 `clockworklabs/spacetime:v2.7.0-hotfix3`(容器内二进制报告 2.7.0)。如果 Docker build 阶段在容器内拉取 crates.io 依赖不稳定,可让容器内 Cargo 复用本机 Cargo 缓存构建当前二进制,再打入临时 smoke 镜像。该模式默认使用 `rust:1.93-bookworm` 作为 builder、Debian bookworm smoke runtime 承载构建产物;需要换 builder 镜像时设置 `GENARRATIVE_WORKER_SMOKE_CARGO_IMAGE`,需要换运行时基础镜像时设置 `GENARRATIVE_WORKER_SMOKE_LOCAL_BASE_IMAGE`:
|
||||
`container:worker-smoke` 默认会把本机 `spacetime` 2.8.3 CLI 打成轻量 SpacetimeDB 镜像,避免首次 smoke 必须拉取官方大镜像;普通 `npm run container:*` 压测默认使用 `clockworklabs/spacetime:v2.8.3`(容器内二进制报告 2.8.3)。如果 Docker build 阶段在容器内拉取 crates.io 依赖不稳定,可让容器内 Cargo 复用本机 Cargo 缓存构建当前二进制,再打入临时 smoke 镜像。该模式默认使用 `rust:1.93-bookworm` 作为 builder、Debian bookworm smoke runtime 承载构建产物;需要换 builder 镜像时设置 `GENARRATIVE_WORKER_SMOKE_CARGO_IMAGE`,需要换运行时基础镜像时设置 `GENARRATIVE_WORKER_SMOKE_LOCAL_BASE_IMAGE`:
|
||||
|
||||
```bash
|
||||
npm run container:worker-smoke -- smoke --local-binary
|
||||
|
||||
@@ -2,7 +2,7 @@ name: genarrative-container-loadtest
|
||||
|
||||
services:
|
||||
spacetimedb:
|
||||
image: ${GENARRATIVE_CONTAINER_SPACETIME_IMAGE:-clockworklabs/spacetime:v2.7.0-hotfix3}
|
||||
image: ${GENARRATIVE_CONTAINER_SPACETIME_IMAGE:-clockworklabs/spacetime:v2.8.3}
|
||||
user: root
|
||||
command:
|
||||
[
|
||||
|
||||
@@ -16,6 +16,14 @@
|
||||
|
||||
---
|
||||
|
||||
## 2026-08-27 SpacetimeDB 工具链统一升级到 2.8.3
|
||||
|
||||
- 背景:SpacetimeDB 2.8.0 引入 TypeScript submodule 与调度延迟观测,2.8.1 修复 v1 WebSocket 订阅移除死锁、TypeScript SDK `array<u8>` 读缓存别名和 Rust string 默认值支持,2.8.2 修复 table accessor 改名自动迁移,2.8.3 修复 scheduled function 从实际执行时间重排导致的长期漂移。仓库若继续锁定 2.7.0,会保留这些已知运行时与 SDK 问题。
|
||||
- 决策:`server-rs/Cargo.toml` 的 `spacetimedb`、`spacetimedb-sdk`、`spacetimedb-lib` 精确锁定 2.8.3;本地 CLI / standalone、Rust bindings、worker smoke 本地镜像、官方容器压测镜像和生产 provision 下载根同步对齐 `v2.8.3`,CLI / standalone commit 门禁为 `8e410d28...`。2.8.3 不再使用 2.7.0 的 hotfix3 特殊资产标签口径,但同版本 commit 校验继续保留。
|
||||
- 影响范围:Rust workspace lockfile、SpacetimeDB bindings、本地 dev 版本门禁、容器 smoke / loadtest、server provision Jenkins 与项目 SpacetimeDB skills / 文档;现役 module 未使用 submodule,本次不修改 schema 或 migration。
|
||||
- 验证方式:核对 CLI 版本和 commit,重新生成 Rust bindings,运行 `npm run check:spacetime-schema`、相关 Cargo check / tests、server provision 工具测试、dev 调度测试、encoding 和 diff 门禁。
|
||||
- 关联文档:`docs/【后端架构】server-rs与SpacetimeDB数据契约-2026-05-15.md`、`docs/【开发运维】本地开发验证与生产运维-2026-05-15.md`。
|
||||
|
||||
## 2026-08-24 AGC Direct 媒体能力只通过客户端语义工具开放
|
||||
|
||||
- 背景:资源页已经补齐视频、角色动画、音效和背景音乐的 create/derive 能力,但 Direct Codex 只能准备标准美术包,无法查询已登记源资源或表达新增媒体意图。直接开放 Tauri invoke 会把项目路径、revision、operation、幂等键、登录态和事务权力交给模型。
|
||||
|
||||
@@ -35,7 +35,7 @@ Genarrative / 陶泥儿当前主站聚焦图片画布创作、编辑器项目与
|
||||
server-rs + Axum + SpacetimeDB
|
||||
```
|
||||
|
||||
SpacetimeDB crate、SDK、CLI / standalone 与生成 bindings 按 `2.7.0` 对齐;官方发行包和容器镜像使用 `v2.7.0-hotfix3` 资产标签,二进制仍报告 `2.7.0`。
|
||||
SpacetimeDB crate、SDK、CLI / standalone 与生成 bindings 按 `2.8.3` 对齐;CLI / standalone commit 固定核对为 `8e410d2842147bd8e5a32a9589cc00c19f7478e2`,官方发行包和容器镜像使用 `v2.8.3` 标签。
|
||||
|
||||
职责边界:
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ server-rs + Axum + SpacetimeDB
|
||||
|
||||
`server-rs/Cargo.toml` 是 workspace 事实源。默认构建成员为 `crates/api-server`;第三方依赖版本和 workspace 内 crate path 统一放在 `[workspace.dependencies]`。
|
||||
|
||||
SpacetimeDB 版本口径:当前 Rust crate `spacetimedb`、`spacetimedb-sdk`、`spacetimedb-lib` 统一锁定 `2.7.0`;本地 `spacetime` CLI / standalone、生成的 `spacetime-client` bindings 和容器压测镜像也必须与 `server-rs/Cargo.toml` 锁定版本对齐,避免 BSATN / procedure result 反序列化错配。2.7.0 官方 CLI / standalone 发行包与容器镜像使用 `v2.7.0-hotfix3` 资产标签,二进制版本仍为 `2.7.0`;不得回退使用缺少后续 backing-view 迁移修复的裸 tag 构建。遇到版本不匹配时,不继续沿着业务超时排查,先把 CLI / standalone 直接升级到锁定版本并重启后再重试。2.6.1 还修复了 procedure context 中调用者 `Identity` / `ConnectionId` 丢失问题,因此依赖调用者身份的 procedure 不得继续运行在 2.6.0 standalone 上。
|
||||
SpacetimeDB 版本口径:当前 Rust crate `spacetimedb`、`spacetimedb-sdk`、`spacetimedb-lib` 统一锁定 `2.8.3`;本地 `spacetime` CLI / standalone、生成的 `spacetime-client` bindings、容器压测镜像和生产 provision 也必须与 `server-rs/Cargo.toml` 锁定版本对齐,避免 BSATN / procedure result 反序列化错配。2.8.3 官方 CLI / standalone 发行包、Rust crates 与容器镜像使用同版本号;CLI / standalone 还必须核对 commit `8e410d2842147bd8e5a32a9589cc00c19f7478e2`。遇到版本不匹配时,不继续沿着业务超时排查,先把 CLI / standalone 直接升级到锁定版本并重启后再重试。2.6.1 修复了 procedure context 中调用者 `Identity` / `ConnectionId` 丢失问题;2.8.3 修复 scheduled function 从实际执行时间重排导致的长期漂移。
|
||||
|
||||
当前主要 crate:
|
||||
|
||||
@@ -185,7 +185,7 @@ npm run check:server-rs-ddd
|
||||
7. 面向公开列表的只读投影优先做成 public view / public 读模型表,并由 `api-server` 的 `spacetime-client` 长期订阅后读本地 cache。跨玩法公开作品统一主读模型是 `public_work_gallery_entry` 和 `public_work_detail_entry`;公开作品资产读取授权投影是 `public_work_asset_read_grant`;各玩法既有 `*_gallery_card_view` / `*_gallery_view` / `custom_world_gallery_entry` 保留为 source view 和兼容路径。短期不把作品列表整体交给浏览器前端直接订阅;不要让 HTTP 列表接口每次请求都调用 procedure 重新组装全量列表。需要请求时间窗口的轻量统计可订阅 `public_work_play_daily_stat` 后在 `api-server` 本地聚合,需要写入副作用的详情、点赞、游玩记录仍走玩法 procedure / reducer。前端不得直接订阅 `puzzle_work_profile`、`custom_world_profile` 等领域源表,也不得自己做 join、聚合或权限逻辑。首屏、排序、字段归一、权限降级和 HTTP fallback 由 `api-server` BFF 维持。
|
||||
8. 多列索引按 SpacetimeDB 绑定生成的元组参数直接传入,例如 `.filter((source_type, profile_id, played_day))`;前缀查询只传前缀元组,例如 `.filter((scope_kind, scope_id.as_str()))`。不要为了绕过类型问题退回整表遍历。
|
||||
9. procedure result 必须返回 typed snapshot / typed value。`spacetime-client` mapper 不得再通过 `row_json/session_json/work_json/items_json/run_json/event_json/feedback_json: Option<String>` 做跨层 JSON 字符串传输,也不得在 mapper 里反序列化旧 `*JsonRecord` 兼容结构。业务内部持久化字段如 `profile_payload_json`、`levels_json` 等不属于 procedure result 载荷例外,仍按各自表契约处理。
|
||||
10. procedure 需要按调用者 identity 鉴权时,必须先从外层 `ProcedureContext::sender()` 捕获 caller,再把 caller 显式传入 `try_with_tx` 闭包内的事务函数。当前 workspace 锁定 SpacetimeDB `2.7.0`;鉴权边界不得依赖事务上下文的隐式 sender 语义,即使 SDK 升级也继续保持显式 caller 参数。
|
||||
10. procedure 需要按调用者 identity 鉴权时,必须先从外层 `ProcedureContext::sender()` 捕获 caller,再把 caller 显式传入 `try_with_tx` 闭包内的事务函数。当前 workspace 锁定 SpacetimeDB `2.8.3`;鉴权边界不得依赖事务上下文的隐式 sender 语义,即使 SDK 升级也继续保持显式 caller 参数。
|
||||
11. 修改后运行:
|
||||
|
||||
```bash
|
||||
@@ -762,7 +762,7 @@ Responses 的终态载荷既是工具调用的恢复源,也是正文的恢复
|
||||
- 说明:图片画布工程、素材文件夹和工程资源首次创建的私有 durable receipt。主键 `receipt_key` 由认证 owner、接口 namespace 与 API 根据 `Idempotency-Key` 派生的请求记录 ID 做 domain-separated SHA-256 得到;`request_sha256` 覆盖完整规范化 create payload,但不包含每次重试都会变化的请求时间。首次业务行、副作用与 receipt 必须在同一 SpacetimeDB 事务中提交,主键唯一约束负责并发仲裁。
|
||||
- 重放:同 owner、namespace、key 与同一原始规范化正文重放时,按 receipt 的 `result_record_id` 返回当前业务行,因此工程改名、目录更新或资源元数据后仍不会把当前可变行误判为请求正文漂移;同键异正文返回 `409`。receipt 不随业务行删除,首次结果已删除时重放统一返回 `409` 并拒绝重建;receipt 缺失但请求稳定 ID 已存在同样失败关闭,不能补造 receipt 或重复首次副作用。
|
||||
- 索引:主键 `receipt_key`;`by_editor_idempotent_create_receipt_owner(owner_user_id, namespace, request_record_id)` 仅用于受控诊断。表为 private,不作为工程、目录或资源 read model。
|
||||
- 真实事务门禁:运行 `npm run check:editor-idempotency-procedures`,在隔离的 SpacetimeDB 2.7.0 hotfix3 standalone 中发布当前模块,验证工程、素材文件夹和工程资源的同正文重放、异正文冲突、并发仲裁、删除后失败关闭,以及业务行与 private receipt 一一对应且无孤儿;源码字符串断言不能替代该门禁。
|
||||
- 真实事务门禁:运行 `npm run check:editor-idempotency-procedures`,在隔离的 SpacetimeDB 2.8.3 standalone 中发布当前模块,验证工程、素材文件夹和工程资源的同正文重放、异正文冲突、并发仲裁、删除后失败关闭,以及业务行与 private receipt 一一对应且无孤儿;源码字符串断言不能替代该门禁。
|
||||
|
||||
### `editor_generation_runtime_identity_rotation`
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ spacetime sql <database> "SELECT * FROM runtime_setting LIMIT 1" --server http:/
|
||||
|
||||
本地 `npm run dev:spacetime` 发布模块时必须显式忽略仓库根目录的 `spacetime.json`,由脚本固定追加 `--no-config` 并使用命令参数里传入的数据库名和 `--server http://127.0.0.1:3101`。否则 CLI 可能把发布目标改写到配置文件里的其他数据库,导致 `dev:spacetime` 启动后又因发布失败自动退出,浏览器随后会在 `ws://127.0.0.1:3101/v1/database/.../subscribe` 看到连接拒绝。
|
||||
|
||||
本地 `spacetime` CLI / standalone 版本必须和 `server-rs/Cargo.toml` 里锁定的 `spacetimedb` 版本一致;当前统一版本为 `2.7.0`。官方发行包位于 `v2.7.0-hotfix3` 资产标签,二进制仍报告 `2.7.0`;运行态和 provision 必须使用该 hotfix 构建,不得只按裸 `v2.7.0` tag 下载。当前 updater 元数据可能让 `spacetime version install 2.7.0` 装到裸 tag commit `a08663c7...`,所以 2.7.0 安装后必须核对 `spacetime --version` 的 commit 为 hotfix3 `d220349a...`;不一致时改用官方 hotfix3 archive 或仓库 provision 流程。若版本错配,procedure 返回值可能在宿主侧触发 `Failed to BSATN deserialize procedure return value`,api-server 最终表现为现役 settings、editor project 或 profile procedure 超时。排障时先运行 `spacetime --version`,再对照 `server-rs/Cargo.toml` 的 `spacetimedb = "..."`;其它版本可执行 `spacetime version install <version> && spacetime version use <version>`,升级后重启 `npm run dev:spacetime` 再重试。当前 `scripts/dev.mjs` 会把 tool version 和 commit 一起写入 `dev-spacetime-tool-version`,启动新 standalone 与复用已有本地进程时都要求 `2.7.0 + d220349a...` 同时匹配;旧单行版本记录会拒绝复用并要求重启。2.6.1 修复了 procedure context 中调用者 `Identity` / `ConnectionId` 始终为空的回归,依赖 `ctx.sender` 鉴权时必须同时确认宿主已升级。
|
||||
本地 `spacetime` CLI / standalone 版本必须和 `server-rs/Cargo.toml` 里锁定的 `spacetimedb` 版本一致;当前统一版本为 `2.8.3`,CLI / standalone commit 固定核对为 `8e410d2842147bd8e5a32a9589cc00c19f7478e2`。若版本或 commit 错配,procedure 返回值可能在宿主侧触发 `Failed to BSATN deserialize procedure return value`,api-server 最终表现为现役 settings、editor project 或 profile procedure 超时。排障时先运行 `spacetime --version`,再对照 `server-rs/Cargo.toml` 的 `spacetimedb = "..."`;其它版本可执行 `spacetime version install <version> && spacetime version use <version>`,升级后重启 `npm run dev:spacetime` 再重试。当前 `scripts/dev.mjs` 会把 tool version 和 commit 一起写入 `dev-spacetime-tool-version`,启动新 standalone 与复用已有本地进程时都要求 `2.8.3 + 8e410d28...` 同时匹配;旧版本或旧单行版本记录会拒绝复用并要求重启。2.6.1 修复了 procedure context 中调用者 `Identity` / `ConnectionId` 始终为空的回归,依赖 `ctx.sender` 鉴权时必须同时确认宿主已升级。
|
||||
|
||||
本地 `.env`、`.env.local` 或 `.env.secrets.local` 修改后必须重启 `api-server` 才会生效;若已经通过 `npm run dev` 启动完整联调,可在该终端输入 `rs api-server`。排查图片编辑器 VectorEngine 生成链路时,确认 `VECTOR_ENGINE_BASE_URL`、`VECTOR_ENGINE_API_KEY` 和 `VECTOR_ENGINE_IMAGE_REQUEST_TIMEOUT_MS` 只在本地或服务器密钥文件中配置,不能写入 Git。`VECTOR_ENGINE_IMAGE_REQUEST_TIMEOUT_MS` 是单次 attempt 的配置上限,默认 `1000000`;配置加载层允许显式值低于该默认值,不再在读取环境变量时强制抬高。业务模型和 VectorEngine provider 首选请求都使用 `gpt-image-2`,符合条件时才回退到兜底模型 `gpt-image-2-c`;图片协议、URL / base64 响应解析、远端图片下载和 provider 侧结构化日志在 `server-rs/crates/platform-image`,`api-server` 只做编辑器请求编排、OSS / asset 持久化、计费和失败审计落库。`platform-image` 会在 JSON 生成和 multipart 编辑请求发送前按同一 GPT-image-2 family 规则归一显式像素尺寸;若请求发送失败,先按同一 `request_id` 查看 provider 日志与 `external_api_call_failure.metadata_json.errorSource`,当前 multipart `/v1/images/edits` 单独强制 HTTP/1.1。
|
||||
|
||||
@@ -677,7 +677,7 @@ worker 被硬杀或断电后,lease 过期任务只有尚未耗尽 `max_attempt
|
||||
- `api-server` 正常运行时 `/healthz` 只返回进程存活状态,`/readyz` 会同时检查进程是否仍接收新流量和 SpacetimeDB 连接租约是否健康;收到 `SIGINT` / `SIGTERM` 后会先把 readiness 标记为不可用,再让 Axum 停止接新连接并等待已有 HTTP 请求排空。systemd 仍以 `KillSignal=SIGINT` 停服务,`TimeoutStopSec=90` 作为长请求排空上限。
|
||||
- SpacetimeDB 健康检查默认使用 `GENARRATIVE_SPACETIME_HEALTH_CHECK_TIMEOUT_SECONDS=2` 的短等待窗口,和业务 procedure 的 `GENARRATIVE_SPACETIME_PROCEDURE_TIMEOUT_SECONDS` 分开。`/readyz` 失败时 `details.spacetime.stage` 会标出当前卡住阶段:`pool_acquire`、`connect_build`、`connect_handshake`、`read_model_subscribe`、`procedure_result`、`reducer_result` 或 `read_cache`;`elapsedMs` / `timeoutMs` 用于确认是否命中健康检查窗口。业务请求日志也会写入 `operation_kind`、`operation_name`、`spacetime_stage` 和 `elapsed_ms`,后续 45 秒超时不再只靠 Nginx `request_time=45s` 推断。
|
||||
- `genarrative-api.service` 设置 `LimitNOFILE=65535`、`TasksMax=2048`;上线后用 `systemctl show genarrative-api.service -p LimitNOFILE -p TasksMax -p TimeoutStopUSec` 和 `cat /proc/$(pidof api-server)/limits` 核对。
|
||||
- Server provision 不再通过 Windows helper 下载,也不再通过 Linux build 节点中转 SpacetimeDB / otelcol 工具包;Linux build 节点只负责从内网 Git 源准备 provision 脚本和配置并上传给目标 agent。`Prepare Provision Tools` 在目标 dev / release agent 工作区内先检查 `/usr/local/bin/otelcol-contrib` 与 `${SPACETIME_ROOT}/bin/current`:SpacetimeDB 必须同时匹配运行版本 `2.7.0` 和 hotfix3 commit `d220349a...` 才能复用,裸 tag `a08663c7...` 即使版本号相同也必须拒绝;只有缺失或版本 / commit 不匹配时才使用 `PROVISION_DOWNLOADS_DIR` 里的本地包或从配置的下载源准备官方 `v2.7.0-hotfix3` 资产。`SPACETIME_EXPECTED_COMMIT` 与下载根必须成对调整,安装结果也执行同一 commit 门禁。otelcol-contrib 当前锁定 `0.151.0`;如果目标服务器下载需要代理,在 `PROVISION_DOWNLOAD_PROXY` 配置目标机可访问的 HTTP 代理。
|
||||
- Server provision 不再通过 Windows helper 下载,也不再通过 Linux build 节点中转 SpacetimeDB / otelcol 工具包;Linux build 节点只负责从内网 Git 源准备 provision 脚本和配置并上传给目标 agent。`Prepare Provision Tools` 在目标 dev / release agent 工作区内先检查 `/usr/local/bin/otelcol-contrib` 与 `${SPACETIME_ROOT}/bin/current`:SpacetimeDB 必须同时匹配运行版本 `2.8.3` 和 commit `8e410d28...` 才能复用;只有缺失或版本 / commit 不匹配时才使用 `PROVISION_DOWNLOADS_DIR` 里的本地包或从配置的下载源准备官方 `v2.8.3` 资产。`SPACETIME_EXPECTED_COMMIT` 与下载根必须成对调整,安装结果也执行同一 commit 门禁。otelcol-contrib 当前锁定 `0.151.0`;如果目标服务器下载需要代理,在 `PROVISION_DOWNLOAD_PROXY` 配置目标机可访问的 HTTP 代理。
|
||||
- 除 `Genarrative-Server-Provision` 外,`Genarrative-Stdb-Module-Build`、`Genarrative-Web-Build`、`Genarrative-Api-Build`、`Genarrative-*Deploy`、`Genarrative-Database-Import/Export`、`Genarrative-Full-Build-And-Deploy` 和 `Genarrative-Notify-Email` 的生产流水线现都以 Linux agent 为主,仍按各自 Jenkinsfile 的 checkout 口径执行。Server provision 不使用公网备用 Git 源,目标部署 agent 也不再需要访问源码 Git remote。
|
||||
- `otelcol-contrib.service` 作为可选系统服务加入 provision,默认监听 `127.0.0.1:4317/4318` 并使用 `deploy/otelcol/genarrative-debug.yaml`。api-server 是否发送 OTLP 仍由 `GENARRATIVE_OTEL_ENABLED` 控制,服务 unit 见 `deploy/systemd/otelcol-contrib.service`。该服务必须存在系统用户 / 组 `otelcol`,并且 `/etc/otelcol/genarrative-debug.yaml` 已安装到目标机;若看到 `status=217/USER` 或 `Failed to determine user credentials`,优先检查 `getent passwd otelcol`,再补齐 `/etc/otelcol` 配置目录并重启服务。
|
||||
- Nginx `/api/` 与 `/admin/api/` 通过 `genarrative_api` upstream 代理到 `127.0.0.1:8082`,upstream keepalive 为 64;通用 API 使用 `genarrative_api_rps`,后台 API 使用 `genarrative_admin_rps`。通用 `/api` location 保留 `client_max_body_size 64m` 作为编辑器图片、视频和文档请求的反代兜底,真实大小仍由路由与业务校验负责。若线上出现 `413 Request Entity Too Large` 且 access log 中 `request_time=0.000`、`upstream_status=-`,说明请求在 Nginx 层被拦截,先核对 release 模板与实际媒体大小。`limit_conn_status 429` 和 `limit_req_status 429` 必须在 HTTP 与 HTTPS server 中同时生效。
|
||||
|
||||
@@ -25,8 +25,8 @@ pipeline {
|
||||
string(name: 'PROVISION_DOWNLOADS_DIR', defaultValue: 'provision-tool-downloads', description: '目标服务器工作区内暂存 SpacetimeDB/otelcol 安装包的相对目录')
|
||||
string(name: 'PROVISION_TOOLS_DIR', defaultValue: 'provision-tools', description: '目标机工作区内由已下载安装包生成的工具包目录')
|
||||
string(name: 'PROVISION_DOWNLOAD_PROXY', defaultValue: '', description: '可选,目标服务器下载 SpacetimeDB 和 otelcol-contrib 时使用的代理地址,例如 http://127.0.0.1:7890;留空不设置代理')
|
||||
string(name: 'SPACETIME_DOWNLOAD_ROOT', defaultValue: 'https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.7.0-hotfix3', description: '目标服务器使用的 SpacetimeDB Linux release tarball 根地址;默认固定到项目锁定版本的官方 hotfix 资产标签')
|
||||
string(name: 'SPACETIME_EXPECTED_COMMIT', defaultValue: 'd220349adb7af7eefa810eb08a185609356b83f6', description: 'SpacetimeDB CLI 预期构建 commit;用于拒绝同版本号但缺少 hotfix 的旧二进制')
|
||||
string(name: 'SPACETIME_DOWNLOAD_ROOT', defaultValue: 'https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.8.3', description: '目标服务器使用的 SpacetimeDB Linux release tarball 根地址;默认固定到项目锁定版本的官方资产标签')
|
||||
string(name: 'SPACETIME_EXPECTED_COMMIT', defaultValue: '8e410d2842147bd8e5a32a9589cc00c19f7478e2', description: 'SpacetimeDB CLI 预期构建 commit;用于拒绝同版本号但 commit 不匹配的旧二进制')
|
||||
string(name: 'SPACETIME_TARGET_HOST', defaultValue: 'x86_64-unknown-linux-gnu', description: 'SpacetimeDB 预编译包 host triple,development/release Linux amd64 使用默认值')
|
||||
string(name: 'SPACETIME_ROOT', defaultValue: '/stdb', description: 'SpacetimeDB root-dir')
|
||||
string(name: 'RELEASE_ROOT', defaultValue: '/opt/genarrative/releases', description: 'release 根目录')
|
||||
@@ -213,8 +213,8 @@ BASH
|
||||
OTELCOL_VERSION="${OTELCOL_VERSION:-0.151.0}" \
|
||||
PREPARE_OTELCOL="${ENABLE_OTELCOL:-true}" \
|
||||
PROVISION_DOWNLOAD_PROXY="${PROVISION_DOWNLOAD_PROXY:-}" \
|
||||
SPACETIME_DOWNLOAD_ROOT="${SPACETIME_DOWNLOAD_ROOT:-https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.7.0-hotfix3}" \
|
||||
SPACETIME_EXPECTED_COMMIT="${SPACETIME_EXPECTED_COMMIT:-d220349adb7af7eefa810eb08a185609356b83f6}" \
|
||||
SPACETIME_DOWNLOAD_ROOT="${SPACETIME_DOWNLOAD_ROOT:-https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.8.3}" \
|
||||
SPACETIME_EXPECTED_COMMIT="${SPACETIME_EXPECTED_COMMIT:-8e410d2842147bd8e5a32a9589cc00c19f7478e2}" \
|
||||
SPACETIME_TARGET_HOST="${SPACETIME_TARGET_HOST:-x86_64-unknown-linux-gnu}" \
|
||||
SPACETIME_ROOT="${SPACETIME_ROOT:-/stdb}" \
|
||||
scripts/prepare-server-provision-tools.sh
|
||||
|
||||
@@ -20,7 +20,7 @@ const repoRoot = path.resolve(
|
||||
'..',
|
||||
);
|
||||
const database = 'admin-account-smoke';
|
||||
const expectedSpacetimeVersion = '2.7.0';
|
||||
const expectedSpacetimeVersion = '2.8.3';
|
||||
const commandTimeoutMs = 5 * 60 * 1000;
|
||||
|
||||
function assert(condition, message) {
|
||||
@@ -144,6 +144,10 @@ async function stopStandalone(child) {
|
||||
if (child.exitCode !== null) {
|
||||
return;
|
||||
}
|
||||
if (process.platform === 'win32') {
|
||||
await stopWindowsProcessTree(child);
|
||||
return;
|
||||
}
|
||||
child.kill('SIGTERM');
|
||||
const exited = await Promise.race([
|
||||
once(child, 'exit').then(() => true),
|
||||
@@ -155,6 +159,37 @@ async function stopStandalone(child) {
|
||||
}
|
||||
}
|
||||
|
||||
async function stopWindowsProcessTree(child) {
|
||||
if (typeof child.pid === 'number') {
|
||||
await runTaskKill(child.pid);
|
||||
}
|
||||
const exited = await Promise.race([
|
||||
once(child, 'exit').then(() => true),
|
||||
delay(5_000).then(() => false),
|
||||
]);
|
||||
if (!exited && child.exitCode === null) {
|
||||
child.kill('SIGKILL');
|
||||
await once(child, 'exit');
|
||||
}
|
||||
}
|
||||
|
||||
function runTaskKill(pid) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const taskKill = spawn('taskkill', ['/PID', String(pid), '/T', '/F'], {
|
||||
stdio: 'ignore',
|
||||
shell: false,
|
||||
});
|
||||
taskKill.once('error', reject);
|
||||
taskKill.once('exit', (code, signal) => {
|
||||
if (code === 0 || code === 128 || code === 1) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
reject(new Error(`taskkill exited with ${signal ?? code}`));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function callProcedure(serverUrl, token, procedureName, input) {
|
||||
const response = await fetch(
|
||||
`${serverUrl}/v1/database/${database}/call/${procedureName}`,
|
||||
|
||||
@@ -899,6 +899,46 @@ const checks = [
|
||||
reason:
|
||||
'Server-Provision Job 必须允许 dev/release 为 files-history 选择各自的 baseline state 目录。',
|
||||
},
|
||||
{
|
||||
file: 'jenkins/Jenkinsfile.production-server-provision',
|
||||
includes:
|
||||
"string(name: 'SPACETIME_DOWNLOAD_ROOT', defaultValue: 'https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.8.3'",
|
||||
reason:
|
||||
'Server-Provision Job 的 SpacetimeDB 下载根必须与 workspace 锁定的 2.8.3 版本一致。',
|
||||
},
|
||||
{
|
||||
file: 'jenkins/Jenkinsfile.production-server-provision',
|
||||
includes:
|
||||
"string(name: 'SPACETIME_EXPECTED_COMMIT', defaultValue: '8e410d2842147bd8e5a32a9589cc00c19f7478e2'",
|
||||
reason:
|
||||
'Server-Provision Job 必须锁定 SpacetimeDB 2.8.3 的 CLI commit,拒绝同版本号但构建来源不一致的二进制。',
|
||||
},
|
||||
{
|
||||
file: 'jenkins/Jenkinsfile.production-server-provision',
|
||||
includes:
|
||||
'SPACETIME_DOWNLOAD_ROOT="${SPACETIME_DOWNLOAD_ROOT:-https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.8.3}"',
|
||||
reason:
|
||||
'Server-Provision 执行阶段的 SpacetimeDB 下载根默认值必须与 Job 参数默认值一致。',
|
||||
},
|
||||
{
|
||||
file: 'jenkins/Jenkinsfile.production-server-provision',
|
||||
includes:
|
||||
'SPACETIME_EXPECTED_COMMIT="${SPACETIME_EXPECTED_COMMIT:-8e410d2842147bd8e5a32a9589cc00c19f7478e2}"',
|
||||
reason:
|
||||
'Server-Provision 执行阶段的 SpacetimeDB commit 默认值必须与 Job 参数默认值一致。',
|
||||
},
|
||||
{
|
||||
file: 'jenkins/Jenkinsfile.production-server-provision',
|
||||
excludes: 'v2.7.0-hotfix3',
|
||||
reason:
|
||||
'Server-Provision 不得保留已退役的 SpacetimeDB 2.7.0 hotfix 资产标签。',
|
||||
},
|
||||
{
|
||||
file: 'jenkins/Jenkinsfile.production-server-provision',
|
||||
excludes: 'd220349adb7af7eefa810eb08a185609356b83f6',
|
||||
reason:
|
||||
'Server-Provision 不得保留 SpacetimeDB 2.7.0 的旧 CLI commit 门禁。',
|
||||
},
|
||||
{
|
||||
file: 'jenkins/Jenkinsfile.production-server-provision',
|
||||
excludes:
|
||||
|
||||
@@ -39,13 +39,13 @@ cat >"${SPACETIME_ROOT_DIR}/bin/current/spacetimedb-cli" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
cat <<'VERSION'
|
||||
spacetime Path: /tmp/spacetimedb-cli
|
||||
Commit: d220349adb7af7eefa810eb08a185609356b83f6
|
||||
spacetimedb tool version 2.7.0; spacetimedb-lib version 2.7.0;
|
||||
Commit: 8e410d2842147bd8e5a32a9589cc00c19f7478e2
|
||||
spacetimedb tool version 2.8.3; spacetimedb-lib version 2.8.3;
|
||||
VERSION
|
||||
EOF
|
||||
cat >"${SPACETIME_ROOT_DIR}/bin/current/spacetimedb-standalone" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
echo "spacetimedb-standalone 2.7.0"
|
||||
echo "spacetimedb-standalone 2.8.3"
|
||||
EOF
|
||||
chmod +x \
|
||||
"${SPACETIME_ROOT_DIR}/bin/current/spacetimedb-cli" \
|
||||
@@ -94,13 +94,13 @@ cat >"${BARE_TAG_ROOT_DIR}/bin/current/spacetimedb-cli" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
cat <<'VERSION'
|
||||
spacetime Path: /tmp/spacetimedb-cli
|
||||
Commit: a08663c7b94688a2542577532d472f751e641f5b
|
||||
spacetimedb tool version 2.7.0; spacetimedb-lib version 2.7.0;
|
||||
Commit: 0000000000000000000000000000000000000000
|
||||
spacetimedb tool version 2.8.3; spacetimedb-lib version 2.8.3;
|
||||
VERSION
|
||||
EOF
|
||||
cat >"${BARE_TAG_ROOT_DIR}/bin/current/spacetimedb-standalone" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
echo "spacetimedb-standalone 2.7.0"
|
||||
echo "spacetimedb-standalone 2.8.3"
|
||||
EOF
|
||||
chmod +x \
|
||||
"${BARE_TAG_ROOT_DIR}/bin/current/spacetimedb-cli" \
|
||||
@@ -119,14 +119,14 @@ if (
|
||||
"${REPO_ROOT}/scripts/prepare-server-provision-tools.sh" \
|
||||
>"${BARE_TAG_LOG}" 2>&1
|
||||
); then
|
||||
echo "[check-server-provision-tools] 裸 v2.7.0 tag 不应通过 hotfix3 复用门禁。" >&2
|
||||
echo "[check-server-provision-tools] commit 不匹配的 v2.8.3 不应通过复用门禁。" >&2
|
||||
cat "${BARE_TAG_LOG}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
grep -q "SpacetimeDB commit 不匹配" "${BARE_TAG_LOG}"
|
||||
if grep -q "复用目标机已有 SpacetimeDB 安装" "${BARE_TAG_LOG}"; then
|
||||
echo "[check-server-provision-tools] 裸 v2.7.0 tag 被错误复用。" >&2
|
||||
echo "[check-server-provision-tools] commit 不匹配的 v2.8.3 被错误复用。" >&2
|
||||
cat "${BARE_TAG_LOG}" >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -157,7 +157,7 @@ if (
|
||||
"${REPO_ROOT}/scripts/prepare-server-provision-tools.sh" \
|
||||
>"${BARE_ARCHIVE_LOG}" 2>&1
|
||||
); then
|
||||
echo "[check-server-provision-tools] 裸 v2.7.0 archive 不应通过 hotfix3 安装结果门禁。" >&2
|
||||
echo "[check-server-provision-tools] commit 不匹配的 v2.8.3 archive 不应通过安装结果门禁。" >&2
|
||||
cat "${BARE_ARCHIVE_LOG}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -759,7 +759,7 @@ function composeEnv() {
|
||||
}
|
||||
|
||||
function localSpacetimeImageName() {
|
||||
return `${projectName}-spacetimedb:2.7.0`;
|
||||
return `${projectName}-spacetimedb:2.8.3`;
|
||||
}
|
||||
|
||||
function spacetimeServerUrl(state) {
|
||||
|
||||
+4
-4
@@ -614,8 +614,8 @@ function parseSpacetimeToolCommit(output) {
|
||||
}
|
||||
|
||||
function expectedSpacetimeToolCommit(workspaceVersion) {
|
||||
if (workspaceVersion === '2.7.0') {
|
||||
return 'd220349adb7af7eefa810eb08a185609356b83f6';
|
||||
if (workspaceVersion === '2.8.3') {
|
||||
return '8e410d2842147bd8e5a32a9589cc00c19f7478e2';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
@@ -623,7 +623,7 @@ function expectedSpacetimeToolCommit(workspaceVersion) {
|
||||
function buildSpacetimeUpgradeInstruction(workspaceVersion) {
|
||||
const expectedCommit = expectedSpacetimeToolCommit(workspaceVersion);
|
||||
if (expectedCommit) {
|
||||
return `请安装官方 v${workspaceVersion}-hotfix3 发行包并确认 spacetime --version 的 Commit 为 ${expectedCommit},然后重新运行本命令。`;
|
||||
return `请安装官方 v${workspaceVersion} 发行包并确认 spacetime --version 的 Commit 为 ${expectedCommit},然后重新运行本命令。`;
|
||||
}
|
||||
return `请先直接升级并切换到锁定版本: spacetime version install ${workspaceVersion} && spacetime version use ${workspaceVersion},然后重新运行本命令。`;
|
||||
}
|
||||
@@ -667,7 +667,7 @@ function assertSpacetimeToolVersionMatchesWorkspace({
|
||||
throw new Error(
|
||||
[
|
||||
`本机 spacetime CLI/standalone 虽报告 ${toolVersion},但构建 commit ${toolCommit || 'unknown'} 不是项目锁定的 ${expectedCommit}。`,
|
||||
'同版本号的裸 tag 缺少后续 hotfix,不能用于本地 SpacetimeDB。',
|
||||
'同版本号但 commit 不匹配的构建存在发布资产差异风险,不能用于本地 SpacetimeDB。',
|
||||
buildSpacetimeUpgradeInstruction(workspaceVersion),
|
||||
].join(''),
|
||||
);
|
||||
|
||||
+17
-17
@@ -773,7 +773,7 @@ describe('dev scheduler spacetime reuse guard', () => {
|
||||
writeFileSync(join(tempDir, 'spacetime.pid'), `${process.pid}\n`, 'utf8');
|
||||
writeFileSync(
|
||||
join(tempDir, 'dev-spacetime-tool-version'),
|
||||
`${workspaceSpacetimeVersionForTest()}\nd220349adb7af7eefa810eb08a185609356b83f6\n`,
|
||||
`${workspaceSpacetimeVersionForTest()}\n8e410d2842147bd8e5a32a9589cc00c19f7478e2\n`,
|
||||
'utf8',
|
||||
);
|
||||
globalThis.fetch = vi.fn(async () => ({
|
||||
@@ -802,7 +802,7 @@ describe('dev scheduler spacetime reuse guard', () => {
|
||||
writeFileSync(join(tempDir, 'spacetime.pid'), `${process.pid}\n`, 'utf8');
|
||||
writeFileSync(
|
||||
join(tempDir, 'dev-spacetime-tool-version'),
|
||||
`${workspaceSpacetimeVersionForTest()}\nd220349adb7af7eefa810eb08a185609356b83f6\n`,
|
||||
`${workspaceSpacetimeVersionForTest()}\n8e410d2842147bd8e5a32a9589cc00c19f7478e2\n`,
|
||||
'utf8',
|
||||
);
|
||||
globalThis.fetch = vi.fn(async () => ({
|
||||
@@ -915,30 +915,30 @@ describe('dev scheduler spacetime refresh', () => {
|
||||
test('解析 spacetime --version 输出里的 tool version', () => {
|
||||
const output = `
|
||||
A new version of SpacetimeDB is available: v2.6.1 (current: v2.5.0)
|
||||
Commit: d220349adb7af7eefa810eb08a185609356b83f6
|
||||
spacetimedb tool version 2.7.0; spacetimedb-lib version 2.7.0;
|
||||
Commit: 8e410d2842147bd8e5a32a9589cc00c19f7478e2
|
||||
spacetimedb tool version 2.8.3; spacetimedb-lib version 2.8.3;
|
||||
`;
|
||||
|
||||
expect(parseSpacetimeToolVersion(output)).toBe('2.7.0');
|
||||
expect(parseSpacetimeToolVersion(output)).toBe('2.8.3');
|
||||
expect(parseSpacetimeToolCommit(output)).toBe(
|
||||
'd220349adb7af7eefa810eb08a185609356b83f6',
|
||||
'8e410d2842147bd8e5a32a9589cc00c19f7478e2',
|
||||
);
|
||||
});
|
||||
|
||||
test('同为 2.7.0 时拒绝裸 tag 并接受 hotfix3 commit', () => {
|
||||
test('同为 2.8.3 时拒绝 commit 不匹配并接受锁定 commit', () => {
|
||||
expect(() =>
|
||||
assertSpacetimeToolVersionMatchesWorkspace({
|
||||
toolVersion: '2.7.0',
|
||||
toolCommit: 'a08663c7b94688a2542577532d472f751e641f5b',
|
||||
workspaceVersion: '2.7.0',
|
||||
toolVersion: '2.8.3',
|
||||
toolCommit: '0000000000000000000000000000000000000000',
|
||||
workspaceVersion: '2.8.3',
|
||||
}),
|
||||
).toThrow('裸 tag');
|
||||
).toThrow('构建 commit');
|
||||
|
||||
expect(() =>
|
||||
assertSpacetimeToolVersionMatchesWorkspace({
|
||||
toolVersion: '2.7.0',
|
||||
toolCommit: 'd220349adb7af7eefa810eb08a185609356b83f6',
|
||||
workspaceVersion: '2.7.0',
|
||||
toolVersion: '2.8.3',
|
||||
toolCommit: '8e410d2842147bd8e5a32a9589cc00c19f7478e2',
|
||||
workspaceVersion: '2.8.3',
|
||||
}),
|
||||
).not.toThrow();
|
||||
});
|
||||
@@ -974,14 +974,14 @@ spacetimedb tool version 2.7.0; spacetimedb-lib version 2.7.0;
|
||||
}
|
||||
});
|
||||
|
||||
test('复用本地 SpacetimeDB standalone 时拒绝同版本裸 tag 记录', () => {
|
||||
test('复用本地 SpacetimeDB standalone 时拒绝同版本但 commit 不匹配的记录', () => {
|
||||
const tempDir = mkdtempSync(
|
||||
join(tmpdir(), 'genarrative-spacetime-commit-'),
|
||||
);
|
||||
try {
|
||||
writeFileSync(
|
||||
join(tempDir, 'dev-spacetime-tool-version'),
|
||||
'2.7.0\na08663c7b94688a2542577532d472f751e641f5b\n',
|
||||
'2.8.3\n0000000000000000000000000000000000000000\n',
|
||||
'utf8',
|
||||
);
|
||||
|
||||
@@ -990,7 +990,7 @@ spacetimedb tool version 2.7.0; spacetimedb-lib version 2.7.0;
|
||||
dataDir: tempDir,
|
||||
serverUrl: 'http://127.0.0.1:3101',
|
||||
}),
|
||||
).toThrow('裸 tag');
|
||||
).toThrow('构建 commit');
|
||||
} finally {
|
||||
rmSync(tempDir, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ OTELCOL_DOWNLOAD_ROOT="${OTELCOL_DOWNLOAD_ROOT:-https://github.com/open-telemetr
|
||||
OTELCOL_ARCHIVE_PATH="${OTELCOL_ARCHIVE_PATH:-}"
|
||||
OTELCOL_TARGET_BIN="${OTELCOL_TARGET_BIN:-/usr/local/bin/otelcol-contrib}"
|
||||
SPACETIME_INSTALLER_URL="${SPACETIME_INSTALLER_URL:-https://install.spacetimedb.com}"
|
||||
SPACETIME_DOWNLOAD_ROOT="${SPACETIME_DOWNLOAD_ROOT:-https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.7.0-hotfix3}"
|
||||
SPACETIME_DOWNLOAD_ROOT="${SPACETIME_DOWNLOAD_ROOT:-https://github.com/clockworklabs/SpacetimeDB/releases/download/v2.8.3}"
|
||||
SPACETIME_TARGET_HOST="${SPACETIME_TARGET_HOST:-x86_64-unknown-linux-gnu}"
|
||||
SPACETIME_ROOT="${SPACETIME_ROOT:-/stdb}"
|
||||
SPACETIME_EXPECTED_VERSION="${SPACETIME_EXPECTED_VERSION:-}"
|
||||
SPACETIME_EXPECTED_COMMIT="${SPACETIME_EXPECTED_COMMIT:-d220349adb7af7eefa810eb08a185609356b83f6}"
|
||||
SPACETIME_EXPECTED_COMMIT="${SPACETIME_EXPECTED_COMMIT:-8e410d2842147bd8e5a32a9589cc00c19f7478e2}"
|
||||
SPACETIME_ARCHIVE_PATH="${SPACETIME_ARCHIVE_PATH:-}"
|
||||
SPACETIME_INSTALLER_PATH="${SPACETIME_INSTALLER_PATH:-}"
|
||||
SPACETIME_UPDATE_INSTALLER_PATH="${SPACETIME_UPDATE_INSTALLER_PATH:-}"
|
||||
|
||||
@@ -16,8 +16,8 @@ const repoRoot = path.resolve(
|
||||
'..',
|
||||
);
|
||||
const database = 'editor-idempotency-smoke';
|
||||
const expectedSpacetimeVersion = '2.7.0';
|
||||
const expectedSpacetimeCommit = 'd220349adb7af7eefa810eb08a185609356b83f6';
|
||||
const expectedSpacetimeVersion = '2.8.3';
|
||||
const expectedSpacetimeCommit = '8e410d2842147bd8e5a32a9589cc00c19f7478e2';
|
||||
const commandTimeoutMs = 5 * 60 * 1000;
|
||||
|
||||
function assert(condition, message) {
|
||||
@@ -228,6 +228,10 @@ export async function stopStandalone(child) {
|
||||
if (child.exitCode !== null) {
|
||||
return;
|
||||
}
|
||||
if (process.platform === 'win32') {
|
||||
await stopWindowsProcessTree(child);
|
||||
return;
|
||||
}
|
||||
child.kill('SIGTERM');
|
||||
const exited = await Promise.race([
|
||||
once(child, 'exit').then(() => true),
|
||||
@@ -239,6 +243,37 @@ export async function stopStandalone(child) {
|
||||
}
|
||||
}
|
||||
|
||||
async function stopWindowsProcessTree(child) {
|
||||
if (typeof child.pid === 'number') {
|
||||
await runTaskKill(child.pid);
|
||||
}
|
||||
const exited = await Promise.race([
|
||||
once(child, 'exit').then(() => true),
|
||||
delay(5_000).then(() => false),
|
||||
]);
|
||||
if (!exited && child.exitCode === null) {
|
||||
child.kill('SIGKILL');
|
||||
await once(child, 'exit');
|
||||
}
|
||||
}
|
||||
|
||||
function runTaskKill(pid) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const taskKill = spawn('taskkill', ['/PID', String(pid), '/T', '/F'], {
|
||||
stdio: 'ignore',
|
||||
shell: false,
|
||||
});
|
||||
taskKill.once('error', reject);
|
||||
taskKill.once('exit', (code, signal) => {
|
||||
if (code === 0 || code === 128 || code === 1) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
reject(new Error(`taskkill exited with ${signal ?? code}`));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function cliPrefix(configPath) {
|
||||
return ['--config-path', configPath];
|
||||
}
|
||||
|
||||
Generated
+77
-316
File diff suppressed because it is too large
Load Diff
@@ -123,9 +123,9 @@ sha1 = "0.10"
|
||||
sha2 = "0.10"
|
||||
socket2 = "0.6"
|
||||
symphonia = { version = "0.5", default-features = false, features = ["mp3"] }
|
||||
spacetimedb = "=2.7.0"
|
||||
spacetimedb-sdk = "=2.7.0"
|
||||
spacetimedb-lib = { version = "=2.7.0", default-features = false }
|
||||
spacetimedb = "=2.8.3"
|
||||
spacetimedb-sdk = "=2.8.3"
|
||||
spacetimedb-lib = { version = "=2.8.3", default-features = false }
|
||||
time = "0.3"
|
||||
tokio = "1"
|
||||
tokio-stream = "0.1"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 2.7.0 (commit d220349adb7af7eefa810eb08a185609356b83f6).
|
||||
// This was generated using spacetimedb cli version 2.8.3 (commit 8e410d2842147bd8e5a32a9589cc00c19f7478e2).
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
+8
-8
@@ -34,10 +34,10 @@ pub trait acknowledge_external_generation_job_summaries_and_return {
|
||||
input: ExternalGenerationJobAcknowledgeInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobSummaryProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobSummaryProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -47,10 +47,10 @@ impl acknowledge_external_generation_job_summaries_and_return for super::RemoteP
|
||||
input: ExternalGenerationJobAcknowledgeInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobSummaryProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobSummaryProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, ExternalGenerationJobSummaryProcedureResult>(
|
||||
|
||||
+8
-8
@@ -34,10 +34,10 @@ pub trait acknowledge_external_generation_jobs_and_return {
|
||||
input: ExternalGenerationJobAcknowledgeInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -47,10 +47,10 @@ impl acknowledge_external_generation_jobs_and_return for super::RemoteProcedures
|
||||
input: ExternalGenerationJobAcknowledgeInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
&super::ProcedureEventContext,
|
||||
Result<ExternalGenerationJobProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, ExternalGenerationJobProcedureResult>(
|
||||
|
||||
+8
-8
@@ -31,10 +31,10 @@ pub trait activate_editor_canvas_layout_and_return {
|
||||
input: EditorCanvasLayoutMigrationInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<EditorCanvasLayoutMigrationProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
&super::ProcedureEventContext,
|
||||
Result<EditorCanvasLayoutMigrationProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ impl activate_editor_canvas_layout_and_return for super::RemoteProcedures {
|
||||
input: EditorCanvasLayoutMigrationInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<EditorCanvasLayoutMigrationProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
&super::ProcedureEventContext,
|
||||
Result<EditorCanvasLayoutMigrationProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, EditorCanvasLayoutMigrationProcedureResult>(
|
||||
|
||||
+8
-8
@@ -31,10 +31,10 @@ pub trait admin_disable_profile_redeem_code {
|
||||
input: RuntimeProfileRedeemCodeAdminDisableInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileRedeemCodeAdminProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileRedeemCodeAdminProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ impl admin_disable_profile_redeem_code for super::RemoteProcedures {
|
||||
input: RuntimeProfileRedeemCodeAdminDisableInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileRedeemCodeAdminProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileRedeemCodeAdminProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, RuntimeProfileRedeemCodeAdminProcedureResult>(
|
||||
|
||||
+8
-8
@@ -31,10 +31,10 @@ pub trait admin_disable_profile_task_config {
|
||||
input: RuntimeProfileTaskConfigAdminDisableInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileTaskConfigAdminProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileTaskConfigAdminProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ impl admin_disable_profile_task_config for super::RemoteProcedures {
|
||||
input: RuntimeProfileTaskConfigAdminDisableInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileTaskConfigAdminProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileTaskConfigAdminProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, RuntimeProfileTaskConfigAdminProcedureResult>(
|
||||
|
||||
+8
-8
@@ -31,10 +31,10 @@ pub trait admin_get_profile_wallet_and_return {
|
||||
input: RuntimeProfileAdminWalletGetInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileAdminWalletProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileAdminWalletProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ impl admin_get_profile_wallet_and_return for super::RemoteProcedures {
|
||||
input: RuntimeProfileAdminWalletGetInput,
|
||||
|
||||
__callback: impl FnOnce(
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileAdminWalletProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
&super::ProcedureEventContext,
|
||||
Result<RuntimeProfileAdminWalletProcedureResult, __sdk::InternalError>,
|
||||
) + Send
|
||||
+ 'static,
|
||||
) {
|
||||
self.imp
|
||||
.invoke_procedure_with_callback::<_, RuntimeProfileAdminWalletProcedureResult>(
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user