Repository navigation
fix(ci): align plugin acceptance and backend concurrency checks - #30
xiaopingshao wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
AI 代码审查(claude-opus-5-5)
整体方向合理:测试从“整批候选进入 RECOVERY”改为“隔离失败插件、其余继续可用”,与 CONTEXT.md 中“工作区部分可用”的术语一致;import 清理符合 AGENTS.md 的 Java 类型引用规范。主要问题有三处:
ConcurrentFileManager的改动缺少依据。 新增的writeAdmissionMonitor没有改变任何可观察行为,配套的新测试在改动前的实现上同样能通过,无法证明修复了什么。- CI 步骤尚未在 Windows 上验证。 插件仓库自身的依赖可能缺失。
- 合入后
backend-tests仍然会失败。 描述已说明 crydaq-service 有 111 个断言失败和 195 个错误,而--fail-at-end会让整个 job 失败。如果该检查是必需检查,本 PR 无法单独合入;建议在描述中写明合入顺序,或说明与 #29 的依赖关系。
其他需要确认的地方:
- 未使用的 import。
InstalledContentDevelopmentProcessTest.findPluginsRepository删除了对assertNotNull的调用。如果文件里是显式静态导入assertNotNull,且已没有其他用途,按 AGENTS.md 应一并移除。diff 未展示 import 区,无法确认。 - 插件仓库的固定提交需要同步维护。 工作流把插件仓库固定在
c8e62659…。宿主 SDK 或插件开发 CLI 的接口变化后需要同步更新这个提交,建议在工作流中加注释说明更新时机。 - 工作流修改需要额外审查。 按 CONTRIBUTING 的要求,本 PR 需要 CODEOWNERS 指定的维护者审查。
由 AI 自动生成,仅供参考,不作为合并依据。审查提交:
8d1a48a。维护者可评论/review重新审查。
| // owns its existing completion; otherwise reject and let the caller release it. | ||
| if ((!acceptingWrites.get() || executor.isShutdown()) && executor.remove(task)) { | ||
| throw new RejectedExecutionException("fileManager is shutting down"); | ||
| synchronized (writeAdmissionMonitor) { |
There was a problem hiding this comment.
🟠 中 新增的监视器没有改变语义。
改动后的分支逻辑与原来的 if ((!accepting || isShutdown) && remove) throw; return; 完全等价,唯一区别是检查期间持有 writeAdmissionMonitor。
这把锁不能带来更强的保证,原因如下:
beginManagerClose在设置acceptingWrites=false后立即释放该锁,随后才执行 shutdown 或清空队列。acceptingWrites本身就是原子变量。- 任务归属已经由
executor.remove(task)与 worker 取出或 drain 之间的原子性决定。
因此无论生产者先拿到锁还是关闭线程先拿到锁,结果都与无锁时相同。
另一方面,这个改动引入了 writeAdmissionMonitor → fileConsumerMonitor 的嵌套加锁顺序。之后如果有路径在持有 fileConsumerMonitor 时调用 beginManagerClose,或提交写任务,就会出现锁顺序反转。
建议:
- 在 PR 中说明这把锁要消除的具体交错序列,并补一个在旧实现上会失败的测试;
- 如果说明不了,就去掉
writeAdmissionMonitor,保持原实现,避免增加锁复杂度。
| @Override public void onCompleted(Data data, Throwable failure) { } | ||
| }, failure -> { }); | ||
|
|
||
| handler.rejectedExecution(task, worker); |
There was a problem hiding this comment.
🟠 中 这个测试不能作为回归测试。
把它放到改动前的实现上运行:
- offer 成功后
isShutdown()返回 true; remove()返回 false;- 旧代码同样不抛异常,直接返回。
所以它在旧代码上也能通过,无法证明生产代码的改动修复了什么。
此外,模拟本身前后不一致:remove() 固定返回 false,表示任务已被 worker 取走,但任务实际仍留在队列里,随后又由测试手动 poll 并 run。“没有被丢弃”这一点是测试代码自己保证的,并不是被测对象保证的。
测试还通过反射读取私有字段 fileExecutors,字段重命名时会在运行期才失败。
**建议:**改为驱动真实的 close 与阻塞 admission 竞争,并断言 completion 恰好触发一次、调用方没有重复释放。
| run: | | ||
| corepack enable | ||
| corepack prepare pnpm@10.6.5 --activate | ||
| pnpm install --frozen-lockfile |
There was a problem hiding this comment.
🟠 中 插件仓库的依赖可能没有安装。
这一步只在宿主仓库根目录执行了 pnpm install,检出到 .ci/OpenTest-Plugins 的插件仓库没有安装依赖。验收测试会调用插件仓库的 tools/dev.mjs。如果它或它触发的插件前端构建依赖插件仓库自己的 node_modules(例如构建工具),那么在 CI 的干净检出中会失败。本地验证通过,很可能是因为同级仓库已经装好了依赖。描述也说明 Windows 远程验证尚未完成。
建议:
- 确认
dev.mjs是否只依赖 Node 内置模块和宿主产物; - 如果不是,增加一步:
pnpm install --frozen-lockfile --dir .ci/OpenTest-Plugins(或进入该目录执行),并让 CI 实际跑通一次后再合入。
| try (PluginRuntime runtime = runtime(a, b)) { | ||
| assertEquals("RECOVERY", runtime.candidate().path("status").asText()); | ||
| assertEquals("BACKEND_CORE_READY", runtime.candidate().path("status").asText()); | ||
| assertIsolated(runtime, b); |
There was a problem hiding this comment.
🟡 低 测试固定了“先到者保留、后到者隔离”的规则,但没有锁定判定依据。
org.test.a 与 org.test.b 同时满足以下两个条件:
- 安装顺序在前;
- 插件 ID 字典序在前。
因此测试无法区分实际规则是按安装顺序、按 ID 排序,还是依赖目录遍历顺序。如果是最后一种,测试在不同文件系统上可能不稳定。
建议:
- 调整构造,让安装顺序与 ID 顺序相反,从而锁定预期规则;
- 在 ADR 或设计记录中写明重复 Provider 时保留哪一方。
duplicateResultAlgorithmAcrossProvidersIsolatesThePlugin 存在同样的情况。
| Path repository = current == null ? null : current.resolveSibling("opentest-plugins"); | ||
| assertNotNull(repository, | ||
| "跨仓验收需要 -Dopentest.plugins.repository=<opentest-plugins> 或宿主同级插件仓库"); | ||
| Path repository = findHostRepository().resolveSibling("OpenTest-Plugins"); |
There was a problem hiding this comment.
🟡 低 去掉了原来的回退查找逻辑。
新逻辑只认同级目录 OpenTest-Plugins,且大小写敏感。在 Linux 等大小写敏感的文件系统上,原先按 opentest-plugins 小写命名克隆的开发者会直接失败。
同时,这里没有读取 CONTEXT.md 规定的插件源码根环境变量 OPENTEST_PUBLIC_PLUGINS_SOURCE,与宿主其他位置的定位规则不一致。
**建议:**按以下顺序依次查找:
- 系统属性;
OPENTEST_PUBLIC_PLUGINS_SOURCE;- 同级
OpenTest-Plugins。
There was a problem hiding this comment.
AI 代码审查(claude-opus-5-5)
整体方向合理:把运行时测试从“可选插件失败导致全局 RECOVERY”改为“隔离失败插件、工作区部分可用”,与 CONTEXT.md 中的工作区部分可用及插件管理语义一致;LimitXAxis 夹具和 protobuf 描述符期望也已按当前 API 更新。描述如实说明了 crydaq-service 仍有大量失败、合入后 backend-tests 仍不会变绿,这一点清楚。
需要关注的问题:
- CI 中间步骤失败会被吞掉。
pwsh多行脚本中间的原生命令失败不会让步骤失败,见行内意见。 - 跨仓库验收依赖可能不完整。 插件仓库检出后没有安装它自己的依赖,验收能否在 CI 中运行仍需确认。
- 并发修复没有回归测试。
ConcurrentFileManager的修改与原条件在逻辑上等价;新增测试在旧实现上同样会通过,无法证明修复的竞态已被覆盖。 - 插件仓库固定在提交 SHA。 建议在工作流中注释说明更新时机,例如插件 SDK 或 CLI 接口变化、与发布标签同步时,避免长期与插件仓库主线脱节。
- 修改了工作流文件。 按 CONTRIBUTING 要求,需要 CODEOWNERS 指定的维护者审查。
由 AI 自动生成,仅供参考,不作为合并依据。审查提交:
bbf892d。维护者可评论/review重新审查。
| node-version: 22 | ||
| package-manager-cache: false | ||
| - name: Prepare frontend acceptance dependencies | ||
| run: | |
There was a problem hiding this comment.
🟠 中 这个 job 使用 pwsh。GitHub Actions 只会在脚本末尾检查最后一个命令的 $LASTEXITCODE。$ErrorActionPreference = 'stop' 对原生命令的非零退出码不起作用,所以 corepack enable、corepack prepare 或 pnpm install --frozen-lockfile 失败后,脚本仍会继续执行。最终结果只取决于 pnpm build:sdk,真实的失败原因会被掩盖,甚至可能在部分依赖缺失时继续进入 Maven 阶段。
建议在脚本开头加入 $PSNativeCommandUseErrorActionPreference = $true(PowerShell 7.3+),或在每条命令后检查 if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }。
| @Override public void onCompleted(Data data, Throwable failure) { } | ||
| }, failure -> { }); | ||
|
|
||
| handler.rejectedExecution(task, worker); |
There was a problem hiding this comment.
🟠 中 这个测试在修改前的实现上同样会通过。在该场景中,acceptingWrites 为 true,offer 后 isShutdown() 变为 true,remove 返回 false。旧条件 (!accepting || isShutdown()) && remove(task) 结果为 false,不抛异常,直接 return;新代码走的也是 return。另外,测试完全没有调用 beginManagerClose,也没有涉及新增的 writeAdmissionMonitor。因此它无法作为本次并发修复的回归测试。
建议补充一个能区分新旧实现的测试:用闩锁让生产者停在 offer 成功之后、条件检查之前,然后并发调用 close()/closeNow(),断言任务恰好被执行一次,或被拒绝并释放一次,不会重复完成,也不会泄漏。
| // owns its existing completion; otherwise reject and let the caller release it. | ||
| if ((!acceptingWrites.get() || executor.isShutdown()) && executor.remove(task)) { | ||
| throw new RejectedExecutionException("fileManager is shutting down"); | ||
| synchronized (writeAdmissionMonitor) { |
There was a problem hiding this comment.
🟡 低 新的同步块与原来的单行条件在判定结果上等价。它额外提供的唯一保证是:在“检查标志”和 remove(task) 之间,beginManagerClose 不能翻转 acceptingWrites。但如果翻转发生在这个窗口内,任务只是留在队列里,由关闭流程处理。这与翻转发生在检查之后、return 之前的情况相同,而后一种情况仍然存在。同时,关闭流程对队列的清空和 shutdown 似乎发生在 beginManagerClose 释放锁之后,不受这把锁保护。
请在代码注释或 PR 描述中说明这把锁具体消除了哪条交错路径。如果确实存在问题,也请补充对应测试(见测试文件中的意见)。另外,原来解释任务所有权的注释被删掉了,建议保留,便于后续维护者理解“任务已被 worker 取走时由其负责完成”的约定。
| - uses: actions/checkout@v7 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Checkout plugin development CLI for cross-repository acceptance |
There was a problem hiding this comment.
🟡 低 插件仓库只做了检出,没有安装它自己的依赖。如果 tools/dev.mjs 或它调用的打包流程会导入插件仓库自身的 npm 依赖,CI 中的跨仓库验收会因缺少 node_modules 失败,而本地验证时这些依赖通常已经装好。请确认 CI 下该验收确实能运行。如果需要依赖,应在 .ci/OpenTest-Plugins 中执行 pnpm install --frozen-lockfile。另外,检出目录位于工作区内,请确认它不会被根目录的 pnpm workspace 或其他检查扫描到。
| System.setProperty("os.name", "Darwin"); | ||
| loader.loadDlls(); | ||
| nativeLoading.verify(() -> NativeLoader.loader(library.toString()), times(1)); | ||
| String expectedPath = nativeDirectory + File.separator + "nested/library.dylib"; |
There was a problem hiding this comment.
🟡 低 期望值从 library.toString() 改成了手工拼接的 nativeDirectory + File.separator + "nested/library.dylib"。这是在固化实现中的字符串拼接方式,而不是验证路径语义:在 Windows 上运行这个 Darwin 分支测试时,会得到 ...\nested/library.dylib 这样混用分隔符的路径。PR 描述也没有说明这项改动的原因。
如果改动是因为 macOS 临时目录的符号链接,建议像其他测试一样在用例开头对临时目录执行 toRealPath(),期望值继续使用 library.toString()。如果实现确实应输出这种格式,请在描述中说明。
| Path repository = current == null ? null : current.resolveSibling("opentest-plugins"); | ||
| assertNotNull(repository, | ||
| "跨仓验收需要 -Dopentest.plugins.repository=<opentest-plugins> 或宿主同级插件仓库"); | ||
| Path repository = findHostRepository().resolveSibling("OpenTest-Plugins"); |
There was a problem hiding this comment.
🟡 低 回退逻辑从“向上查找 opentest 目录的同级 opentest-plugins”改成了 findHostRepository().resolveSibling("OpenTest-Plugins")。默认目录名与 CONTEXT.md 中的 ../OpenTest-Plugins 一致,但仍有两点需要处理:
- 原代码对
null有显式断言;如果findHostRepository()可能返回null,现在会直接抛出 NPE。 - 在大小写敏感的文件系统上,原先使用小写
opentest-plugins同级目录的开发者,会在没有提示的情况下改走失败路径。
建议同时支持 CONTEXT.md 中的 OPENTEST_PUBLIC_PLUGINS_SOURCE 环境变量,与源码构建的约定保持一致。
| assertFalse(runtime.ready()); | ||
| assertEquals("APP_READY", runtime.candidate().path("status").asText()); | ||
| assertTrue(runtime.ready()); | ||
| assertEquals("failed", runtime.snapshot(false).path("plugins").get(0).path("status").asText()); |
There was a problem hiding this comment.
🟡 低 snapshot.plugins.get(0) 假定快照中只有这一个插件。如果快照以后包含内置 Monitor 或其他条目,这里会断言到错误的插件。建议按 pluginId 查找目标条目,或复用 DashboardProviderRuntimeTest 中的 assertIsolated 风格。另外,同一失败契约在三个测试中分别通过 pluginFailures[id]、failedPlugins[0].lastError 和 plugins[0].lastError 三种结构断言,建议确认这几种快照结构都是对外稳定契约。
…#29) Restore the macOS ARM64 runtime from the Windows-matched historical algorithm baseline `46a640bdc6d019ec4a51dbdef7f675d1c5700b06`: production FFTC libraries and the original default license at the backend platform root, without `prd` or a test-runtime payload. Frontend POSIX loading and packaging use the same FFTC layout. Existing Java entry points delegate to the neutral native exports; Windows payload files are unchanged. Review fixes in fd52282: - Reject macOS non-production staging and missing/empty root licenses, with regression tests. - Cover all 33 Java compatibility/native signature pairs. Generate JNI declarations with javac, including generic/multiline methods, overloads and escaped identifiers; verify actual exports and run the real JVM smoke via one documented entry point. - Preserve the seven legacy log-message strings while retaining SDK-compatible enum identifiers. - Record the complete algorithm patch at fixed private NativeDriver merge commit 92982a31, with SHA256 and replay instructions. Keep the detached/dirty source record truthful. - Limit SHA256SUMS to runtime binaries and License.dat; validate algorithm metadata separately. - Correct the FFT dependency failure test to select the configured platform library without changing Linux binaries or its FFT backend. Current local macOS validation: - Algorithm runtime: 227 tests passed, including 33 binding cases. - Frontend native addon: 45 passed. - Packaging/license: 35 passed, one case-sensitive-filesystem test skipped. - Verifier regressions: 2 passed. - Eight ARM64 dylibs load; all 323 javac-generated backend JNI exports match. Windows algorithm exports: 148/148 static PE matches, not Windows execution. - Real JVM -Xcheck:jni: original default license imports; FFT returns expected feature-denied 13300010; license state releases in finally. - Seven legacy log-message strings checked by a compiled C++ probe; framework boundary guard passed. No hardware or full licensed FFT acceptance claimed. Owner confirmations still requested in the two open review topics: 1. JNI/framework owner: Windows and macOS evidence is supplied. No Linux backend payload is present; shared POSIX NativeDriver sources use the same neutral names, but externally supplied Linux binary compatibility remains unverified. Confirm the acceptable scope; this PR does not implement Linux delivery. 2. Authorization/product-release owner: confirm the signed initial device001 machine-match exception and default community FFT feature-denial behavior. The full patch is traceable; no SKU restriction or additional entitlement bypass has been silently introduced. macOS and Windows default license JSON payload/signature are equal (trailing newline differs). Core minimum macOS is 12. SonoDAQ SDK 1.4.0 requires macOS 26 and is delivered separately by crysound/OpenTest-Plugins#4. Its prior 14/14 result and generated local package depended on shared runtime fixes now withdrawn; they are not current-branch acceptance/release artifacts. Unrelated shared CI/runtime fixes were withdrawn in f4cd7ac and #30 is closed. No workflow changes remain. Windows frontend/backend tests are informational under the currently active main rules; docs-policy, CodeQL rules, two designated-team approvals and resolved discussions remain required. No merge or approval bypass is requested. Refs #28 Companions: crysound/OpenTest-NativeDriver#1 (merged), crysound/OpenTest-Plugins#4. --------- Co-authored-by: xiaopingshao <25676237+xiaopingshao@users.noreply.github.com>
Withdrawn: the user requested that the macOS delivery retain only changes required by that delivery. This standalone shared CI repair proposal is out of scope and will not be merged as part of the macOS work. Its commits have been reverted from #29. Existing main failures require separate triage by the responsible maintainers. The branch is retained for traceability.
Refs #28