fix(ci): 修复 ootb workflow 长期失败的四处根因#11
Closed
cursor[bot] wants to merge 1 commit into
Closed
Conversation
1. tools/check-catalog.js 用了 ESM import 语法,但该文件以 .js 结尾且仓库 根 package.json 没有 "type": "module",Node 按 CJS 解析导致 SyntaxError。改为 require() 风格,与 tools/ 目录其余脚本保持一致。 2. tools/check-ootb.js 和 tools/sim-new-user.js 都 spawn 了 db-server/index.js,但该文件不存在——真实产物入口是 tsc 编译后的 db-server/dist/index.js。两处均修正路径。 3. configs-default/db_config.json 的 modulesDir 默认值是 "../modules", 但 db-server 是相对仓库根解析该路径,会指向仓库外的 /modules 导致模块 API 返回空列表。改为 "modules",与 wizard 生成值和文档一致。 4. .github/workflows/ootb.yml 里 configs/ 从未被创建(已 gitignore), 导致 check-ootb 恒定报缺失 db_config.json/bds_updater.json/ qq_config.json。在 build 之后、check-ootb 之前新增一步,从 configs-default/*.json 复制到 configs/(仅当目标文件不存在时复制)。 本地复现验证:npm run build --workspaces --if-present 后 node tools/check-ootb.js 从 2/6 变为 6/6 全部通过,node tools/smoke-modules.js 也全部通过。 Co-authored-by: Shiroha <Tanya7z@users.noreply.github.com>
Member
|
Superseded by #12. |
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.
触发原因
ootbworkflow 在最近的多次 push(包括触发本次自动化的feat(online-time)commitf45ea6)上持续失败,check-ootb只通过 2/6。CI 日志显示 4 个独立根因:tools/check-catalog.js用了 ESMimport语法,但文件是.js后缀且仓库根package.json没有"type": "module",Node 按 CJS 解析 →SyntaxError: Cannot use import statement outside a module。tools/目录其余脚本(check-ootb.js/smoke-modules.js/sim-new-user.js)都是 CJSrequire()风格,check-catalog.js是唯一例外。tools/check-ootb.js和tools/sim-new-user.js都 spawn 了db-server/index.js,但该文件不存在——db-server 的产物入口是 tsc 编译后的db-server/dist/index.js。configs-default/db_config.json的modulesDir默认值是"../modules",但 db-server 是相对仓库根解析该路径的,"../modules"会指向仓库外的/modules→ 模块 API 返回空列表,导致sim-new-user全流程超时。.github/workflows/ootb.yml从未创建configs/(该目录被 gitignore),导致check-ootb第一项「必备仓库文件齐全」恒定报缺失db_config.json/bds_updater.json/qq_config.json。修复
tools/check-catalog.js:ESMimport→ CJSrequire(),与其余 tools 脚本保持一致。tools/check-ootb.js/tools/sim-new-user.js:spawn 路径改为db-server/dist/index.js。configs-default/db_config.json:modulesDir改为"modules"(与 wizard 生成值、文档一致)。.github/workflows/ootb.yml:在Build all workspaces之后、Run check-ootb之前新增一步,从configs-default/*.json复制到configs/(仅当目标文件不存在时复制,不覆盖用户已有配置)。本地验证
备注
这 4 处根因此前已在 #5、#6、#7、#8、#9、#10 中被独立发现并提交过几乎相同的修复,但这些 PR 均未合并,导致
main分支持续失败并反复触发本自动化开新 PR。建议合并本 PR(或其中任意一个等价修复)后关闭其余重复 PR,避免 CI 反复报红。