Skip to content

ci: run the pipeline on the ai branch and fix what it finds - #1657

Open
ambiguous-pointer wants to merge 4 commits into
apache:aifrom
ambiguous-pointer:fix/ai-branch-ci
Open

ambiguous-pointer wants to merge 4 commits into
apache:aifrom
ambiguous-pointer:fix/ai-branch-ci

Conversation

@ambiguous-pointer

@ambiguous-pointer ambiguous-pointer commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

概要

让 ai 分支第一次真正跑上流水线:把 ai 加进 CI 的触发条件,并修掉流水线跑起来后立刻暴露的那批缺陷(失效的 npm 镜像、缺失的许可证头、gofmt / prettier 不干净)。

本 PR 自己就会跑 CI。 GitHub 的 pull_request 事件用的是 PR head 分支上的 workflow 文件,而不是 base 分支上的 —— 所以本 PR 把 ai 加进触发条件的效果立刻对自身生效。上面的流水线在本 PR 上实际跑过一遍,结果见「验证」。


为什么需要

ai 分支上从未跑过流水线:.github/workflows/ci.yml 的 push / pull_request 只过滤 develop,所以

结果是整个 dubbo-admin-ai 模块(独立 Go module,含 CLI ai/cmd/index.go)从未被构建、单元测试、gofmt 校验、prettier 校验和许可证头校验覆盖过。ai 分支「看起来是绿的」,只是因为上面什么都没跑。

更重要的是:光加触发条件不会让流水线变绿。流水线第一次真跑就会失败——失效的镜像让 yarn install 在构建开始前就挂掉,许可证头和格式问题则集中在只存在于 ai 分支的文件上。本 PR 把这些一并修掉,避免「加了触发条件,反而把 ai 分支变红」。

还有一点:上游 ai 分支自己也在往里带新缺陷。本 PR 合并上游的过程中,上游 #1609(fc00d27)带进来 7 个完全没有许可证头的文件;一旦 ai 分支开始跑 License Check,这 7 个文件就会把分支染红。所以本 PR 一并把它们补齐。


改了什么

# 改动 说明
1 ci.yml 触发条件 push 与 pull_request 的 branches 各加一行 ai
2 riscv-build.yml 触发条件 同上。Issue #1644 §1.1 点名了它:此前 ai 分支上没有任何一个 workflow 会跑
3 ui-vue3/yarn.lock 63 个指向已失效镜像 registry.debugmode.cn 的 resolved 换回 registry.npmmirror.com(文件里其余 848 个包本来就是这个镜像,改后共 911 个),integrity 全部保持不变
4 许可证头 48 个文件补上完整 ASF 头,5 个文件的头被改写(原本是缺引号或被截断的块注释)—— 共 53 个文件。其中 ai/providerusage/usage.go 是全仓库唯一带 package doc 注释的文件,ASF 头放在 doc 注释之上,doc 注释仍紧贴 package 子句
5 .licenserc.yaml 删掉 **/tools/** 这条忽略规则——它同时命中 pkg/mcp/tools/** 和 ai/component/tools/**,让 30 个文件此前落在校验范围之外。其中 mcp_tools.go / mock_tools.go / tools.yaml 完全没有头,已补上
6 gofmt pkg/mcp/component.go、pkg/mcp/tools/cluster.go、pkg/mcp/tools/instance.go、ai/stub/etcd-server-v3/server/v3/etcdserver.go 四个文件格式化。这四个文件只存在于 ai 分支(upstream/develop 上都没有),流水线的格式检查从未见过它们
7 prettier ui-vue3/src/components/ai-chat/**(含两个 __tests__ 下的 spec)与 src/App.vue、src/utils/IdempotencyUtil.ts 按仓库 prettier 配置重排。yarn build 会先跑 prettier --write src/,重排后工作树变脏,与 CI 的 make fmt && git status 判空直接冲突
8 合并上游 ai 把 upstream/ai 从 e6cef77 一路合到 fc00d27(#1600 / #1594 / #1596 / #1608 / #1609),并修掉合并后流水线新报出来的全部问题——含 #1609 带进来的那 7 个缺许可证头的文件

合计 4 个提交、65 个文件(+1217 / −382),相对当前 base(upstream/ai @ fc00d27)。

两个容易被误读的点

ai/ module 里还剩 13 个文件不是 gofmt 干净状态,这不是本 PR 引入的。 Makefile 的 fmt 目标只有 go fmt ./...,只作用于根模块;ai/ 是独立 module(ai/stub/etcd-server-v3 更是第三个嵌套 module),根目录的 go fmt 不会下钻进去。这 13 个文件在 upstream/ai 上是 14 个,本 PR 只修掉了 etcdserver.go 这一个。它们既不是本 PR 引入的,也不在当前流水线的检查范围内——要把 ai/ 真正纳入格式校验,需要改 Makefile 的 fmt 目标,是另一件事。

pkg/mcp/** 的改动是 gofmt,不是许可证头。 这几个文件本来就有 ASF 头,需要改的只是 import 顺序和 map 字面量的对齐。


验证

触发条件生效后,CI 在 ai 分支上跑的就是下面这些命令,本地逐条跑过:

命令 结果
cd ui-vue3 && yarn install --frozen-lockfile 通过(lockfile 未被改动)——63 个失效镜像条目全部可解析
cd ui-vue3 && yarn build(prettier --write src/ && vite build) 通过;构建后工作树保持干净(git status -s 为空)
make fmt 后 git status -s 为空
go test ./... -short(根模块:81 个包,24 个含测试) 全部通过,无失败
cd ai && go test ./... -short(ai module:41 个包,27 个含测试) 全部通过,无失败
CGO_ENABLED=0 GOARCH=riscv64 GOOS=linux go build ./...(riscv-build.yml 的构建步骤) 通过
许可证头校验(按 .licenserc.yaml 复现 skywalking-eyes 的 paths-ignore 与头匹配规则) upstream/ai @ fc00d27 上 50 个文件缺头(或头不完整),本 PR 后为 0;剩下 5 个是二进制资源(dubbo.ico、iconfont.*、login.jpg),与 upstream/develop 完全一致(develop 的流水线是绿的)

这个 PR 本身就跑 CI,而且跑绿了。 因为 pull_request 事件用的是 head 分支上的 workflow 文件,本 PR 把自己加进了触发条件,于是它触发了自己:

Check 结果
CI (Go 1.24) ✅
CI (Go 1.23) ✅
License Check ✅
RISC-V Build ✅
SonarCloud ✅

顺带一提:流水线矩阵里的 Go 1.24 / Go 1.23 两个标签目前是装饰性的 —— setup-go 配的是 go-version-file: go.mod 且没有 go-version,所以两个 job 装的是同一个 Go。这不影响本 PR,但值得上游单独修。


不在本 PR 范围


关联


English version

Summary

Make the ai branch run in the pipeline for the first time: add ai to the CI trigger and fix the defects that surface the moment it does (a dead npm mirror, missing license headers, gofmt / prettier drift).

This PR does run CI itself. GitHub evaluates the pull_request event against the workflow file on the PR head branch, not the base branch — so adding ai to the trigger takes effect on this PR immediately. The pipeline has actually run on it; the results are in "Verification" below.


Why

The pipeline has never run on the ai branch: .github/workflows/ci.yml filters push and pull_request on develop only, so

As a result the whole dubbo-admin-ai module (a separate Go module, including the CLI in ai/cmd/index.go) has never been built, unit-tested, gofmt-checked, prettier-checked or license-checked. The ai branch "looked green" only because nothing ran on it.

More importantly, adding the trigger alone does not turn the pipeline green. The first real run fails: the dead mirror breaks yarn install before the build even starts, and the license-header and formatting problems all sit in files that exist only on the ai branch. This PR fixes them together, so that adding the trigger does not instead turn ai red.

One more thing: upstream keeps bringing new defects into ai. While merging upstream into this branch, #1609 (fc00d27) added 7 files with no license header at all. The moment ai starts running the License Check, those 7 files turn the branch red — so this PR adds their headers too.


What changed

# Change Details
1 ci.yml trigger added ai to the branches list of both push and pull_request
2 riscv-build.yml trigger the same change. Issue #1644 §1.1 calls this out: until now no workflow at all ran on the ai branch
3 ui-vue3/yarn.lock the 63 entries pointing at the dead mirror registry.debugmode.cn now point at registry.npmmirror.com (the other 848 packages in the file already used it, 911 after this change). All integrity hashes are unchanged
4 License headers a complete ASF header added to 48 files, and the header of 5 files rewritten (they carried a block comment with a missing quote or a truncated body) — 53 files in total. ai/providerusage/usage.go carries the repository's only package doc comment, so the header goes above it and the doc comment stays attached to the package clause
5 .licenserc.yaml the **/tools/** ignore rule is removed — it matched both pkg/mcp/tools/** and ai/component/tools/**, which kept 30 files outside the check. mcp_tools.go, mock_tools.go and tools.yaml had no header at all and now carry one
6 gofmt pkg/mcp/component.go, pkg/mcp/tools/cluster.go, pkg/mcp/tools/instance.go and ai/stub/etcd-server-v3/server/v3/etcdserver.go are formatted. All four exist only on the ai branch (none of them is on upstream/develop), so the pipeline's format check had never seen them
7 prettier ui-vue3/src/components/ai-chat/** (including the two specs under __tests__), src/App.vue and src/utils/IdempotencyUtil.ts are reformatted per the repository's prettier config. yarn build runs prettier --write src/ first, so the rewrite left the working tree dirty and collided with the CI check make fmt && git status
8 Merge upstream ai upstream/ai is merged from e6cef77 all the way to fc00d27 (#1600 / #1594 / #1596 / #1608 / #1609), and everything the pipeline newly reports after the merge is fixed — including the 7 files that #1609 brought in without a license header

4 commits, 65 files (+1217 / −382) against the current base (upstream/ai @ fc00d27).

Two things that are easy to misread

13 files in the ai module are still not gofmt-clean, and this PR did not introduce them. The fmt target of the Makefile is go fmt ./..., which covers the root module only; ai/ is a separate module (and ai/stub/etcd-server-v3 a third nested one), so the root go fmt does not descend into them. Those 13 files are 14 on upstream/ai — this PR repairs exactly one of them (etcdserver.go). They are neither introduced here nor within the current pipeline's reach; bringing the ai module under format checking means changing the fmt target, which is a separate change.

The pkg/mcp/** changes are gofmt, not license headers. Those files already carried ASF headers; only the import order and the map literal alignment needed fixing.


Verification

Once the trigger is in place, these are the commands CI will run on the ai branch. Each was run locally:

Command Result
cd ui-vue3 && yarn install --frozen-lockfile passes (lockfile untouched) — all 63 dead-mirror entries resolve
cd ui-vue3 && yarn build (prettier --write src/ && vite build) passes; the working tree stays clean after the build (git status -s is empty)
make fmt followed by git status -s empty
go test ./... -short (root module: 81 packages, 24 with tests) all pass, no failures
cd ai && go test ./... -short (ai module: 41 packages, 27 with tests) all pass, no failures
CGO_ENABLED=0 GOARCH=riscv64 GOOS=linux go build ./... (the riscv-build.yml build step) passes
License header check (the paths-ignore and header matching of .licenserc.yaml, reproducing skywalking-eyes) 50 files miss a header (or carry an incomplete one) on upstream/ai @ fc00d27, 0 after this PR. The 5 that remain are binary assets (dubbo.ico, iconfont.*, login.jpg), exactly as on upstream/develop, whose pipeline is green

This PR does run CI, and it passes. Because the pull_request event uses the workflow file on the head branch, this PR added itself to the trigger and therefore triggered itself:

Check Result
CI (Go 1.24) ✅
CI (Go 1.23) ✅
License Check ✅
RISC-V Build ✅
SonarCloud ✅

While we are here: the Go 1.24 / Go 1.23 labels in the CI matrix are currently decorative — setup-go is configured with go-version-file: go.mod and no go-version, so both jobs install the same Go. That does not affect this PR, but upstream may want to fix it separately.


Out of scope

  • [ci] release.yaml 调用不存在的 make build-dubboctl / build-dubbo-cp:develop 上的发布链路是断的 #1646: release.yaml calls the Makefile targets build-dubboctl and build-dubbo-cp, which do not exist. This is the other side of the same broken-CI problem, but it is unrelated to the trigger and gets its own PR.
  • The fmt target of the Makefile does not cover the ai module (see "What changed"). This PR only makes the pipeline run on ai; it does not change the semantics of the Makefile.
  • Dependency versions of the ai module are untouched (genkit stays at v1.2.0).
  • Functional changes inside the ai module.

Related


The workflows only triggered on develop, so everything that happens on the ai
branch was never built, tested or license checked by the pipeline. The ai
branch looked green because nothing ran on it.

This adds the ai branch to the trigger of ci.yml and riscv-build.yml and
fixes the defects the pipeline reports on its first run:

- The frontend lockfile pointed 63 packages at registry.debugmode.cn, a
  mirror that no longer resolves, so yarn install failed before the build
  could start. Those entries now use the same mirror as the rest of the
  file.
- The ai module and the ai chat components carried no license header, and
  three files of the test utilities had a header with a missing quote.
- Four files were not gofmt clean. They only exist on this branch, so the
  format check of the pipeline had never seen them.
- The frontend sources were not prettier clean, and the build runs
  "prettier --write src/" before it bundles. The rewrite left the working
  tree dirty and failed the format check of the pipeline.
- The license configuration ignored every path below a "tools" directory,
  which also covered the MCP tool layer and the AI tools component. Three
  files in there had no header at all. The rule is removed and they carry a
  header now, so the MCP tool layer and the AI tools component are under
  the check.

Fixes apache#1644
The ai branch moved on by four merged pull requests while this branch was
open, so the pull request no longer applied cleanly. Merging upstream/ai
brings the branch up to date and resolves the two conflicts in the chat
components: the upstream version of those files carries the retry support
of apache#1600, so it is taken as the base and the license header and the
formatting of this branch are applied on top of it.

The merge also brings in six files of the upstream pull requests that
carry no license header, two of them a truncated one. Without the fix the
pipeline this pull request enables would fail on the license check as soon
as the trigger reaches the ai branch.
…without

Merging upstream `ai` pulls in the seven files that apache#1609 added, and all
seven of them landed with no license header at all. The moment this PR
turns the License Check on for the `ai` branch, those seven are exactly
what turns the branch red.

`ai/providerusage/usage.go` carries the repository's only package doc
comment, so the header goes above it and the doc comment stays attached
to the `package` clause.
@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2026

Copy link
Copy Markdown

@robocanic robocanic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

优点

  • 触发条件改动(.github/workflows/ci.yml、.github/workflows/riscv-build.yml)准确:pull_request.branches 过滤的是 PR 的 base 分支,因此需要同时在 push 与 pull_request 中加入 ai,PR 描述对此解释清楚。
  • .licenserc.yaml 删除 **/tools/** 忽略规则后,对应补齐 pkg/mcp/tools/**、ai/component/tools/** 的许可证头,范围收敛合理。
  • 逐文件核对 diff:新增头与 .licenserc.yaml 中的 header.license.content 一致,注释形式与各文件类型匹配(.go/go.mod 用 //,.yaml/.env.example 用 #,.css/.js 用 /* */);ai/providerusage/usage.go 的 ASF 头与 package doc 之间有空行,doc 注释仍紧贴 package,不影响 godoc;ai/testutils/* 中原先缺引号的头已修正。
  • gofmt(pkg/mcp/**、etcdserver.go)与 prettier(App.vue、IdempotencyUtil.ts)仅为格式调整,无语义变化;yarn.lock 仅替换 resolved 镜像域名,integrity 未变;Makefile 的 test 目标本身已包含 cd ai && go test ./... -short,与 PR 描述一致。

Critical

未发现。

Important

未发现。

备注(非阻塞)

  • PR 描述中 Fixes #1644,而同时声明 Makefile 的 fmt 目标不覆盖 ai/ module(仍有 13 个文件未 gofmt)属于 out of scope。若 #1644 还包含该诉求,合并时会自动关闭该 issue,建议确认是否改为 Relates to,或另开 issue 跟踪。

总体评估

Ready to merge?Yes

改动以流水线触发条件、许可证头、格式化为主,均为机械性修改,未发现 bug、逻辑或兼容性问题,未发现明显问题。

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.

3 participants