Merged
feat(gates): 引入仓内门禁骨架与依赖图门禁 #54
JunyiAdd on Sep 24
feat(gates): 引入仓内门禁骨架与依赖图门禁 #54
Merged
Pull Request has been successfully merged by CANN-robot.
(Thank you for Junyi's contribution.)Sep 24 Added label: stat/needs-squash
Sep 24 Added label: cann-cla/yes
CANN-robot
Sep 24 Comments:
Sep 24 Comments:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/cannbot | ✅ 汤平川, 金炯 (2/2) | ✅ 汤平川 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
gcw_P2Mh5H1S, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Junyi
Sep 24 Comments:
Sep 24 Comments:
compile


74 messages are collapsed here。 See more
Sep 29 Added label: approved
Sep 29 Pre merge succeeded (commit_id: 6090f32efd67c10ed820de6ed8a3cfa04659fb9e)
jon_jin
Oct 28 Comments:
Oct 28 Comments:
/lgtm


Oct 28 Added label: lgtm
Oct 28 Merged pull request
这个 MR 做什么
从
cann/cannbot-skills搬入依赖图门禁,补上本仓运行它所缺的输出层与 runner,新增一个只在 cake 改动时激活的 CI stage,并修掉 cake 五个文件在scripts/oat_check.sh下的 OAT 发现。一、门禁骨架
tests/lib/report.sh(新建) 导入源的门禁source的是tests/lib/test-helpers.sh——一个 64 KB 的库,其余函数服务于本仓不跑的 CLI 行为用例。本文件只提供这些门禁用到的部分:11 个函数、4 个计数变量、3 个路径变量、7 个颜色变量,名称与输出格式与导入源一致。后续门禁移过来只需改source一行。tests/unit/test-dependency-graph.sh(搬入) 与导入源的差异只有source那一行。tests/lib/dependency_validator.py(搬 767 行,七处改动)_is_inside_nested_git_repo原实现从file_path.parent起向上找.git,不在仓库根停止。检出目录的任一祖先含.git时整棵树被剪枝,技能与 agent 均发现为 0。改为只检查仓库根与目标路径之间的目录。source支持对象形(git-subdir按.gitmodules的 URL 映射到子模块工作区路径,local按仓库根解析)。原实现对其调用.lstrip直接抛AttributeError。ops/graph/model/infra)单独登记——工作区遍历会剪掉子模块。plugin-sources.json声明的技能路径必须存在。plugin-sources.json一路,此前对ops-direct-invoke整条规则空转。DG_ERROR_SCOPE:范围内的发现判红,范围外降为告警并标注,规则名与内容不变。未设时行为与导入源一致。另:
_collect_plugin_agent_skills深度 6、类内方法排列不符 G.CLS.06、_output_findings直接写 stdout 触发 G.LOG.02,均为导入源既有问题,因该文件在本仓算新增会被记为新发现,一并整改。整改前后逐方法 AST 比对一致,校验器输出逐字节不变。tests/run-gates.sh(新建) 按名登记门禁并汇总。前置条件缺失时跳过对应门禁并以退出码 2 结束。退出码 0 全过、1 门禁失败、2 前置缺失。二、激活范围与判定范围
cannbot-actions.yml只加 9 行声明stage3,现有三个 stage 与on:触发器均未改动。gates_action.yml照cann/cannbot-skills的ut_action.yml:先uses: checkout取到工作区路径,再执行仓内脚本。激活范围(未命中即打印原因并退出 0)与判定范围(范围外的发现降为告警)一致:
这样别人插件的缺陷不会让 cake 的 PR 变红,本门禁也不会去红别人。代价是
marketplace.json中与 cake 无关的错误也会判红,这一点在代码注释中写明。平台的
if:在两个仓里只出现过default()与always(),没有按路径过滤的先例,所以激活判断放在脚本里。改动清单两级取法:merge commit 用HEAD^1..HEAD,否则退回origin/<目标分支>...HEAD,都取不到时打印原因并退出 0——宁可漏跑,也不让与 cake 无关的 MR 因为本 stage 变红。触发沿用现有的
/compile,未加pull_request自动触发:两个仓的on:都无该触发器,平台是否支持未经证实,而on:写错会影响该文件的全部 stage。三、OAT.xml
MR !15 把 cake 的第三方文件登记进了
licenseFileNamePolicyFilter,但那个过滤器挂在policyitem type="license"上,管的是默认许可归属;而scripts/oat_check.sh(master 的ce5bb20引入)报出的是 License Header Invalid 与 Copyright Header Invalid,对应defaultPolicyFilter与copyrightPolicyFilter。本次把五个按格式无法承载许可头的文件登记进这三个过滤器:LICENSE-APACHEREADME.OpenSourcerequirements.txt×2skills/op-dashboard/assets/chart.umd.min.js做法与 master 在同两个过滤器里登记
*.yaml/*.yml/*.csv一致。实测
scripts/oat_check.sh:修前 45 条(cake 8、tests/1),修后 37 条(cake 与tests/均为 0)。剩余 37 条全部落在 master 既有文件上(plugins-community 20、plugins-official 9、script 7、docs 1),与本分支无关,另行报给引入该体系的一方(issue #16)。该检查目前只是本地 pre-commit 钩子,.gitcode/中无引用。四、验证
仓库根为本分支,master
a17dd89,子模块9ae606b3:bash tests/run-gates.sh退出码 0,errors 0、warnings 19、total_skills 155、total_agents 31agents/cake.mdfrontmatter 加不存在的技能名 →errors=1(DG-06)plugins-community/triton-auto-evolve的AGENTS.md同样加一个 →errors=0,仅记 DG-05 告警ops包的path改错 →errors=20(DG-01)errors=0vendor/cannbot-skills/.git后run-gates.sh退出码 2,输出 0 条 DG-01bash -u下 runner 与门禁脚本均无 unbound variablenpm --prefix script test84/84 全过pycodestyle无告警,标定过的 CodeCheck 规则复查为 0上述反向验证均在本地改后复原,本 MR 的 diff 不含这些改动。
未验证:本 stage 在 gitcode 上的实际行为——平台是否认
uses: .gitcode/workflows/这种仓内引用、checkout 后能否拉子模块、容器内有无 python3 与 PyYAML。本 MR 改到tests/,会命中激活条件。五、门禁在当前 master 上报出的 19 条告警
不阻断(只按
errors判红),列出供各插件归属方参考。其中两条值得单独说明:2348eda把ascendc-port-orchestrator从cann/cannbot-skills迁入时,未把它plugin.json声明的两个依赖对应的 marketplace 条目一并带来;二者在 cannbot-skills 的 marketplace 中均存在。该插件的依赖在本仓解析不了,属其归属方处理。其余 17 条为 DG-07(插件自带技能无清单声明)与 DG-08(
plugins-official/ops-registry-invoke/无.claude-plugin/plugin.json)。🤖 Generated with Claude Code