fix(ci): 修复 ootb 工作流长期失败的四处根因#6
Draft
cursor[bot] wants to merge 4 commits into
Draft
Conversation
configs/ 被 gitignore,CI 里从未存在,导致 check-ootb.js 第一项 "必备仓库文件齐全" 恒定失败(缺 db_config.json / bds_updater.json / qq_config.json)。新增一步从 configs-default/ 复制默认配置进 configs/,与 AGENTS.md 中记录的本地开发环境搭建方式保持一致。 Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
根目录 package.json 未声明 "type": "module",check-catalog.js 却用了 import 语法,node 按 CJS 解析时报 "Cannot use import statement outside a module"。改为与 tools/ 目录下其它脚本一致的 require() 写法。 顺带修正 package.json#scripts.check-catalog 中的绝对路径笔误 (/tools/... -> tools/...)。 Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
两处都 spawn 了 db-server/index.js,但该文件不存在——真正的产物入口是 db-server/dist/index.js(由 npm run build 生成)。导致 CI 中 "db-server 启动 + 模块接口" 和 "sim-new-user 全流程通过" 两项自检 必然失败/超时。 Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
modulesDir 是相对 PROJECT_ROOT(仓库根)解析的(见 db-server/src/env.ts), 但默认值写成了 "../modules",解析后指向仓库外的 /modules,导致模块 API 返回空列表。sfmc 向导 (wizard.ts) 和用户文档写的都是 "modules", 这里改成一致的值。 Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
This was referenced Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
ootb工作流(.github/workflows/ootb.yml)在 push/PR 到main/refactor/**时持续失败(本次触发 headSha42f58db)。审查后定位到node tools/check-ootb.js内部 6 项自检中有 4 项必然失败,具体如下。根因与修复
tools/check-catalog.js语法错误:文件用了 ESMimport语法,但仓库根package.json未声明"type": "module",且文件扩展名是.js,Node 按 CommonJS 解析时抛SyntaxError: Cannot use import statement outside a module。改为与tools/目录其它脚本一致的require()写法。顺带修正package.json#scripts.check-catalog里的绝对路径笔误(/tools/...→tools/...)。tools/check-ootb.js/tools/sim-new-user.js启动 db-server 路径错误:两处都spawn了db-server/index.js,但该文件并不存在——真正的构建产物入口是db-server/dist/index.js(由npm run build生成)。这导致 check-ootb 的 “db-server 启动 + 模块接口” 直接失败,“sim-new-user 全流程通过” 超时。configs-default/db_config.json里modulesDir默认值错误:该字段是相对PROJECT_ROOT(仓库根)解析的(见db-server/src/env.ts),但默认值写成了"../modules",解析后指向仓库外的/modules,会导致模块 API 返回空列表。sfmc安装向导(wizard.ts)和用户文档里写的都是"modules",这里改成一致的值。CI 缺少
configs/填充步骤:configs/被.gitignore,CI checkout 后该目录不存在,导致 check-ootb 第一项 “必备仓库文件齐全” 恒定报缺失db_config.json/bds_updater.json/qq_config.json。新增一步,在 build 之后、check-ootb 之前,从configs-default/复制默认配置进configs/(仅当目标文件不存在时才复制),与AGENTS.md中记录的本地开发环境搭建方式保持一致。验证
本地按 CI 流程复现:
npm install→npm run build --workspaces --if-present→ 从configs-default/填充configs/→SFMC_ROOT=$PWD node tools/check-ootb.js。修复前:
[ootb] 通过 2 / 失败 4修复后:
[ootb] 通过 6 / 失败 0另外单独启动
db-server/dist/index.js并跑node tools/smoke-modules.js,全部断言通过。未改动
AGENTS.md中提到的、与本次失败无关的既有问题(如 SQLite 路由的sql-template-strings占位符 bug、npm run lint缺少 flat config)。