Skip to content

fix(ci): 修复 ootb workflow 连续失败——check-catalog ESM 语法、db-server 入口路径、缺失 configs#10

Closed
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/bc-029856f7-442c-4055-bd6b-898f907b0a46-2699
Closed

fix(ci): 修复 ootb workflow 连续失败——check-catalog ESM 语法、db-server 入口路径、缺失 configs#10
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/bc-029856f7-442c-4055-bd6b-898f907b0a46-2699

Conversation

@cursor

@cursor cursor Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

背景

本次 automation 由 main 分支 push(feat(tps): v2 migration,commit 8d11fa9)触发的 ootb workflow 失败事件唤起。审查最近多次 ootb workflow 运行日志(gh run view --log-failed),发现从 2/6 项检查通过、4 项失败,根因均可在仓库现有代码/配置中定位,与 AGENTS.md 记录的已知 gotcha 一致。

根因与修复

  1. tools/check-catalog.js 用 ESM import 语法,仓库为 CJS — 根 package.json 未声明 "type": "module",CI 固定 Node 22.5.x 上直接 SyntaxError: Cannot use import statement outside a module。改回和其余 tools/*.js 一致的 require() 写法。
  2. db-server 入口路径写错tools/check-ootb.jstools/sim-new-user.jstools/test-db-api.jsspawn 了不存在的 db-server/index.js;真正的构建产物是 db-server/dist/index.js(见 db-server/package.jsonmain)。旧路径导致 spawn 静默失败,db-server 不可达sim-new-user 超时。三处均已改为 db-server/dist/index.js
  3. configs-default/db_config.jsonmodulesDir: "../modules" — 该值相对 PROJECT_ROOT(=SFMC_ROOT) 解析,会跳出仓库根目录导致模块 API 返回空 catalog;改为 "modules"tools/test-db-api.js 里内联的同名配置也同步修正。
  4. CI 里 configs/ 从未被填充configs/.gitignore,CI checkout 后为空,导致 check-ootb 第一项「必备仓库文件齐全」缺失 configs/db_config.json 等三个文件。在 Build all workspaces 之后新增一步,从 configs-default/ 拷贝缺失的 json 文件。
  5. .gitignore 补充 qq-bridge/dist/sfmc/dist/ — 这两个 workspace 的构建产物之前未被忽略。

验证

本地执行:

npm install --no-audit --no-fund
npm run build --workspaces --if-present
SFMC_ROOT=$PWD node tools/check-ootb.js

修复前: [ootb] 通过 2 / 失败 4(必备仓库文件齐全 / check-catalog / db-server 启动 / sim-new-user 全部失败)。
修复后: [ootb] 通过 6 / 失败 0

未改动任何既有正确功能逻辑,仅修正 CI/工具脚本中的路径与语法错误。

备注

仓库里已有若干个近期由同一 automation 针对相同根因开出的草稿 PR(#5#6#7#8#9),说明该 CI 失败在 main 上尚未被合并修复,每次新 push 都会重新触发失败。建议合并其中一个后关闭其余重复 PR。

Open in Web View Automation 

…失 configs

- tools/check-catalog.js: 改回 CommonJS require(仓库根 package.json 未
  声明 type:module,ESM import 语法在固定 Node 22.5.x 的 CI 上直接抛
  SyntaxError)
- tools/check-ootb.js、tools/sim-new-user.js、tools/test-db-api.js:
  spawn 的 db-server 入口从不存在的 db-server/index.js 改为构建产物
  db-server/dist/index.js(导致 db-server 不可达 / sim-new-user 超时)
- configs-default/db_config.json: modulesDir 从 "../modules"(相对
  PROJECT_ROOT 解析到仓库外)改为 "modules"
- .github/workflows/ootb.yml: build 之后新增 Seed configs/ 步骤,从
  configs-default/ 拷贝缺失的 json(configs/ 被 gitignore,CI checkout
  后为空)
- .gitignore: 补充 qq-bridge/dist/、sfmc/dist/(build 产物,此前未忽略)

本地验证: npm install && npm run build --workspaces --if-present 后
node tools/check-ootb.js 从 2 PASS / 4 FAIL 变为 6 PASS / 0 FAIL。

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
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