Skip to content

fix(ci): fix ootb workflow failures (check-catalog ESM crash, wrong db-server entry path, missing configs)#9

Closed
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/bc-2df0d3b6-c9bf-4c95-92d8-2eb923bf236e-cc85
Closed

fix(ci): fix ootb workflow failures (check-catalog ESM crash, wrong db-server entry path, missing configs)#9
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/bc-2df0d3b6-c9bf-4c95-92d8-2eb923bf236e-cc85

Conversation

@cursor

@cursor cursor Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

触发原因

ootb workflow 在最近多次 push(包括触发本次自动化的 commit 38fbf9e)上持续失败。定位到 4 个独立的真实 bug,均已修复并本地复现验证(node tools/check-ootb.js 现在 6/6 全部通过)。

根因与修复

  1. tools/check-catalog.js 用 ESM import 语法,但以纯 .js + require() 环境执行 — CI 用的 Node 22.5 没有默认开启「无 package.json type 时自动探测 ESM 语法」(该特性是 Node 22.7+ 才默认开启),所以每次都在 check-ootb.js 里以 SyntaxError: Cannot use import statement outside a module 崩溃。已改为和其他 tools/*.js 脚本一致的 CommonJS require/__dirname 写法。

  2. check-ootb.js / sim-new-user.js / test-db-api.js 都 spawn 了不存在的 db-server/index.js — 真实入口是构建产物 db-server/dist/index.js(AGENTS.md 中已经记录过这个 gotcha,但只在 sim-new-user.js 里提到,check-ootb.js 自身也有同样的 bug)。这导致 db-server 启动 + 模块接口sim-new-user 全流程通过 两项检查每次必挂(db-server 不可达 / timeout)。三处均已改为指向 db-server/dist/index.js

  3. configs-default/db_config.json 默认 modulesDir: "../modules"db-server/src/env.ts 是相对 PROJECT_ROOT(即仓库根目录本身)来 resolve 这个路径的,"../modules" 会解析到仓库外面一层,找不到 catalog.json。已改为 "modules"tools/test-db-api.js 里手写的同款配置也一并修正。

  4. configs/.gitignore 忽略,CI 从没有把 configs-default/ 的默认值复制进去 — 导致 check-ootb.js 里「必备仓库文件齐全」检查因为缺少 configs/db_config.jsonbds_updater.jsonqq_config.json 而必然失败。在 .github/workflows/ootb.yml 里加了一步,在 build 之后、跑 check-ootb 之前,把 configs-default/*.json 复制进 configs/(仅在目标文件不存在时才复制,不覆盖)。

附带修了一个小的一致性问题:.gitignore 里其他 workspace 的 dist/ 都有单独条目,但漏了 qq-bridge/dist/sfmc/dist/,补上避免以后本地构建产物被误加入暂存区。

验证

本地按 CI 同样的步骤跑了一遍:npm installnpm run build --workspaces --if-present → 复制 configs-default/*.jsonconfigs/node tools/check-ootb.js,结果 6 / 6 全部 PASS(此前是 3/6,未修复时甚至有 SyntaxError 崩溃)。另外单独启动 db-server 后跑了 node tools/smoke-modules.js,全部通过。

改动文件

  • tools/check-catalog.js — ESM → CommonJS
  • tools/check-ootb.js, tools/sim-new-user.js, tools/test-db-api.js — db-server 入口路径修正
  • configs-default/db_config.jsonmodulesDir 默认值修正
  • .github/workflows/ootb.yml — 新增 seed configs 步骤
  • .gitignore — 补充 qq-bridge/dist/sfmc/dist/
Open in Web View Automation 

cursoragent and others added 5 commits July 21, 2026 17:17
Node 22.5 (used by ootb.yml CI) does not auto-detect ESM syntax in
plain .js files without "type": "module" — this made check-ootb.js
crash with 'Cannot use import statement outside a module' every run.
Convert to require()/__dirname to match the CommonJS convention used
by every other tools/*.js script.

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
…b-server/index.js

check-ootb.js, sim-new-user.js and test-db-api.js all spawned a
non-existent db-server/index.js (the real built entry is
db-server/dist/index.js). This made the 'db-server 启动 + 模块接口' and
'sim-new-user 全流程通过' checks fail every CI run with 'db-server 不可达'
/ timeout.

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
configs-default/db_config.json shipped modulesDir: "../modules", which
db-server/src/env.ts resolves relative to PROJECT_ROOT (the repo root
itself) — landing one directory *above* the repo, outside it, where no
catalog.json exists. Use "modules" so it resolves to <root>/modules.

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
configs/ is gitignored, so a fresh CI checkout never had
configs/db_config.json, bds_updater.json, qq_config.json — failing the
'必备仓库文件齐全' check every run. Copy the defaults in before running
check-ootb, mirroring the documented local setup steps.

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
Every other workspace's dist/ is gitignored; these two were missing,
so a local
> @sfmc/sdk@0.1.0 build
> node build.mjs

[sdk] emitting .d.ts via tsc...
@sfmc/sdk build done: 13 subpaths

> db-server@1.0.0 build
> tsc -p tsconfig.json

> qq-bridge@1.0.0 build
> tsc -p tsconfig.json

> bds-tools@1.1.0 build
> tsc -p tsconfig.json

> sfmc-cil@0.1.0 build
> tsc -p tsconfig.json

> @sfmc/remote-controller@0.1.0 build
> tsc -p tsconfig.json leaves them as untracked/
stageable artifacts.

Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
@Tanya7z

Tanya7z commented Jul 22, 2026

Copy link
Copy Markdown
Member

Superseded by #12.

@Tanya7z Tanya7z closed this Jul 22, 2026
@Tanya7z
Tanya7z deleted the cursor/bc-2df0d3b6-c9bf-4c95-92d8-2eb923bf236e-cc85 branch July 22, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants