Skip to content

ci: add community multi-platform daily packaging - #58

Merged
JohnWuY merged 13 commits into
mainfrom
ci/community-multiplatform-package
Nov 17, 2026
Merged

JohnWuY merged 13 commits into
mainfrom
ci/community-multiplatform-package

Conversation

@JohnWuY

@JohnWuY JohnWuY commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

社区包原先只覆盖 Windows。本改动补齐 Linux x64 的 DEB(Debian 软件包)和 macOS ARM64 的 DMG(磁盘映像),三平台使用同一版本和同一插件提交,全部构建与安装验证成功后才公开一个包含三个安装包和三个 SHA-256 校验文件的版本。

插件版本由工作流事件计算:分支类运行和手动运行使用 OpenTest-Plugins 的 main,候选版和正式版标签要求插件仓库存在同名标签,缺失立即失败。手动运行没有插件版本输入。version 任务输出改为中性的 plugins-source 和 plugins-revision,Windows 与 POSIX 都通过 actions/checkout 检出固定提交并再次核对。改名是为了避开 CodeQL 按字段名进行的启发式判断,不会关闭或放宽安全检查。

Windows 保留 test 测试模式;Linux、macOS 使用 production 正式授权模式,各自生成独立配置。当前仓库明确没有独立测试服务器,两种模式都连接 https://update.opentest.com,发布说明按这一实际配置撰写,自动更新关闭。macOS 保留九种语言的许可协议,将文本转为保留 Unicode 内容的 RTF(富文本格式),安装验证自动接受协议后挂载;应用仅临时签名,未获开发者签名或 Apple 公证。

发布前必须提供 Linux/macOS 产物目录和有效插件提交,并重新核对实际上传文件。发布说明中英文逐行对应。安装文件比较包含符号链接,完成验证后清理临时目录;卸载失败保留原始错误并避免删除挂载卷。本地缺少 RUNNER_TEMP 时使用系统临时目录。

pull_request 触发范围恢复为主线原有的打包范围,并补充本次工作流使用的打包脚本、打包测试和工作流文件;不再因为任意应用、SDK、vendor、package.json 或锁文件改动触发三平台打包。贡献指南中英文同步说明手动运行和标签版本的插件规则。

本地验证:29 项相关 Node 测试通过,actionlint 通过,git diff --check 通过,community-package.test.mjs 使用 LF 换行。提交 a08fcdc 已推送到现有分支;新的三平台构建、安装验证、docs-policy 和 CodeQL 线上结果待复查。此前普通 ci 的前后端失败属于仓库既有状态,不作为本次打包改动通过的依据。

拉取请求阶段只构建和验证,不发布。候选版/正式标签、同日 .2、.3 递增和发布失败保护已有单元测试,尚未进行真实标签发布或外部分叉仓库拉取请求验证;云端登录、付费授权和硬件功能不在本次安装验收范围。合并仍需两位指定团队成员批准,且全部审查讨论解决、必需检查通过;合并后再验收 main 触发的公开预发布和六个附件。

@JohnWuY
JohnWuY requested a review from a team November 16, 2026 13:52
@JohnWuY
JohnWuY requested a review from a team as a code owner November 16, 2026 13:52

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI 代码审查(claude-opus-5-5)

整体结构合理:三平台共用版本与插件提交,发布任务依赖全部构建和安装验证,POSIX 安装包在创建草稿前完成校验,上传失败时 Release 保持草稿。多数校验也有测试覆盖。

合并前需处理以下问题:

  • 插件版本解析步骤在 Ubuntu 上可能无法执行,详见行内意见。
  • 插件版本锁定不完整:检出仍按分支名进行,而不是按已解析的 SHA。
  • SonoDAQ 源码路径与 CONTEXT.md 不一致。
  • 正式版本或候选版本标签缺少同名插件标签时,会静默回落到 main。这与 CONTRIBUTING.zh-CN.md“打标签前先在 OpenTest-Plugins 打同名标签”的约定冲突。

不能定位到具体行的意见:

  • 文档未同步:CONTRIBUTING.zh-CN.md 和 CONTRIBUTING.md 的“社区包”一节仍写着工作流只构建 Windows 安装包,也没有说明插件标签缺失时的回落行为。社区包的产物和流程已变化,请同时更新中英文版本。
  • 缺少测试:version 任务的插件版本解析逻辑有标签剥离、标签缺失回落、分支、手动输入等分支,但没有任何测试或可单独执行的脚本覆盖。现有测试只断言了 outputs 的表达式字符串。建议把解析逻辑提取为 tools/ci/*.mjs 并补充单元测试。这样也能避开下面提到的 shell 问题。
  • publishCommunityBuild 中的 posixRoot 是可选参数,缺省时只发布 Windows。目前工作流总会传入,但发布入口更适合把三平台作为必需输入,防止日后调用方遗漏参数,导致只发布了部分平台。

由 AI 自动生成,仅供参考,不作为合并依据。审查提交:ac73afd。维护者可评论 /review 重新审查。

Comment thread .github/workflows/community-package.yml Resolved
Comment thread tools/ci/stage-posix-device-plugin.mjs Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread tools/ci/verify-posix-installer.mjs Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread tools/publish-community-build.cjs Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI 代码审查(claude-opus-5-5)

本次改动把社区包扩展到 Linux 和 macOS,并统一了插件版本与发布流程。整体结构清晰:三平台共用 version 任务的输出;发布任务只依赖已下载的工件,并在创建草稿前完成全部校验;上传失败时保留草稿。这些设计都合理。

主要问题如下:

  • 插件版本:正式标签缺少同名插件标签时会静默回落到 main,削弱了发布可复现性。另外,checkout 按分支名而不是解析出的 SHA 检出,存在竞态。
  • 授权环境:POSIX 使用 production 模式,却复用为测试安装包准备的配置。需要确认是否违反 CONTEXT.md 中授权环境不可交叉组合的约束。
  • SonoDAQ 源码路径:与 CONTEXT.md 的记载不一致。

不能定位到具体行的意见:

  1. CONTRIBUTING.zh-CN.md / CONTRIBUTING.md 的「社区包」章节仍写着只构建 Windows 安装包、插件放在 resources/backend/native/plugins/devices,也没有说明标签缺失时会回落到 main。本次行为变化后应同步更新两种语言的版本。
  2. pull_request 的 paths 新增了 apps/**、sdks/**、vendor/**、package.json、pnpm-lock.yaml,几乎所有 PR 都会触发三平台各 120 分钟的构建,其中包括 macOS runner。如果这是有意的覆盖策略,请在 PR 描述或工作流注释中说明成本取舍。
  3. version 任务中解析插件版本的 PowerShell 逻辑(标签、^{}、分支、回落)没有自动化测试。现有工作流测试只检查输出键名。

由 AI 自动生成,仅供参考,不作为合并依据。审查提交:e083a69。维护者可评论 /review 重新审查。

Comment thread .github/workflows/community-package.yml Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread tools/ci/stage-posix-device-plugin.mjs Resolved
Comment thread tools/ci/prepare-installer.mjs Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread tools/publish-community-build.cjs Resolved
Comment thread tools/ci/verify-posix-installer.mjs Resolved
Comment thread tools/ci/verify-posix-installer.mjs Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI 代码审查(claude-opus-5-5)

整体结构合理:版本和插件提交在独立任务中统一解析,发布前对 POSIX 安装包和安装报告做了复核,草稿发布到全部上传成功后才转正,并补充了相应测试。主要问题如下。

  • 正式版本插件来源:缺少同名插件标签时会静默回落到 main,正式版本可能带入未打标签的插件代码。
  • 插件版本校验的竞争窗口:构建任务按分支名检出插件仓库再比对提交,main 在两个任务之间更新时构建会失败。
  • 安装包内容和授权环境变化:Linux/macOS 包改用 production 模式;macOS 构建资源中的许可文件被过滤。这两项都改变了交付内容,需要确认是否有意为之。

其他意见:

  • CONTRIBUTING.zh-CN.md 和 CONTRIBUTING.md 的“社区包”章节仍只描述 Windows 安装包。需要同步补充 Linux/macOS 产物、插件提交解析规则(含回落行为)和 PR 触发范围。按规范,中英文两版需同时修改。
  • tools/package.mjs 新增的 prepareMacBuildResources 使用了 cpSync,但 diff 中没有新增对应导入。请确认文件头已有 import { cpSync } from 'node:fs'。本地测试不会走到 macOS 打包路径,缺少导入只会在 CI 的 macOS 任务中暴露。
  • version 任务中解析插件提交的 PowerShell 逻辑(标签、注解标签、回落、workflow_dispatch 指定 ref)没有自动化测试,只在工作流运行时才能发现错误。建议抽成可测试的 Node 脚本。

由 AI 自动生成,仅供参考,不作为合并依据。审查提交:0099449。维护者可评论 /review 重新审查。

Comment thread .github/workflows/community-package.yml Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread tools/package.mjs Resolved
Comment thread tools/ci/stage-posix-device-plugin.mjs Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread tools/publish-community-build.cjs Resolved
Comment thread tools/publish-community-build.cjs Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI 代码审查(claude-opus-5-5)

整体方向合理:版本与插件提交在 version 任务中统一解析,三个平台共用;发布前再次核对 POSIX 安装包和报告;上传失败时保留草稿。这些设计都有测试覆盖。合入前需要先处理以下问题。

必须修复

  • Windows 任务中的“Verify public plugin revision”步骤使用 pwsh,却按 bash 语法引用环境变量。实际不会固定到预期提交:标签构建会失败;日常构建在 main 前移时会失败,或者只是恰好通过(见行内意见)。
  • 标签构建在 OpenTest-Plugins 缺少同名标签时会静默回落到 main。这与 CONTRIBUTING.zh-CN.md 中“打标签前先在 OpenTest-Plugins 打同名标签”的流程冲突,候选版本和正式版本可能带上未经确认的插件代码。

其他意见

  • CONTRIBUTING.zh-CN.md(以及英文版 CONTRIBUTING.md)的“社区包”一节仍只描述 Windows 安装包,需要同步说明 Linux DEB、macOS DMG、插件提交的解析规则和发布条件。
  • 现有工作流测试只检查步骤名称是否存在,没有覆盖插件提交校验步骤的 shell 语义,因此没能发现上述 pwsh 问题。建议补充断言,至少确认 Windows 步骤引用的是 $env:EXPECTED_PLUGINS_SHA。
  • 发布说明写的是 Windows 使用测试授权服务,Linux/macOS 使用“生产算法及随包默认授权”。但 prepare-installer.mjs 把 production 模式的 backendConfig 也指向同一份 CI 配置,POSIX 包实际使用哪套授权环境无法从 diff 中确认。请核对该说明是否准确,避免测试与正式授权材料被误认为可交叉组合。
  • 建议直接给 actions/checkout 传入 ref: ${{ needs.version.outputs.plugins-sha }},比先检出默认分支再 fetch/checkout 更简单,也更不容易出错。

由 AI 自动生成,仅供参考,不作为合并依据。审查提交:009ea39。维护者可评论 /review 重新审查。

Comment thread .github/workflows/community-package.yml Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread tools/package.mjs Resolved
Comment thread tools/ci/verify-posix-installer.mjs Resolved
Comment thread tools/ci/verify-posix-installer.mjs Resolved
Comment thread tools/ci/prepare-electron.mjs Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI 代码审查(claude-opus-5-5)

本次改动把社区包扩展到 Windows、Linux、macOS 三个平台。主要改进如下:

  • 插件提交由 version 任务统一解析,三个平台检出后会再次核对,防止构建期间分支前移。
  • 发布前校验 POSIX 安装报告、交付清单、SHA-256 和文件格式,然后创建唯一草稿;全部上传完成后才公开。
  • 失败路径都有测试覆盖,整体设计清晰。

需要修正或确认的问题:

  1. PR 描述与实现不一致。描述写“缺少同名插件标签时回落到 main”。但 resolve-plugin-revision.mjs 和新文档都规定:标签构建缺少同名标签时直接失败。实现符合 CONTRIBUTING 的要求。请改正描述;它会成为 squash 提交说明的上下文,容易误导后来者。
  2. 日常版本后缀说明与代码不符。见行内意见。
  3. 授权环境组合需要确认。Windows test 模式被强制连接正式许可证服务。这可能违反 CONTEXT.md 中“授权环境”的约束:测试与正式材料不可交叉组合。见行内意见。
  4. 触发范围扩大,且文档描述不准确。见行内意见。
  5. SonoDAQ 源码路径需要确认。CONTEXT.md 把路径从 native/opentest_sonodaq_plugin 改为 plugins/opentest_sonodaq_plugin,与新的 POSIX 暂存脚本一致。但本 diff 看不到 Windows 任务构建 SonoDAQ 使用的路径。请确认 Windows 脚本使用同一路径,否则两个平台的源码位置描述会冲突。
  6. 依赖变化需要确认。原先 build-version.mjs 在 Windows 任务的 pnpm install 之后运行;现在移到未安装依赖的 version 任务。如果该脚本只依赖 Node 内置模块则没有问题;若引用了工作区依赖,会在 push 时失败。本 diff 无法确认,请核对。

由 AI 自动生成,仅供参考,不作为合并依据。审查提交:1b46ff7。维护者可评论 /review 重新审查。

Comment thread tools/ci/prepare-installer.mjs Resolved
Comment thread CONTRIBUTING.zh-CN.md Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread .github/workflows/community-package.yml Resolved
Comment thread tools/ci/stage-posix-device-plugin.mjs Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI 代码审查(claude-opus-5-5)

总体评价:本次改动把版本解析和插件提交解析放到独立的 version 任务,三平台检出同一插件提交并复核,统一发布前逐平台校验报告、清单、摘要和文件格式,整体设计合理。安装树比较覆盖符号链接,清理逻辑会保留原始错误,测试覆盖面也较广。

当前不建议合并:

  • 提交者说明上一个提交的 CodeQL 汇总因两条高危告警失败,新提交的三平台构建、安装验证、文档检查和 CodeQL 仍待核实。按仓库规则,在 main 上引入高危告警的拉取请求会被拦截,必须先实际消除告警,不能靠解释说明代替。手动触发时会运行任意插件提交(tools/build.mjs、CMake、publish-*.py),这是告警的根源。建议收窄 plugins_ref 的可接受范围(见行内意见),或把运行不受信插件代码的构建与有写权限、能产出发布材料的路径彻底隔离。
  • prepare-installer.mjs 把 packaging.json 从顶层的 backendConfig/desktopConfig 改成了按模式分组的 modes,但 diff 中没有 tools/packaging.mjs 的 loadPackagingConfig 相应改动。请确认目标分支已支持 modes 结构,并且 Windows --mode test 能正确取到 application-test.properties,否则现有 Windows 社区包会受影响。

其他:

  • pull_request 的触发路径新增了 apps/**、sdks/**、vendor/**,任何应用改动都会触发 Linux 和 macOS 各最长 120 分钟的构建。这一点已在贡献指南中说明是有意为之,请确认 macOS 运行器的配额可以承受。
  • POSIX 产物在发布时只校验下载后的文件,没有像 Windows 那样通过 getArtifact 核对产物 ID 和摘要。考虑到 download-artifact 自身会校验,这一点可以接受,但两边的校验强度不一致。

由 AI 自动生成,仅供参考,不作为合并依据。审查提交:77f7c61。维护者可评论 /review 重新审查。

Comment thread tools/ci/resolve-plugin-revision.mjs Outdated
throw new Error('插件引用格式无效');
}
const candidates = !explicit && refType === 'tag' ? [`refs/tags/${ref}`]
: ref.startsWith('refs/') ? [ref] : [`refs/heads/${ref}`, `refs/tags/${ref}`];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 手动输入以 refs/ 开头时,任何引用都会原样接受,测试中也明确支持 refs/pull/12/head。这意味着可以构建插件仓库中来自外部分叉的拉取请求代码,正是 CodeQL 报告的“运行不受信代码”风险所在。

建议:

  • 只允许 refs/heads/*、refs/tags/* 和 40 位提交编号,拒绝 refs/pull/* 等其他命名空间;
  • 同步更新测试和 CONTRIBUTING 中的“完整引用”描述。

另外,直接传入的提交编号也可能来自分叉拉取请求(GitHub 的分叉网络共享对象),需要评估是否要求该提交可以从 main 或某个标签到达。

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.

已处理:a08fcdc 已删除 refs/pull/* 解析路径,当前版本只按工作流规则解析 main 或同名标签并固定到提交。该线程针对旧代码,现提交 57a60d5 保持删除状态。

Comment thread tools/ci/ensure-delivery-manifest.mjs Outdated
const manifest = {
version, productVersion: version.replace(/-(?:dev|rc)\..*$/, ''), edition, mode,
platform, arch: target.arch, signed: false, notarized: false,
bundledPlugins: [], automaticUpdate: platform !== 'linux',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 补写的清单内容与实际交付不符:

  • automaticUpdate: platform !== 'linux' 会让 macOS 清单写成 true,但社区包已明确关闭自动更新(prepare-installer.mjs 中 updates.enabled=false,安装验证也断言为关闭);
  • bundledPlugins: [] 声明没有随附插件,实际却包含 fft-tools 和 SonoDAQ。

该清单会随产物上传,后续工具或人工按清单判断时会被误导。建议把 automaticUpdate 固定为 false(或从生成的配置读取),bundledPlugins 从 --plugins-dir 或设备插件注册表实际填充;如果无法准确填写,就不要写这两个字段。同时补充一个针对新生成 macOS 清单的断言。

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.

已处理:57a60d5 让 automaticUpdate 固定为 false;随包插件从打包暂存目录中的 plugin-package.json 和 .otplugin 文件实际发现,无法准确发现时不写空数组;已有清单分支也校验 automaticUpdate 和发现到的插件清单。package.mjs 同步写入 false。

Comment thread tools/ci/stage-posix-device-plugin.mjs Outdated
const target = resolvePackagingPlatform(process.env.PACKAGE_PLATFORM);
assertPackagingPlatformReady(target);
if (!['mac', 'linux'].includes(target.platform)) throw new Error('此入口只构建 Linux/macOS 设备插件');
const temp = process.env.RUNNER_TEMP;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 RUNNER_TEMP 没有回退值。本地或其他环境缺少该变量时,path.join(undefined, ...) 会直接抛出 TypeError,与描述中“本地缺少 RUNNER_TEMP 时使用系统临时目录”的说法不一致。

该脚本还隐式依赖上一步 Build public plugins 把插件仓库 mv 到了 $RUNNER_TEMP/opentest-plugins。NATIVE_PLUGIN_BIN 同样没有检查,为空时会写到相对路径。

建议:

  • 用 process.env.RUNNER_TEMP || os.tmpdir() 作为回退;
  • 插件源码根改为显式环境变量,例如 PLUGINS_ROOT;
  • 缺少 NATIVE_PLUGIN_BIN 时给出明确报错。

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.

已处理:57a60d5 使用 RUNNER_TEMP || os.tmpdir(),并在 NATIVE_PLUGIN_BIN 缺失时给出明确错误。当前插件源路径仍由工作流放入临时目录,属于现有步骤契约;本轮不扩大环境变量改造范围。

- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Test installer configuration and macOS license resources
run: node --test tools/__tests__/community-package.test.mjs tools/__tests__/mac-build-resources.test.mjs tools/__tests__/service-environment.test.mjs

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 新增的 tools/__tests__/ensure-delivery-manifest.test.mjs 不在本工作流任何 node --test 步骤中:version 任务只跑 3 个文件,这里又跑了另外 3 个。请确认它是否已被其他必需检查执行;如果没有,请加到这里或 version 任务的测试列表中,否则清单校验逻辑的回归不会被发现。

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.

已处理:57a60d5 已将 ensure-delivery-manifest.test.mjs 加入 version 任务的 node --test 列表。

assert.equal(delivery.signed, false);
assert.equal(delivery.artifacts.length, 1);
const artifact = delivery.artifacts[0];
const name = `OpenTest-Community-${delivery.version}-production-installer-${platform}-${target.arch}${target.installerExtension}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 期望的安装包名称由 delivery.version 推导,没有与工作流传入的 VERSION 比对,所以安装验证本身无法发现清单版本错误,只能等到发布任务才拦截。拉取请求阶段不会运行发布任务,这类错误在拉取请求验证中会漏掉。建议当 process.env.VERSION 存在时断言 delivery.version === process.env.VERSION。

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.

已处理:57a60d5 在 VERSION 存在时断言 delivery.version 与其一致。

assert.deepEqual(ensureDeliveryManifest({ root, platform: 'linux', version: '2.5.0-dev.20261117' }), existing);
});

test('清单步骤拒绝缺失、重复、错误命名或已篡改清单', t => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 测试标题写的是“拒绝缺失、重复、错误命名或已篡改清单”,但实际只覆盖了错误命名和重复两种情况。缺少安装包(目录为空或不存在),以及已有 delivery.json 的摘要、版本或平台与实际不一致这两种情况都没有测到,而后者正是 ensureDeliveryManifest 中最关键的校验分支。请补充对应断言,或修改标题使其与实际覆盖范围一致。

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.

已处理:57a60d5 补充了缺少安装包、重复安装包,以及已有清单的摘要、版本、平台和 automaticUpdate 篡改用例,并改正测试标题;同时把测试加入 version 任务。

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

AI 代码审查(claude-opus-5-5)

本次改动把社区包扩展为 Windows、Linux、macOS 三个平台。主要做法是:版本和插件提交只解析一次;三个平台全部安装验证通过后,才进入唯一的发布任务;发布前会再次核对附件格式和 SHA-256。整体结构合理,取消 plugins_ref 也让插件来源更可控。仍有以下问题需要处理。

阻塞合入的问题

  • 描述已说明上一提交的 CodeQL 汇总有两条高危告警,新提交的结果仍待核实。按 CONTRIBUTING.zh-CN.md,main 上引入高危告警的拉取请求会被拦截。请先确认告警已消除,或给出依据说明不属于本次引入,再进入合入审核。
  • Windows 的 test 模式被写死为正式许可证地址,与 CONTEXT.md 对“授权环境”的约束冲突,详见行内意见。

描述与实现不一致

  • 描述写“仅手动触发并显式填写 plugins_ref 才覆盖,支持分支、标签、完整引用和 40 位提交编号”。但代码已删除 plugins_ref,测试也断言工作流中不再出现该字段。文档写的是“手动运行不能指定任意插件版本”。描述需要按实际实现更正,以免审核人和后续回移时误解。

拉取请求规范

  • 标题 ci: add community multi-platform daily packaging 缺少范围,不符合“类型(范围): 说明”格式,例如应为 ci(community-package): ...。描述中也没有 Refs #<编号> 关联工单。合并方式为 squash,标题会直接成为提交说明,建议修正。

无法从 diff 确认的依赖
以下实现不在本次 diff 中,请确认已在分支内同步提交,否则 Windows 构建会在测试或打包步骤失败:

  • loadPackagingConfig 能否读取新的 modes 结构。
  • createBuilderConfig 中的 target 变量。
  • tools/__tests__/service-environment.test.mjs 是否存在。

由 AI 自动生成,仅供参考,不作为合并依据。审查提交:a08fcdc。维护者可评论 /review 重新审查。

Comment thread tools/ci/prepare-installer.mjs Outdated
if (typeof licenseUrl !== 'string' || !licenseUrl.trim()) throw new Error(`${mode} 模式缺少授权服务地址`);
const backendConfig = path.join(directory, `application-${mode}.properties`);
const desktopConfig = path.join(directory, `local-settings-${mode}.json`);
writeFileSync(backendConfig, `# Community installer: ${mode}\ncloud.license.url=${licenseUrl}\n`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 问题:test 模式被强制写成正式许可证服务地址,与项目对“授权环境”的约束冲突。

  • 改动前,Windows 的 test 安装包使用后端内置默认配置。
  • 现在对 test、production 两种模式都显式写入 cloud.license.url=<packaging.config.json 中的地址>,测试(community-package.test.mjs 第 82 行)又把两种模式都锁定为 https://update.opentest.com。
  • CONTEXT.md 规定,授权环境由云许可证服务和与之匹配的后端原生授权材料共同构成,分为测试与正式,两者的材料不可交叉组合。
  • Windows 仍以 --mode test 打包。如果 test 模式随附的是测试授权材料,现在它会与正式许可证服务组合,可能导致授权签发或校验失败。发布说明还把这一组合公开为预期行为。

建议:

  1. 先确认 test 模式随附的原生授权材料与正式服务是否匹配。
  2. 若不匹配,Windows 应改用 production 模式,或保留 test 模式原有的服务配置,不要在 CI 中覆盖。
  3. 若确实匹配,应在 ADR 或 CONTEXT.md 中记录这一例外,而不只写在拉取请求描述里。

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.

已处理:57a60d5 恢复 Windows test 模式的原有行为:生成的测试后端配置不写 cloud.license.url,production 模式继续写正式服务地址;社区测试、贡献指南和发布说明已同步。

Comment thread CONTRIBUTING.zh-CN.md Outdated

每次推送到 `main` 都发布一个日常预发布版本 `A.B.C-dev.<年月日>`,北京时间同一天的后续构建依次加 `.2`、`.3`。推送 `vA.B.C-rc.N` 或 `vA.B.C` 标签会发布候选版本或正式版本;必须先在 `OpenTest-Plugins` 创建同名标签,缺失时构建立即失败,不回落到 `main`。日常构建、拉取请求和手动运行都使用插件仓库的 `main`;手动运行不能指定任意插件版本,标签运行必须使用同名插件标签。三个平台直接检出解析得到的同一提交,并再次核对,防止构建期间分支前移。全部构建及安装验证通过后,单一发布任务先上传三个安装包及各自的 SHA-256 文件校验值,再公开版本。

面向 `main` 的拉取请求若修改工作流中列出的打包脚本、`tools/__tests__/**`、`tools/ci/**`、`default-plugins.json`、`packaging.config.json`、`apps/**`、`sdks/**`、`vendor/**`、`package.json` 或 `pnpm-lock.yaml`,会触发三平台构建和安装验证,但不发布。本工作流有意将应用、软件开发套件和运行材料变更纳入三平台验证范围。`package.json` 保留用于插件兼容性的 `A.B.C`,完整版本号通过 `node tools/package.mjs --version` 传入;工作流使用 `--edition community`。

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 问题:文档列出的触发路径与工作流实际配置不一致。

  • 文档称修改 apps/**、sdks/**、vendor/**、package.json、pnpm-lock.yaml 会触发三平台构建。
  • 但 tools/__tests__/community-package.test.mjs 第 28-33 行用 deepEqual 断言 pull_request.paths 只包含工作流文件、default-plugins.json、packaging.config.json 和若干 tools/ 路径,不含上述目录。
  • 这说明工作流并不会因这些路径触发。否则该测试本身会失败。

建议: 二者择一保持一致。要么让中英文文档与工作流的 paths 一致;要么把这些路径加入工作流,并同步更新测试。

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.

已处理:57a60d5 已将中文版贡献指南的触发路径改为与工作流和测试完全一致。

Comment thread CONTRIBUTING.md Outdated

Each push to `main` publishes a daily prerelease `A.B.C-dev.<yyyymmdd>`; later builds on the same Beijing day add `.2`, `.3` and so on. Pushing `vA.B.C-rc.N` or `vA.B.C` publishes a release candidate or release. First create the same tag in `OpenTest-Plugins`: a missing tag fails the build instead of falling back to `main`. Daily builds, pull requests, and manual runs use the plugin repository's `main`; manual runs cannot select an arbitrary plugin revision. Tag runs require the matching plugin tag. All three platforms check out the same resolved commit directly and verify it again, so a moving branch cannot change the build inputs. After every build and installation check succeeds, one publishing job uploads three installers and their SHA-256 checksum files before making the release public.

Pull requests targeting `main` trigger all three builds and installation checks, without publishing, when they change the packaging scripts listed in the workflow, `tools/__tests__/**`, `tools/ci/**`, `default-plugins.json`, `packaging.config.json`, `apps/**`, `sdks/**`, `vendor/**`, `package.json`, or `pnpm-lock.yaml`. This workflow intentionally includes application, software development kit and runtime material changes in its three-platform validation scope. `package.json` keeps the plain `A.B.C` used for plugin compatibility; the full version is passed to `node tools/package.mjs --version`. The workflow uses `--edition community`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 问题: 与中文版相同,这里列出的 apps/**、sdks/**、vendor/**、package.json、pnpm-lock.yaml 不在工作流的 pull_request.paths 中。测试也断言 paths 列表不含这些路径。

建议: 请与工作流和测试保持一致。

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.

已处理:57a60d5 已将英文贡献指南的触发路径改为与工作流和测试完全一致。

Comment thread tools/ci/ensure-delivery-manifest.mjs Outdated
const manifest = {
version, productVersion: version.replace(/-(?:dev|rc)\..*$/, ''), edition, mode,
platform, arch: target.arch, signed: false, notarized: false,
bundledPlugins: [], automaticUpdate: platform !== 'linux',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 问题:生成的交付清单内容与实际交付物不符。

  1. automaticUpdate 取值错误。 automaticUpdate: platform !== 'linux' 会让 macOS 清单记为 true。但 CI 生成的 local-settings 关闭了自动更新,验证脚本也断言 updates.enabled === false。
  2. bundledPlugins 为空。 实际上随附了 fft-tools,SonoDAQ 也已暂存,空数组会误导后续使用该清单的人或工具。
  3. 校验遗漏字段。 校验已有 delivery.json 的分支不检查这两个字段,同样的错误会被直接放行。

建议:

  • automaticUpdate 固定为 false,或从生成的设置中读取。
  • 无法可靠得到插件列表时,不要写入看似权威的空数组。
  • 打包器已生成清单时,也校验 automaticUpdate。

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.

已处理:57a60d5 将 automaticUpdate 固定为 false;打包器和后置清单校验同步修改。随包插件从实际暂存材料发现并写入清单,已有清单也会核对该字段和插件列表。

assert.deepEqual(ensureDeliveryManifest({ root, platform: 'linux', version: '2.5.0-dev.20261117' }), existing);
});

test('清单步骤拒绝缺失、重复、错误命名或已篡改清单', t => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题一:标题与用例内容不符。 标题称会拒绝“已篡改清单”,但用例只覆盖了名称错误和安装包重复,没有覆盖以下情形:

  • 已有 delivery.json 的 sha256 或版本与实际不一致。
  • 安装包目录缺失。

问题二:该测试文件未在 CI 中运行。 version 任务和 Windows build 任务显式列出了要运行的测试文件,其中不包括 ensure-delivery-manifest.test.mjs。

建议: 补充上述用例,并把该文件加入某个测试步骤。

Comment thread tools/ci/stage-posix-device-plugin.mjs Outdated
const target = resolvePackagingPlatform(process.env.PACKAGE_PLATFORM);
assertPackagingPlatformReady(target);
if (!['mac', 'linux'].includes(target.platform)) throw new Error('此入口只构建 Linux/macOS 设备插件');
const temp = process.env.RUNNER_TEMP;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题:脚本依赖 CI 环境变量,没有回退。

  • 直接使用 process.env.RUNNER_TEMP。本地未设置时,path.join(undefined, ...) 会抛出 TypeError,报错与原因无关。
  • NATIVE_PLUGIN_BIN(第 33 行)同样没有检查。
  • 描述称“本地缺少 RUNNER_TEMP 时使用系统临时目录”,但只有 prepare-electron.mjs 实现了这一回退。

建议: 统一回退到 os.tmpdir();必需的环境变量缺失时,给出明确的错误信息。

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.

已处理:57a60d5 使用 RUNNER_TEMP || os.tmpdir(),并在 NATIVE_PLUGIN_BIN 缺失时给出明确错误。

@JohnWuY
JohnWuY merged commit ea0c3c4 into main Nov 17, 2026
22 of 27 checks passed
@JohnWuY
JohnWuY deleted the ci/community-multiplatform-package branch November 17, 2026 09:20
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