Skip to content

fix(ci): repair deterministic main baseline failures - #22

Merged
JohnWuY merged 28 commits into
mainfrom
fix/main-ci-baseline-20261116
Nov 19, 2026
Merged

JohnWuY merged 28 commits into
mainfrom
fix/main-ci-baseline-20261116

Conversation

@mingtaojin

@mingtaojin mingtaojin commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Why

Bring PR22 in line with the current main baseline and remove deterministic Windows and frontend CI failures. This PR is broader than the earlier ChannelCursor and FileSelect-only description. It includes the baseline repairs already present on the branch and the runtime changes they require.

Current refs

  • Base: main@b50ac07465bde504e35298d25cbacf7d1c80f879
  • Head: fix/main-ci-baseline-20261116@a9f30cf

Backend runtime changes

  • ChannelCursor closes the first shard reader when constructor-time validation or loading fails.
  • GraphicConfigService validates retained provider members, initializes axes when planning the first member, and opens unit-query scopes for standalone projections. Monitor Math saves and unit refreshes preserve independent binding rows.
  • Monitor can replay audio-only recordings that lack the optional CAN input service.
  • ProjectService accepts omitted legacy result-limit lists during import.
  • ReferenceTestProjectionContextResolver and ReferenceTestExecutionPlanner use active BK CPB shared-input declarations and ignore dormant legacy snapshots.
  • BuiltInFftSignalAnalysisProvider and BuiltInOctaveSignalAnalysisProvider handle BK FRF and reference-test result paths, including the single-channel cross-spectrum case. Mixed BK FFT requests use shared calibrated inputs for ordinary results and the stored unit plan for reference/test results.
  • DefaultBoxExecutionSession avoids duplicate default unit metadata when the prepared unit already matches the result unit.
  • FrozenHistoricalArtifactFactResolver restores time-window identity from frozen configuration when the persisted identity is incomplete.

Frontend runtime changes

  • use-grpc-exec.ts distinguishes the single-value time-history case by the available value count before adding stamped points.
  • tr-TR.ts applies the Turkish measurement supplement after the English base messages so supplied Turkish strings take effect.

These are product behavior changes, not test-only changes. The locale merge remains a shallow merge and requires the supplement namespaces to be complete.

CI and test changes

  • Server test dependencies use Mockito 5.24.0 to fix handler lookup when inline and subclass mocks share a test process.

  • The Monitor HTTP and SQLite mutation suite runs in Maven Failsafe and loads the built-in plugin from the packaged artifact. Monitor fixtures preserve CAN catalog entries and supply the Math planner where the host prepares and reads results.

  • A SQLite regression test verifies that a failed project transaction refreshes only device-confirmed channel changes.

  • The frontend CI license variables are scoped to the unit-test step.

  • Backend CI skips the external Crowdin download because the Windows test runner does not provide the Crowdin CLI or credentials. The Maven property is quoted for PowerShell so Maven receives the full property name.

  • Backend and frontend fixtures now match the current platform and service contracts, including Windows paths, file: URIs, HDF5 reopen behavior, schema fixtures, plugin failure isolation, reference-result units, report navigation, numeric input event ordering, and locale expectations.

  • The report-navigation and numeric-input tests changed on this branch. The PR no longer claims that those areas are frozen.

  • The Standard Signal Chain test tracker now uses atomic lease references because two pipeline branches can release the same pooled array concurrently.

  • ConcurrentFileManager retains the remove-result ownership rule and the shutdown drain completes queued tasks exactly once. Existing latch tests cover the worker-consumed and shutdown-drained races.

  • The CAN editor tests wait up to five seconds for asynchronous DBC parsing and port discovery under the full CI worker load.

  • The Windows device protocol test now stubs the platform-native active-library path.

  • The HDF5 export test verifies the Unicode output bytes and reopens an ASCII inspection copy because the Windows native HDF5 reader cannot reliably reopen the Unicode path.

  • The CAN startup failure test waits for the asynchronous failure stop and asserts a failed stop rather than an elapsed-time success.

  • Server tests resolve SQL, YAML, and migration fixtures from Maven's module base directory instead of assuming the repository root is the working directory.

  • Tests that require an unavailable real Native license, external business plugin, or unavailable internal plugin fixture were removed from the server unit suite. Mocked Native boundary tests remain.

Verification

  • GitHub Actions passed frontend checks, CodeQL, and docs policy for the previous PR head e081498.
  • The Windows backend check on that head reported 17 server unit-test failures. The follow-up changes target the Mockito and Monitor class-loading causes.
  • Java 21 on macOS passed the full Maven verify for a9f30cf. 8,825 tests passed, including all 55 packaged integration tests. Maven skipped 57 tests.
  • GitHub Actions passed both frontend checks and Windows backend tests for a9f30cf. See CI run 44502956313.
  • The AI review workflow for a9f30cf returned HTTP 524. The second attempt was canceled.

Risk and review notes

This PR changes measurement execution, provider unit declarations, historical result identity, BK FRF result production, locale merging, and CI test authorization scope. Review those runtime changes separately from the fixture-only updates. The branch contains focused regression tests.

No merge or deployment has been performed.

Refs #21.

@mingtaojin
mingtaojin requested a review from a team November 15, 2026 17:43
@mingtaojin
mingtaojin requested a review from a team as a code owner November 15, 2026 17:43

@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)

本 PR 主要修复 main 上确定性的 CI 基线失败。时区、Windows 路径、protobuf 兼容期望和 mock 补全等测试侧调整总体合理。需要重点关注以下几点。

  1. ConcurrentFileManager 的并发修复改变了任务归属语义。 新逻辑在 remove 失败时仍然拒绝任务,可能导致资源被重复释放,或在使用中被释放。新增的同步也没有覆盖 shutdownNow,与注释描述不符。改动中也没有覆盖该竞态的新测试。
  2. 报告入口的测试期望被改写。 新期望不再携带当前测量工作区上下文,可能与 CONTEXT.md 中“顶部报告绑定当前活动测量工作区”的规则冲突。需要确认这是产品决策,而不是用测试迁就回归。
  3. 混入了产品行为改动。 标题是 fix(ci),但 tr-TR.ts 的覆盖顺序、use-grpc-exec.ts 的长度判断都属于产品行为改动,且没有对应的行为测试。建议在描述中单独说明,或拆分 PR。

其他意见:PR 描述列出 ConcurrentFileManagerBlockingExportTest 作为验证,但本次 diff 中没有该测试的新增或修改。请确认已有用例是否真的覆盖“offer 成功后任务已被工作线程取走或被 shutdownNow 排空”的路径。

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

// has already claimed it from the queue.
synchronized (writeAdmissionMonitor) {
if (!acceptingWrites.get() || executor.isShutdown()) {
executor.remove(task);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 问题

新逻辑忽略了 executor.remove(task) 的返回值,只要检测到关闭就抛出 RejectedExecutionException。旧注释明确约定:任务若已被消费或丢弃,就由其已有的完成路径负责收尾。remove 失败可能对应两种情况:

  • 任务在 offer 成功后、进入同步块前,已被工作线程取走并开始执行;
  • 任务已被 shutdownNow 从队列中排空,由关闭流程统一完成。

这两种情况下,调用方收到拒绝后都会释放 borrow,从而出现重复释放,或在任务仍在使用资源时提前释放。

建议

恢复“仅当 remove(task) 成功时才拒绝”的条件,即 if ((!acceptingWrites.get() || executor.isShutdown()) && executor.remove(task))。如果确实存在 shutdownNow 排空后无人完成的漏洞,应在关闭流程中完成被排空的任务,而不是让调用方无条件释放。同时补充确定性测试,覆盖“已被工作线程取走”和“已被 shutdownNow 排空”两条路径,并断言每个 borrow 只释放一次。

// Close may win while offer is waiting. Serialize the final admission
// decision with close so a task cannot be accepted after shutdownNow
// has already claimed it from the queue.
synchronized (writeAdmissionMonitor) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 问题

注释称本次修改能“与 close 串行化最终准入决策,确保任务不会在 shutdownNow 已从队列取走它之后被接受”。但 beginManagerClose() 只在持有 writeAdmissionMonitor 时设置标志位,shutdownNow 很可能在释放锁之后才调用。因此存在以下时序:

  1. 本线程在同步块内看到 acceptingWrites == true,于是 return;
  2. 随后 close 开始,shutdownNow 排空该任务。

这与旧实现的行为相同,新增的锁并没有解决注释所描述的问题,反而带来了上一条所述的重复释放风险。

建议

二选一:

  • 把 shutdownNow 及其对排空任务的处理也纳入同一把锁;
  • 或者修正注释,并说明这把锁实际保证的范围。


expect(mocks.trigger).toHaveBeenCalledWith('project:open-report', 'octave')
expect(mocks.push).not.toHaveBeenCalled()
expect(mocks.push).toHaveBeenCalledWith({ name: 'Report', params: { projectId: '100' }, query: {} })

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 问题

原期望是在 Measure 页通过 project:open-report 事件携带当前 benchType(octave)打开报告;新期望改为 push({ name: 'Report', params: { projectId }, query: {} }),丢失了当前测量工作区上下文。CONTEXT.md 规定:“顶部报告绑定当前活动测量工作区的 dashboard 和 scene,不扫描其他仪表盘代替当前报告”。

此外,同一用例仍断言 Measure 标签为 is-active,而 push 已被 mock,这条断言无法证明“未切换标签”。

建议

确认组件行为变化是经过批准的产品决策,而不是回归:

  • 如果是回归,应修组件而不是改测试;
  • 如果是有意变更,请在 PR 描述中说明,并断言路由携带了绑定当前 dashboard/scene 所需的参数。

await wrapper.get('[data-testid="project-module-tab-report"]').trigger('click')

expect(mocks.warning).toHaveBeenCalledWith('project.pleaseCompleteTheTest')
expect(mocks.push).toHaveBeenCalledWith({ name: 'Report', params: { projectId: '100' }, query: {} })

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 问题

原期望是:从 setup 页点击报告时提示 project.pleaseCompleteTheTest,且不跳转。新期望改为直接跳转到 Report。这是用户可见的行为变化,PR 描述中没有说明。另外,删除对 warning 的否定断言之后,测试已无法发现“既提示又跳转”的情况。

建议

确认这是产品决策。如果是,请补充 expect(mocks.warning).not.toHaveBeenCalled(),并在描述中写明行为变更。

export default {
...getMeasurementUiSupplement('tr-TR'),
...en,
...getMeasurementUiSupplement('tr-TR'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 问题

调整展开顺序后,getMeasurementUiSupplement('tr-TR') 会覆盖 en,这是产品文案行为的修复。但对象展开是浅合并:如果 supplement 中某个顶层命名空间(例如 feedback)只包含部分键,就会整体替换 en 中的同名命名空间。缺失的键只能依赖 vue-i18n 的 fallback,并会产生缺失键告警;如果某些键没有配置 fallback,就会直接显示为键名。

建议

二选一:

  • 确认 supplement 中每个顶层命名空间都是完整的;
  • 或者改为按命名空间深合并。

同时检查其他语言文件是否存在相同的顺序问题。

const projectedYValues = aggregateProjection.status === 'projected' ? aggregateProjection.data.yValues : yValues
const valueLength = (value: unknown): number => {
if (Array.isArray(value)) return value.length
if (ArrayBuffer.isView(value) && 'length' in value && typeof value.length === 'number') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题

valueLength 对 DataView 返回 0,因为 DataView 没有 length。原实现用 byteLength === 0 判断空值,非空的 DataView 不会被视为空。改动后,如果 projectedYValues 是非空 DataView,在 explicitTimeAppend === true 时会被直接丢弃(return true)。

这是一处生产代码的行为变化,PR 描述没有提及,也没有新增测试。

建议

二选一:

  • 确认上游不会传入 DataView;
  • 或者对非 TypedArray 的 ArrayBuffer 视图保留 byteLength 判断。

同时补充一个针对空/非空 TypedArray 的追加判定单测。

Comment thread .github/workflows/ci.yml Outdated
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: '0'
NODE_OPTIONS: --max-old-space-size=6144
OPENTEST_LICENSE_ENVIRONMENT: test

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题

OPENTEST_LICENSE_ENVIRONMENT: test 设置在 job 级别,会作用于该 job 的所有步骤。CONTEXT.md 规定测试与正式授权材料不可交叉组合。如果该 job 现在或将来包含构建、打包等会把环境写入产物的步骤,就存在误用测试授权环境的风险。

建议

把这两个变量下移到具体的测试步骤(steps[].env),把影响范围限制在测试内。

status,
statusText: String(status),
data: {},
data: status === 401 ? { code: 22, isLogin: false } : {},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题

401 响应体现在固定为 { code: 22, isLogin: false }。这说明会话失效的判定依赖特定响应体,但测试只覆盖了这一种组合。

建议

补充两个用例:

  • 401 但响应体不匹配时的行为,例如不清理会话;
  • authContext 的 revision 与当前会话不一致时,不应调用 invalidateSession。

这样可以防止会话判定条件回退。

const source = 'data:image/png;base64,AAAA'
const reportAdapter = {
component: defineComponent({}),
template: () => getFormStructure('fft'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题

测试标题写的是“using real template collection”,但 reportAdapter.template 对 GENERAL、SOUND_POWER、CAPACITOR 三种模板都固定返回 getFormStructure('fft')。参数化用例实际上没有覆盖各模板自己的表单结构,签名位置的回归可能被掩盖。

建议

按模板返回对应结构;如果做不到,请修改用例标题,如实说明使用的是固定结构。

@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)

本 PR 主要对齐测试与当前实现,但也改了三处产品代码:ConcurrentFileManager 的写入准入、use-grpc-exec.ts 的长度判断、tr-TR.ts 的合并顺序。其中 use-grpc-exec.ts 的改动在描述中没有说明。标题为 fix(ci),建议在描述中逐项写明产品代码改动及原因,或拆成独立 PR,便于审查和回移。

主要风险

  • 并发写入准入(高):拒绝路径忽略了 executor.remove(task) 的返回值。任务已被工作线程取走,或已被 shutdownNow 收走时,调用方仍会收到拒绝并释放借用,可能造成重复释放或在使用中释放。
  • 缺少并发回归测试:本次没有新增覆盖 offer、关闭、消费三方竞争的确定性测试。描述中的 5 次串行重跑不足以证明竞态已修复。
  • 锁顺序未确认:beginManagerClose 新增了 writeAdmissionMonitor → fileConsumerMonitor 的嵌套锁。请确认没有调用路径在持有 fileConsumerMonitor 时提交文件写任务,否则阻塞提交进入 writeAdmissionMonitor 后可能与关闭线程互相等待(死锁)。

其他

  • 部分测试修改把断言改成了当前行为,例如报告入口、Turkish 回退。如果当前行为本身是回归,这类修改会掩盖缺陷,需要确认其产品依据。
  • 按 CONTRIBUTING,PR 描述应使用 Refs #编号 关联对应的缺陷工单(如 PR21 的 CI 失败记录),当前缺失。

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

// has already claimed it from the queue.
synchronized (writeAdmissionMonitor) {
if (!acceptingWrites.get() || executor.isShutdown()) {
executor.remove(task);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 remove 失败时仍抛出拒绝,可能重复释放借用。

原逻辑只在 executor.remove(task) 成功时抛出 RejectedExecutionException。注释也说明:已被消费或丢弃的任务自己负责完成。新逻辑无论 remove 是否成功都会抛出。

可能出现的时序:

  1. offer 成功后,工作线程立即取走任务并开始执行;
  2. 关闭线程把 acceptingWrites 置为 false;
  3. 调用方进入同步块,看到不再接受写入,remove 返回 false,但仍抛出拒绝;
  4. 调用方释放借用,而任务仍在执行或已完成。

同样,如果 shutdownNow 已从队列取走该任务,关闭流程可能也会处理它。

两种情况都会导致重复完成或重复释放。另外,同步块只覆盖了 beginManagerClose 里的设置标志,没有覆盖 shutdownNow 的取走动作,所以无法实现注释所说的“与 shutdownNow 串行化”。

建议:

  • 保留 if (executor.remove(task)) throw ... 的语义;
  • 如确实存在借用遗漏,应在关闭路径中对 shutdownNow() 返回的任务统一完成并释放,而不是让调用方无条件释放;
  • 补充一个用 latch 控制时序的确定性测试,覆盖“已被消费”和“被 shutdownNow 收走”两种情况。

export default {
...getMeasurementUiSupplement('tr-TR'),
...en,
...getMeasurementUiSupplement('tr-TR'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 展开顺序改变后,getMeasurementUiSupplement('tr-TR') 会整体覆盖 en 的同名顶层键。

对象展开是浅合并。如果补充资源只提供某个命名空间(例如 feedback)的部分子键,en 中该命名空间的其余键会整块丢失,只能依赖 vue-i18n 的 fallbackLocale 并产生缺失警告。

改动前的问题方向相反:同名顶层键被 en 覆盖,补充翻译整体不生效。

建议:确认补充资源与 en 重叠的顶层键是否完整;否则改用深合并,例如递归合并工具或逐个命名空间合并。

i18n.global.locale.value = 'tr'
expect(translate('feedback.message.feedbackAccepted')).toBe(en.feedback.message.feedbackAccepted)
expect(translate('feedback.automatic.partial')).toBe(en.feedback.automatic.partial)
expect(translate('feedback.message.feedbackAccepted')).toBe(tr.feedback.message.feedbackAccepted)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 断言恒真,无法验证 Turkish 翻译是否生效。

tr 以 ...en 为基础。如果 Turkish 没有提供这些键,tr.feedback.message.feedbackAccepted 本身就等于英文值,断言仍会通过。

建议:

  • 断言具体的土耳其语文案,或断言 not.toBe(en.feedback.message.feedbackAccepted);
  • 确认文件顶部已导入 tr,该导入未出现在 diff 中。

await wrapper.get('[data-testid="project-module-tab-report"]').trigger('click')

expect(mocks.warning).toHaveBeenCalledWith('project.pleaseCompleteTheTest')
expect(mocks.push).toHaveBeenCalledWith({ name: 'Report', params: { projectId: '100' }, query: {} })

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 测试被改为接受一种可能违反领域约束的行为。

原测试的两条约束是:

  • 在 setup 页点击报告会提示 project.pleaseCompleteTheTest;
  • 在 Measure 页通过 project:open-report 打开当前测量的报告。

现在两处都改为直接 push 到 { name: 'Report', query: {} },没有携带当前 dashboard 或 scene 信息。

CONTEXT.md 规定“顶部报告绑定当前活动测量工作区的 dashboard 和 scene,不扫描其他仪表盘代替当前报告”。新行为看起来与这一约束不一致。

建议:确认这是已批准的产品变更(例如说明来源和对应的 ADR 或工单)。否则这是组件回归,应修复组件,而不是修改断言。

Comment thread .github/workflows/ci.yml Outdated
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: '0'
NODE_OPTIONS: --max-old-space-size=6144
OPENTEST_LICENSE_ENVIRONMENT: test

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 测试授权环境设在 job 级,作用于该 job 的全部步骤。

CONTEXT.md 规定测试与正式授权环境的材料不可交叉组合。如果该 job 同时执行构建、打包或上传产物,测试授权环境可能被写入产物。

建议:把 OPENTEST_LICENSE_ENVIRONMENT 和 OPENTEST_LICENSE_URL 移到运行测试的 step 级 env,或确认该 job 只运行测试、不产出可分发构建。

const projectedYValues = aggregateProjection.status === 'projected' ? aggregateProjection.data.yValues : yValues
const valueLength = (value: unknown): number => {
if (Array.isArray(value)) return value.length
if (ArrayBuffer.isView(value) && 'length' in value && typeof value.length === 'number') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 这是产品代码的行为变化,描述中未说明,也没有对应测试。

  • 对 DataView,'length' in value 为 false,长度会被视为 0。原逻辑按 byteLength 判断,非空 DataView 不会被跳过。
  • 其他非数组、非 TypedArray 的值(例如带 length 的类数组对象)现在也会计为 0,进而在 explicitTimeAppend 分支中被直接丢弃。

建议:

  • 明确 yValues 允许的类型;若不支持 DataView,请显式排除或记录;
  • 为空 TypedArray、单值 TypedArray 和 hasStampedPointTime 分支补充单元测试。

import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { flushPromises, mount } from '@vue/test-utils'
import { beforeEach, expect, it } from 'vitest'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 移除 enableAutoUnmount(afterEach) 后,用例挂载的组件不会自动卸载。

与 ElementPlus teleport 或全局 i18n locale 相关的状态可能在用例之间残留,导致测试顺序相关的偶发失败。

如果移除原因是全局 setup 已经启用了自动卸载(重复调用会报错),请在 PR 描述中说明。否则建议在每个用例末尾显式调用 wrapper.unmount()。

@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)

本 PR 主要对齐测试与现有实现,大部分改动属于修正测试夹具、时区敏感断言和 mock,风险较低。需要重点关注以下几点:

  1. ConcurrentFileManager 的并发修改改变了任务完成权的归属,可能导致重复释放(high)。 新增的 writeAdmissionMonitor 只让“关闭标志的设置”和“拒绝判断”有了先后顺序。offer 成功与进入同步块之间仍有窗口,工作线程可能在这段时间里取走任务,因此该改动并不能实现描述中的“串行化”。
  2. 本次 diff 中没有针对上述竞态的新增或修改测试。 描述提到的 ConcurrentFileManagerBlockingExportTest 不在改动中,无法确认它覆盖了“关闭期间工作线程已取走任务”和“关闭时队列中的任务被丢弃”这两条路径。建议补充可确定复现的测试,例如用闩锁控制工作线程取任务的时机,并断言每个借用恰好释放一次。
  3. PR 修改了生产代码,但描述没有说明。 除标题所述的测试和 CI 修复外,本 PR 还改动了 use-grpc-exec.ts 的空数据判定,以及 tr-TR.ts 的合并顺序,二者都会影响线上行为。use-grpc-exec.ts 的改动没有配套测试。
  4. 报告入口的测试期望被整体翻转。 这类改动不是单纯的“陈旧断言”,它固化了一项产品行为变更,需要确认该变更符合 CONTEXT.md 中“顶部报告绑定当前活动测量工作区”的约束。

其余改动方向合理:CI 使用测试授权环境、protobuf 兼容性期望补齐 MathChannelErrorMsg、用本地时间构造日期以消除对时区的依赖、为 AxisRangeInput 补充 stub 等。

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

throw new RejectedExecutionException("fileManager is shutting down");
synchronized (writeAdmissionMonitor) {
if (!acceptingWrites.get() || executor.isShutdown()) {
executor.remove(task);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 问题:新代码忽略了 executor.remove(task) 的返回值,无论任务是否已被消费都会抛出 RejectedExecutionException,可能导致借用被重复释放。

原实现的注释明确说明:任务若已被工作线程取走或被丢弃,则由任务自身负责完成,调用方不应再释放。新实现存在以下竞态:

  1. offer(task, 100ms) 在同步块之外执行并返回成功;
  2. 工作线程立即 take 到该任务并开始执行,执行结束后会完成或释放借用;
  3. 另一线程在此期间执行 beginManagerClose(),把 acceptingWrites 置为 false;
  4. 当前线程进入同步块,发现已在关闭,remove 返回 false,但仍然抛出拒绝异常;
  5. 调用方按“被拒绝”的语义再释放一次借用,造成双重释放或计数错误。

writeAdmissionMonitor 无法消除这个窗口,因为 offer 和工作线程取任务都不在该锁的保护范围内。

建议:

  • 为任务引入一次性的完成权,例如 AtomicBoolean claimed。工作线程开始执行前先 CAS 抢占,拒绝路径也必须 CAS 成功后才抛出拒绝异常。
  • 或者保留按 remove 返回值判断的逻辑,同时在 close 中对 shutdownNow() 排出或丢弃的任务统一执行拒绝完成,以修复原本可能存在的泄漏。

无论采用哪种方案,都需要补充可确定复现该竞态的测试。


expect(mocks.trigger).toHaveBeenCalledWith('project:open-report', 'octave')
expect(mocks.push).not.toHaveBeenCalled()
expect(mocks.push).toHaveBeenCalledWith({ name: 'Report', params: { projectId: '100' }, query: {} })

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 这两处断言不是“陈旧断言修正”,而是把以下两项产品行为整体翻转后固化下来:

  • Measure 页: 原先通过 project:open-report 事件携带当前 benchType(octave)打开报告,现在改为跳转 Report 路由,且 query: {} 不携带任何测量工作区上下文。
  • Setup 页: 原先会提示 project.pleaseCompleteTheTest,现在直接进入报告。

CONTEXT.md 规定“顶部报告绑定当前活动测量工作区的 dashboard 和 scene,不扫描其他仪表盘代替当前报告”,且范围以 docs/顶部导航与测量交互.md 为准。空 query 意味着报告页拿不到当前测量工作区,可能违反这一约束。

建议:

  1. 确认这是已批准的产品变更,并在 PR 描述中说明;
  2. 若这是实现回归,应修复实现,而不是修改测试;
  3. 至少断言 Report 路由能够确定当前活动的 dashboard 和 scene。

if (ArrayBuffer.isView(value) && 'length' in value && typeof value.length === 'number') {
return value.length
}
return 0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 这是一处没有在 PR 描述中说明的生产行为变更,也没有配套测试。

valueLength 对非数组、非带 length 的视图一律返回 0。与旧逻辑相比有以下差异:

  • projectedYValues 为原始 ArrayBuffer、DataView,或其他非数组的非空值时: 旧逻辑不会把它当作空数据;新逻辑在 explicitTimeAppend === true 时会提前 return true,静默丢弃这一帧。
  • DataView 的旧判定: 原先按 byteLength 判断是否为空,现在非空的 DataView 也会被计为 0。

如果能确认 yValues 和 xValues 只可能是数组或 TypedArray,请把类型收紧到该范围,或对未知类型显式保留旧行为。另外请补充单元测试,覆盖空 TypedArray、非空 TypedArray 以及单值时间历史(yValueCount === 1)这几条分支。

export default {
...getMeasurementUiSupplement('tr-TR'),
...en,
...getMeasurementUiSupplement('tr-TR'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 调整顺序后,getMeasurementUiSupplement('tr-TR') 才能真正生效,修复方向正确。在此之前,同名的顶层键会被 en 整体覆盖。

需要注意,这里使用的是浅层展开。如果 supplement 只提供某个顶层命名空间的部分子键,该命名空间下 en 的其他子键会从 tr 消息中整体消失,运行时只能依赖 fallbackLocale 回退,并可能产生回退告警。

建议确认 supplement 的结构。如果它只包含部分子键,请改为按命名空间深度合并。

i18n.global.locale.value = 'tr'
expect(translate('feedback.message.feedbackAccepted')).toBe(en.feedback.message.feedbackAccepted)
expect(translate('feedback.automatic.partial')).toBe(en.feedback.automatic.partial)
expect(translate('feedback.message.feedbackAccepted')).toBe(tr.feedback.message.feedbackAccepted)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 期望值直接取自 tr.feedback.*,而 tr 本身由 ...en 展开得到。如果 tr 没有提供 feedback 翻译,tr.feedback 就等于 en.feedback,此测试会恒等通过,无法验证测试名所描述的“locale 提供了土耳其语翻译”。

建议:

  • 断言具体的土耳其语文本,或断言 tr.feedback.message.feedbackAccepted !== en.feedback.message.feedbackAccepted;
  • 确认该文件已经 import tr,当前 diff 中看不到相应的导入。

import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { flushPromises, mount } from '@vue/test-utils'
import { beforeEach, expect, it } from 'vitest'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 移除 enableAutoUnmount(afterEach) 后,如果各用例没有手动 unmount(),挂载的组件会在同一文件内残留。残留组件仍会响应后续用例对 i18n locale 的切换,Element Plus 的 teleport 节点也会留在 document.body 中,可能造成用例之间互相干扰或断言误判。

如果移除的原因是全局 setup 已经启用了 auto unmount,请在描述中说明;否则建议保留,或在每个用例中显式卸载。

System.setProperty("os.name", "Darwin");
loader.loadDlls();
nativeLoading.verify(() -> NativeLoader.loader(library.toString()), times(1));
String expectedPath = nativeDirectory + File.separator + "nested/library.dylib";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 这个期望值把实现中拼接路径的方式原样写进了测试:在 Windows 上会得到形如 dir\nested/library.dylib 的混合分隔符路径。

该测试本意是验证 Darwin 下加载 POSIX 路径。当前断言等于默认接受了生产代码在任意平台上都产生混合分隔符这一行为,以后若修正拼接方式,测试反而会失败。

建议改为比较规范化后的路径,例如 Path.of(...).normalize();或者在测试中注明混合分隔符是被有意接受的行为。

@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)

本 PR 大部分改动是修正测试夹具、时区和路径断言,以及 mock 缺失项,整体方向合理。但有两处会改变产品行为,需要重点复核:

  1. ConcurrentFileManager 的写入准入逻辑:改动删掉了原来“仅在 executor.remove(task) 成功时才拒绝”的所有权判断,可能导致借用被重复释放,或资源仍在使用中就被释放(详见行内意见)。
    • 新增的 writeAdmissionMonitor 只覆盖 acceptingWrites 的翻转。executor.shutdown/drain 仍在锁外执行,所以这把锁并不能真正把“入队后检查”与“关闭时清空队列”串行化。
    • beginManagerClose 的加锁顺序是 writeAdmissionMonitor → fileConsumerMonitor。如果有调用方持有 fileConsumerMonitor 时触发 execute,进而进入阻塞拒绝处理器,就会形成反向加锁。diff 中看不到这类调用方,请确认不存在。
    • diff 中没有新增或修改针对该竞态的回归测试。描述里提到的 ConcurrentFileManagerBlockingExportTest 在本次 diff 中没有变化,无法证明新行为正确。
  2. tr-TR.ts 的展开顺序调换:这属于产品文案行为变更,不只是测试修复。浅层展开会让补充文案整块覆盖 en 中同名的顶层对象。

其余意见:

  • CI 中测试授权环境变量的作用域偏大。
  • 401 会话失效测试只保留了满足新契约的正向路径,缺少反向用例。

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

throw new RejectedExecutionException("fileManager is shutting down");
synchronized (writeAdmissionMonitor) {
if (!acceptingWrites.get() || executor.isShutdown()) {
executor.remove(task);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 这里忽略了 executor.remove(task) 的返回值,只要处于关闭状态就无条件抛出 RejectedExecutionException。

原实现的注释写得很明确:如果任务已被工作线程取走,或已被关闭流程(如 shutdownNow 返回的列表或 drain)接管,它的完成和释放归接管方负责,生产者不能再拒绝。现在可能出现两种情况:

  • 工作线程已经在执行该任务,调用方却收到拒绝并释放借用,导致资源在使用中被释放或复用。
  • 关闭流程已经拿到该任务并完成或拒绝它,调用方又释放一次,导致重复释放。

另外,isShutdown() 和队列清空都不在 writeAdmissionMonitor 保护下,这把锁消除不了上述竞态。

建议:

  1. 保留 if (executor.remove(task)) throw ... 的语义。
  2. 如果确实要“让被拒绝的调用方释放所有排队借用”,应让关闭时的 drain 与此处的检查在同一把锁内完成,并补充覆盖“remove 失败”分支的并发测试。

export default {
...getMeasurementUiSupplement('tr-TR'),
...en,
...getMeasurementUiSupplement('tr-TR'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 调换展开顺序后,getMeasurementUiSupplement('tr-TR') 中的顶层键会整块覆盖 en 的同名对象,因为这里是浅合并。如果补充对象只包含部分子键,en 中其余子键就会从土耳其语资源中消失,运行时只能依赖 fallbackLocale 并产生缺失告警。

这是对土耳其语界面的产品行为变更,超出了“修复过期夹具”的范围。

建议二选一:

  • 确认补充对象中每个顶层键都包含完整的子键。
  • 改为按顶层键做深合并,例如 feedback: { ...en.feedback, ...supplement.feedback }。

同时补充一个测试,断言某个只存在于 en、补充对象中没有的同组键在 tr 下仍能解析。

i18n.global.locale.value = 'tr'
expect(translate('feedback.message.feedbackAccepted')).toBe(en.feedback.message.feedbackAccepted)
expect(translate('feedback.automatic.partial')).toBe(en.feedback.automatic.partial)
expect(translate('feedback.message.feedbackAccepted')).toBe(tr.feedback.message.feedbackAccepted)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 这里的期望值取自 tr.feedback...,而 tr 正是 i18n 加载的消息源本身,所以断言是同义反复:即使 tr.feedback 实际仍是展开得到的英文文案,测试也会通过,无法验证“提供了土耳其语翻译”。

建议改为以下任一方式:

  • 断言具体的土耳其语字面量。
  • 至少加上 expect(tr.feedback.message.feedbackAccepted).not.toBe(en.feedback.message.feedbackAccepted)。

另外请确认文件头已导入 tr,本次 diff 没有新增该导入。

Comment thread .github/workflows/ci.yml Outdated
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: '0'
NODE_OPTIONS: --max-old-space-size=6144
OPENTEST_LICENSE_ENVIRONMENT: test

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 OPENTEST_LICENSE_ENVIRONMENT: test 设在 job 级别,会作用于该 job 的所有步骤。按 CONTEXT.md,测试与正式授权材料不得交叉组合。

如果该 job 中有构建步骤会读取这个变量,并把它写入产物(例如通过 define 注入),就存在把测试授权环境带进产物的风险。建议把这两个变量限定在执行测试的 step 上。

it.each([false, true])('401 清理会话并拒绝原请求,不显示网络超时通知(静默:%s)', async silent => {
const transport = failingAdapter(401)
const client = api.factory('/api', { adapter: transport.adapter }, silent)
const client = api.factory('/api', {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 测试改为只覆盖“携带匹配的 authContext,且响应体为 { code: 22, isLogin: false }”的 401 正向路径,原先“任意 401 都清理会话”的覆盖随之消失。

新的会话判定契约(getSessionContext/isCurrentSession/revision)至少需要补充两类反向用例,防止过期请求误清理当前会话:

  • authContext 的 revision 已过期,或 isCurrentSession 返回 false 时,不应调用 invalidateSession。
  • 401 但响应体不是登录失效码时的处理。

System.setProperty("os.name", "Darwin");
loader.loadDlls();
nativeLoading.verify(() -> NativeLoader.loader(library.toString()), times(1));
String expectedPath = nativeDirectory + File.separator + "nested/library.dylib";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 在 Windows CI 上模拟 Darwin 时,期望值会变成 C:\...\native\nested/library.dylib 这样的混合分隔符路径。这等于把生产代码的字符串拼接方式固化进了测试。

如果这种拼接只是测试环境下的偶然结果,那没有问题。如果产品要求在 POSIX 平台使用规范路径,建议不要让测试锁定混合分隔符,可以只在非 Windows 平台运行该用例,或者改为比较规范化后的路径。

@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)

本 PR 主要修正测试夹具、断言和 CI 环境变量,这部分改动大多合理。需要重点关注以下几处非测试改动:

  1. ConcurrentFileManager 的拒绝语义有变化(高):现在只要处于关闭状态就无条件抛出 RejectedExecutionException,不再区分任务是否已被工作线程取走或被关闭流程处理。原注释明确约定这种情况下任务自己负责完成,新逻辑可能导致借用被重复释放或完成被重复触发。本次 diff 也没有新增或修改对应的并发回归测试。
  2. use-grpc-exec.ts 是生产代码改动,但 PR 描述没有提到。它改变了 yValues / xValues 判空的语义,且没有配套测试。
  3. tr-TR.ts 调整了展开顺序,会改变土耳其语资源的实际取值。顶层展开是浅合并,可能覆盖掉 en 中同名命名空间下的其他键。对应的测试断言是自比较,无法证明译文确实生效。
  4. 流程规范:描述中没有 Refs #编号 关联缺陷。分支名 fix/main-ci-baseline-20261116 不符合 fix/<编号>-<简述> 约定。请按 CONTRIBUTING.zh-CN.md 补齐。
  5. 描述中说明 macOS 上未跑通完整前后端测试套件,Windows CI 基线需要以本 PR 的实际 CI 结果为准。

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

throw new RejectedExecutionException("fileManager is shutting down");
synchronized (writeAdmissionMonitor) {
if (!acceptingWrites.get() || executor.isShutdown()) {
executor.remove(task);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 原逻辑只在 executor.remove(task) 返回 true 时才拒绝。原注释写明:已被消费或已被丢弃的任务自己负责完成,调用方不应再释放。

新逻辑忽略 remove 的返回值,一律抛出 RejectedExecutionException。如果 offer 成功后、进入同步块前,任务已被工作线程取走开始执行,或已被关闭流程(例如 shutdownNow 清空队列)接管并完成,调用方会按拒绝处理并释放借用。这样会出现两种后果:

  • 任务仍在使用已释放的资源;
  • 完成或释放被触发两次。

writeAdmissionMonitor 只保护 offer 之后的检查,不能阻止工作线程在这段窗口内取走任务。

建议:

  • 保留 if (executor.remove(task)) 的判断,只在确实移除成功时拒绝;
  • 如果描述里提到的“被拒绝调用方必须释放所有排队借用”问题出在其他路径,请单独定位修复;
  • 补充并发回归测试,覆盖“任务已被取走后才发生关闭”的场景。

export default {
...getMeasurementUiSupplement('tr-TR'),
...en,
...getMeasurementUiSupplement('tr-TR'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 调整顺序后,getMeasurementUiSupplement('tr-TR') 会覆盖 en。但对象展开是顶层浅合并:如果补充资源只提供某个命名空间(例如 feedback)的部分键,en 中该命名空间的其余键会整体丢失。运行时只能依赖 fallbackLocale 回退并产生警告,而测试中已移除对 console.warn 的屏蔽。

建议:

  • 使用深合并;
  • 或确认补充资源中每个顶层命名空间都完整覆盖 en 的对应键,并增加键完整性检查。

i18n.global.locale.value = 'tr'
expect(translate('feedback.message.feedbackAccepted')).toBe(en.feedback.message.feedbackAccepted)
expect(translate('feedback.automatic.partial')).toBe(en.feedback.automatic.partial)
expect(translate('feedback.message.feedbackAccepted')).toBe(tr.feedback.message.feedbackAccepted)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 断言 translate(key) 等于 tr.feedback...,而 tr 本身就是 en 加补充资源的合并结果。即使土耳其语译文不存在、实际回退到英文,这个断言也会通过,属于自比较,无法验证测试标题所说的“使用土耳其语译文”。

建议改为以下任一方式:

  • 断言结果不等于 en 的对应值;
  • 直接断言具体的土耳其语字符串。

const projectedYValues = aggregateProjection.status === 'projected' ? aggregateProjection.data.yValues : yValues
const valueLength = (value: unknown): number => {
if (Array.isArray(value)) return value.length
if (ArrayBuffer.isView(value) && 'length' in value && typeof value.length === 'number') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 这是 PR 描述中没有说明的生产逻辑改动,且判空语义有变化:

  • DataView:DataView 没有 length 属性,现在不论 byteLength 是多少都被视为 0 长度。在 explicitTimeAppend === true 时,帧会被直接丢弃(return true)。原逻辑只在 byteLength === 0 时才丢弃。
  • 其他类型:非数组、非 ArrayBufferView、但非空的取值(例如 protobuf 包装对象或类数组)以前不算空,现在也会被当作空并丢弃。

请说明这项改动的动机,确认 yValues 的实际类型范围,并补充针对空值和单值判定的单元测试。

status,
statusText: String(status),
data: {},
data: status === 401 ? { code: 22, isLogin: false } : {},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 401 夹具改为携带 { code: 22, isLogin: false } 后,测试不再覆盖“响应体为空的 401”。如果生产逻辑现在只在业务码匹配时才清理会话,那么不带业务体的 401(例如网关返回的 401)可能不会让会话失效。

建议补一个用例,明确空响应体 401 的预期行为,避免这次夹具调整掩盖回归。

@@ -1,13 +1,12 @@
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { flushPromises, mount } from '@vue/test-utils'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 这里移除了 enableAutoUnmount(afterEach)。如果全局 setup 没有统一启用自动卸载,各用例挂载的组件会残留到后续用例,可能造成 i18n 切换或事件监听的相互干扰。

如果移除原因是全局 setup 已经启用(重复调用会抛错),请确认这一点;否则请在用例中显式调用 wrapper.unmount()。

synchronized (fileConsumerMonitor) {
if (!closed.compareAndSet(false, true)) {
return false;
synchronized (writeAdmissionMonitor) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 beginManagerClose 引入了新的加锁顺序:先 writeAdmissionMonitor,再 fileConsumerMonitor。拒绝处理器在调用方线程中获取 writeAdmissionMonitor。

如果存在某条路径在持有 fileConsumerMonitor 时向该执行器提交写任务,并进入阻塞式准入,就会与关闭流程形成锁顺序反转,可能死锁。请确认没有这样的调用路径,或在代码中注明锁顺序约定。

@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)

本 PR 主要对齐测试夹具和断言,大部分测试侧改动合理。需要重点关注以下几处:

  1. ConcurrentFileManager 的并发语义改动风险较高。 新代码无论 executor.remove(task) 是否成功都会抛出拒绝异常。原注释明确说明,已被消费或被丢弃的任务“自己负责完成”。新逻辑可能导致同一任务的借用被释放两次,或完成被处理两次。新增的 writeAdmissionMonitor 也没有覆盖 offer 成功到进入同步块之间的竞态窗口。本次改动没有新增覆盖该竞态的测试。
  2. tr-TR.ts 调整了展开顺序,属于产品行为变更。 对象展开是浅合并,补充资源中的顶层键会整体覆盖 en 的同名对象。对应测试改成了与 tr 自身比较,无法证明土耳其语译文确实生效。
  3. use-grpc-exec.ts 是产品代码改动,但没有配套测试。 新的长度判定对非数组、非 TypedArray 的值(包括 DataView)一律计为 0,与原先的判定不完全等价。
  4. CI 授权环境变量设在 job 级别,会作用于该 job 的全部步骤。

其他说明:

  • PR 描述没有按 CONTRIBUTING.zh-CN.md 的要求用 Refs #<编号> 关联对应的 Issue,建议补充。
  • 描述中后端验证使用了 clean rebuild。按 AGENTS.md 的构建偏好,这类聚焦测试应优先使用增量构建;如确有缓存失效等原因,请在描述中说明。

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

throw new RejectedExecutionException("fileManager is shutting down");
synchronized (writeAdmissionMonitor) {
if (!acceptingWrites.get() || executor.isShutdown()) {
executor.remove(task);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 问题:remove 失败时仍抛出拒绝异常,可能导致重复释放或重复完成。

原逻辑只在 executor.remove(task) 返回 true 时才抛出 RejectedExecutionException。注释也说明:任务已被工作线程取走,或已被关闭流程排空丢弃时,由任务现有的完成路径负责收尾。

现在无论 remove 是否成功都会抛出异常。会出问题的典型时序如下:

  • offer 成功后,工作线程立即取走任务并开始执行;
  • 随后关闭流程把 acceptingWrites 置为 false;
  • 当前线程进入同步块,remove 返回 false,但仍然抛出异常。

结果是调用方按“被拒绝”释放借用,任务执行完毕后又按自身路径释放一次,形成重复释放或重复完成。

同样,如果关闭流程(例如 shutdownNow() 后处理排空的任务)已经为队列中的任务做了完成或释放,这里也会重复处理。

建议:

  • 恢复“仅在 remove(task) 成功时抛出”的语义。
  • 如果确有任务被排空后无人释放的场景,应在关闭的排空路径里统一完成被排空的任务,而不是在这里无条件拒绝。

// 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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 问题:新增的 writeAdmissionMonitor 没有真正把“入队”和“关闭”串行化。

offer(task, 100ms) 在同步块之外执行,因此 offer 成功到进入 synchronized (writeAdmissionMonitor) 之间仍有竞态窗口:关闭流程或工作线程都可能在这段时间里处理该任务。

acceptingWrites 本身已经是原子变量,同步块只给“检查标志”加了互斥,并没有改变上面的竞态,所以 PR 描述中的“Serialize admission with shutdown”目前并不成立。

建议:

  • 明确想保证的不变式,例如“任何入队任务要么被执行,要么被关闭流程完成,要么由调用方释放,且只发生一次”。
  • 用状态位(如任务级的 CAS 所有权)或在关闭路径统一收尾来保证这一不变式。
  • 补充针对 offer 成功后立即关闭的并发测试:可以用可控的阻塞工作线程,或用 CountDownLatch 构造时序,并断言借用恰好释放一次。

export default {
...getMeasurementUiSupplement('tr-TR'),
...en,
...getMeasurementUiSupplement('tr-TR'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 问题:调整展开顺序后,补充资源的顶层键会整体替换 en 的同名对象。

这是产品行为变更,不只是修测试。对象展开是浅合并:如果 getMeasurementUiSupplement('tr-TR') 返回的某个顶层键(如 feedback、monitor)只包含部分子键,就会整体替换 en 中对应的整个对象,导致其余子键在 tr 下缺失。

缺失的键要么回退到 fallback 语言并产生警告,要么在未配置回退时直接显示键名。原顺序下,这些补充键会被 en 整体覆盖,因此不会出现这个问题。

建议:

  • 确认补充资源的每个顶层对象都是完整的;否则改为深合并。
  • 增加一个测试:断言 tr 下与 en 同名的顶层对象没有丢失子键。

})
if (aggregateProjection.status === 'rejected') return true
const projectedYValues = aggregateProjection.status === 'projected' ? aggregateProjection.data.yValues : yValues
const valueLength = (value: unknown): number => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题:这是产品代码的语义变更,与原判定不完全等价,且没有配套测试。

具体差异:

  • DataView:ArrayBuffer.isView 为 true,但 DataView 没有 length,因此长度被计为 0。在 explicitTimeAppend === true 时,非空的 DataView 会被当作空数据直接丢弃;原逻辑按 byteLength 判断,不会丢弃。
  • 其他非数组、非 TypedArray 的值(例如标量):新逻辑统一计为 0,并在 explicitTimeAppend 分支中被丢弃;原逻辑不会进入这条提前返回。

如果这些类型确实不会出现,建议在类型上收窄 yValues。否则:

  • 对 ArrayBuffer.isView 的值回退到 byteLength 判断;
  • 补充覆盖 TypedArray 与空值两种情况的单元测试。

Comment thread .github/workflows/ci.yml Outdated
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: '0'
NODE_OPTIONS: --max-old-space-size=6144
OPENTEST_LICENSE_ENVIRONMENT: test

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题:测试授权变量设在 job 级 env,会作用于该 job 的所有步骤。

按 CONTEXT.md,测试与正式授权环境的材料不可交叉组合。如果该 job 现在或将来包含构建、打包步骤,并在构建时读取 OPENTEST_LICENSE_ENVIRONMENT / OPENTEST_LICENSE_URL(例如被注入到前端构建产物),产物可能带上测试授权配置和无效地址,而且不容易察觉。

建议: 把这两个变量移到具体的测试步骤 env 下,缩小作用范围。

i18n.global.locale.value = 'tr'
expect(translate('feedback.message.feedbackAccepted')).toBe(en.feedback.message.feedbackAccepted)
expect(translate('feedback.automatic.partial')).toBe(en.feedback.automatic.partial)
expect(translate('feedback.message.feedbackAccepted')).toBe(tr.feedback.message.feedbackAccepted)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题:断言与 tr 自身的值比较,无法验证测试标题声称的行为。

如果 tr.feedback.* 实际仍等于英文(补充资源没有提供土耳其语译文),断言照样通过,所以证明不了“使用土耳其语译文”。

建议: 增加 expect(tr.feedback.message.feedbackAccepted).not.toBe(en.feedback.message.feedbackAccepted),或直接断言一个已知的土耳其语文案。

@@ -1,13 +1,12 @@
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { flushPromises, mount } from '@vue/test-utils'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题:移除了 enableAutoUnmount(afterEach),但没有看到替代的卸载机制。

如果全局 setup 没有统一卸载组件,各用例挂载的 MeasureRunButton(含 Element Plus 弹层或 teleport)会残留到后续用例,可能造成 DOM 查询串扰和不稳定。

建议: 请说明移除原因。如果是因为全局已经启用自动卸载,可以忽略此条;否则请在各用例中显式调用 wrapper.unmount()。

@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)

本 PR 主要对齐过时的测试期望,并修正 CI 环境变量。大部分测试侧改动有依据,例如时区改用本地时间构造、Windows 路径、protobuf 新字段、新增的 mock 方法。需要重点关注以下几点:

  1. ConcurrentFileManager 的加锁在语义上与原实现等价。 描述中称“将阻塞写入准入与关闭串行化”,但这次改动并不能修复相关竞态。新增测试在旧代码上同样会通过,无法防止回归。CI 中原有的不稳定问题可能仍然存在,“五次串行重跑通过”不足以证明已修复。
  2. PR 混入了两处产品代码行为变更,描述中没有交代,也没有对应测试。
    • use-grpc-exec.ts:空值判定逻辑变了。
    • tr-TR.ts:展开顺序调整后,土耳其语补充文案开始生效,同时引入了浅合并覆盖的风险。
  3. 部分测试断言改成了同义反复。 断言的期望值直接取自被测对象本身,测试失去了校验能力。

另外,CI 授权环境变量设在 job 级别。请确认该 job 不产出会被分发的构建产物。

由 AI 自动生成,仅供参考,不作为合并依据。审查提交:3fc7484。维护者可评论 /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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 这里新增的 writeAdmissionMonitor 实际上不会改变行为。

  • 只有当 acceptingWrites 已经是 false(即 beginManagerClose 已执行完并释放锁)或 isShutdown() 为真时,才会走到 remove(task)。
  • beginManagerClose 在锁内只做了 compareAndSet 和 set(false),而 AtomicBoolean 本身已经保证这两步的可见性。
  • executor.shutdown()/shutdownNow() 不在这把锁的保护范围内,所以 isShutdown() 分支仍可能在检查与 remove 之间翻转。

与原来的 (!accepting || isShutdown) && remove(task) 相比,加锁和改写结构后的可观察行为是一样的。描述中“被拒绝的调用方释放所有排队借用”的竞态,并没有被这次改动消除。

建议先定位 CI 失败的真实交错路径,例如关闭流程中“快照或排空队列”与准入 offer 之间的窗口。要么把这些操作纳入同一临界区,要么在关闭侧统一负责释放已入队的任务。如果这次确实只是重构,请在描述中更正修复声明。

}

@Test
void workerClaimedAdmissionIsNotRejectedOrDiscarded() throws Exception {

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. 只覆盖了一条已有分支。 它覆盖的是“offer 成功后 isShutdown() 为真、remove 返回 false 时直接返回”。这条分支在旧实现中已经存在,测试在改动前后都会通过,无法证明新加的串行化有效。
  2. 场景与描述不符。 测试把一个与 manager 无关的 OfferThenShutdownExecutor 传给 handler,acceptingWrites 始终为 true。它没有模拟描述中“manager 关闭与阻塞准入并发”的场景。
  3. 依赖私有实现细节。 测试通过反射读取私有字段 fileExecutors,与实现细节强耦合。

建议补充一个确定性的并发测试:让准入线程停在 offer 之后,在关闭完成前后分别放行,并断言每个被借用的数据恰好完成一次,没有泄漏也没有重复释放。

export default {
...getMeasurementUiSupplement('tr-TR'),
...en,
...getMeasurementUiSupplement('tr-TR'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 调整展开顺序是产品行为变更:此前土耳其语补充文案会被 en 完全覆盖,现在开始生效。

对象展开是浅合并。如果 getMeasurementUiSupplement('tr-TR') 返回的某个顶层键(例如 feedback)只包含部分子键,就会整体替换 en 中对应的对象,导致同一命名空间下其余子键缺失。缺失后只能依赖 vue-i18n 的 fallback,并会产生缺失键告警。

请确认补充对象的每个顶层键都是完整对象,或者改为深合并。另外请检查其他语言文件是否也有同样的顺序问题,保持一致。

i18n.global.locale.value = 'tr'
expect(translate('feedback.message.feedbackAccepted')).toBe(en.feedback.message.feedbackAccepted)
expect(translate('feedback.automatic.partial')).toBe(en.feedback.automatic.partial)
expect(translate('feedback.message.feedbackAccepted')).toBe(tr.feedback.message.feedbackAccepted)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 这个断言是同义反复。期望值直接取自 tr 对象本身,即使 tr.feedback.message.feedbackAccepted 只是从 en 展开得到的英文值,测试也会通过,无法验证“土耳其语翻译已生效”。

建议改为下面任一方式:

  • 断言具体的土耳其语文案;
  • 至少补充 expect(...).not.toBe(en.feedback.message.feedbackAccepted);
  • 同时断言没有触发缺失键告警。

(projectedYValues == null ||
(Array.isArray(projectedYValues) && projectedYValues.length === 0) ||
(ArrayBuffer.isView(projectedYValues) && projectedYValues.byteLength === 0))
yValueCount === 0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 这是产品代码中的行为变更,PR 描述没有说明,也没有配套测试。

原逻辑只把 null、空数组和 byteLength === 0 的视图判为空。现在 valueLength 对以下情况都返回 0:

  • 非数组、非 TypedArray 的值,例如 DataView、标量或类数组对象;
  • 实际上非空的 DataView。

在 explicitTimeAppend === true 时,这些值会被提前 return true 丢弃。hasStampedPointTime 的判定同样受到影响。

如果这次改动只是为了通过类型检查,建议保持原有语义,例如对 ArrayBuffer.isView 的情况继续使用 byteLength 判空,并补充单测覆盖空数组、空 TypedArray 和单值时间历史的路径。

Comment thread .github/workflows/ci.yml Outdated
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: '0'
NODE_OPTIONS: --max-old-space-size=6144
OPENTEST_LICENSE_ENVIRONMENT: test

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 OPENTEST_LICENSE_ENVIRONMENT=test 和占位 URL 设置在 job 级别,会作用于该 job 的所有步骤。

如果该 job 现在或将来包含构建、打包或上传产物的步骤,测试授权环境可能被写入产物。按 CONTEXT.md 的约定,测试与正式授权材料不可交叉组合。

建议把这两个变量限定到运行测试的 step 上。

@@ -1,13 +1,12 @@
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { flushPromises, mount } from '@vue/test-utils'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 这里移除了 enableAutoUnmount(afterEach),测试中也没有看到手动 unmount。

如果原因是全局 setup 已经调用过 enableAutoUnmount(重复调用会抛错),请确认全局 setup 确实对本文件生效。否则挂载的组件会在用例之间残留,可能带来 i18n 语言切换和全局监听器方面的交叉干扰。

const source = 'data:image/png;base64,AAAA'
const reportAdapter = {
component: defineComponent({}),
template: () => getFormStructure('fft'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 reportAdapter.template 对 GENERAL、SOUND_POWER、CAPACITOR 三种模板都固定返回 getFormStructure('fft')。

如果 reportStructure 会用 adapter 的模板生成部分章节,用例名称中的“using real template collection”就不再成立,测试可能无法覆盖各模板真实的签名行位置。

建议按模板返回对应的结构,或者调整用例名称,说明这里使用的是固定的 FFT 模板。

@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)

整体上,本 PR 主要把一批过期测试对齐到 main 的现有行为,并附带少量生产代码改动:ProjectService 空值保护、use-grpc-exec.ts 长度判断、tr-TR.ts 合并顺序。多数测试调整有依据:时区无关的本地时间构造、Windows 路径、@​TempDir 真实路径、HDF5 读取前先复制文件,以及插件失败只隔离单个插件、与 ADR 的“工作区部分可用”一致。下面几点需要作者确认。

  1. 描述与 diff 不一致:描述称已“Serialize blocked file-write admission with manager shutdown so rejected callers release every queued borrow”,但 diff 中没有 ConcurrentFileManager 的生产代码改动,只改了测试。如果该修复已在 main 中,请在描述里说明对应提交。否则新增的 HandoffFixture 用例在 CI 上应会失败,或者实际验证的是未合入的行为。
  2. 描述未提及生产代码改动:ProjectService 的空值保护和 tr-TR.ts 的合并顺序都改变了运行时行为,属于产品修复,不只是测试基线修复。建议在描述中列出,并补充对应测试。
  3. 跨仓验收测试默认不再运行:InstalledContentDevelopmentProcessTest 中原本默认执行的真实插件 CLI 与前端全量刷新验证,被移到需要系统属性才启用的用例里。CI 中未见设置该属性,实际覆盖面有所下降。

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

export default {
...getMeasurementUiSupplement('tr-TR'),
...en,
...getMeasurementUiSupplement('tr-TR'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 调整为 ...en 在前、...getMeasurementUiSupplement('tr-TR') 在后之后,补充资源会整体覆盖 en 中同名的顶层命名空间,因为对象展开是浅合并。如果补充资源只包含某个命名空间的部分键(例如 feedback 下只有附件相关文案),该命名空间中其余英文键会从 tr 消息里消失:要么依赖 fallbackLocale 回退并在开发环境产生警告,要么在未配置回退时直接显示键名。

建议:

  • 确认 getMeasurementUiSupplement('tr-TR') 返回的是否都是完整命名空间;
  • 如果不是,改为按命名空间深度合并(如 lodash/merge 或项目已有的 deep merge 工具);
  • 增加测试,断言 tr 下同一命名空间中未被补充的键仍能取到英文文本,且不触发 fallback 警告。

}

@Test
@EnabledIfSystemProperty(named = "opentest.installed-development.integration", matches = "true")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 原测试默认执行真实插件 CLI 编排、部署和前端全量刷新。现在默认路径改为 stageDevelopmentFiles 直接写文件模拟,真实流程只在 -Dopentest.installed-development.integration=true 时运行,而 CI 工作流中未见设置该属性。这样会导致 CLI 部署逻辑与前端刷新逻辑在 CI 中完全没有回归覆盖。

建议二选一:

  • 在具备插件仓库的 CI 任务中显式开启该属性;
  • 在 PR 描述和测试文档中说明覆盖范围降级及替代验证方式。

另外,findPluginsRepository 去掉了同级目录回退,可以考虑回退到 OPENTEST_PUBLIC_PLUGINS_SOURCE(缺省 ../OpenTest-Plugins),与 CONTEXT.md 中的约定保持一致。

Long newProjectId) {
List<ResultLimitConfig> validLimitConfigs = filterResultLimitConfigsByExistingNodes(
exportLimitConfigs,
exportLimitConfigs == null ? List.of() : exportLimitConfigs,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 这是生产代码中的行为修复:导入数据缺少 limit 配置时不再出现 NPE。但本 PR 没有覆盖该路径的测试。

建议:

  • 补充一个导入用例,覆盖 exportLimitConfigs == null 的情况,断言导入成功且不生成 limit 配置;
  • 确认同一方法中的其他导出列表(如判定规则列表)在旧版导出文件中是否同样可能为 null,必要时一并处理,避免只修复其中一处。

assertInstanceOf(RejectedExecutionException.class,
assertThrows(ExecutionException.class,
() -> append.get(2L, TimeUnit.SECONDS)).getCause());
if (cancel) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 cancel 分支现在同时接受两种结果:append.get 正常返回,或抛出 RejectedExecutionException。这等于放宽了 closeNow 对被阻塞调用方的契约,测试无法再发现“调用方本应收到异常却静默返回”这类回归,反之亦然。

如果契约已经明确为“closeNow 时调用方正常返回,拒绝只通过完成回调报告”,建议直接断言正常返回;如果两种结果都合法,请在注释中写明原因,以及两种结果对应的时序。

manager.setBlockOnQueueFull(true);
manager.registerWriterFactory(TYPE, (fileName, appendMode) -> writer);
manager.init();
Field executorsField = ConcurrentFileManager.class.getDeclaredField("fileExecutors");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 测试通过反射替换私有字段 fileExecutors,并依赖生产代码在队列满时调用 offer(task, timeout, unit) 这一实现细节,OfferGateQueue 只拦截这个带超时的重载。生产代码一旦改用 put 或无超时的 offer,或者调整字段名或类型,测试就会失效,而且可能表现为超时而非明确的失败信息。

建议在 ConcurrentFileManager 中提供包级可见的执行器或队列工厂注入点,代替反射。

import { createRequire } from 'node:module'
import { fileURLToPath } from 'node:url'

process.env.OPENTEST_LICENSE_ENVIRONMENT ||= 'test'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 ||= 只在变量为空时设置默认值。如果开发者本地 shell 中已导出 OPENTEST_LICENSE_ENVIRONMENT=production 或真实的 OPENTEST_LICENSE_URL,桌面单元测试就会使用正式授权环境和真实地址,与描述中的“explicit test-only license environment”不符。

建议在测试 setup 中直接赋值,或通过 vitest 配置的 test.env 强制设置。

var sql = new JdbcTemplate(database);
sql.execute("CREATE TABLE file(id INTEGER PRIMARY KEY,tenant_id INTEGER,created_time TEXT,updated_time TEXT,business_id TEXT,request_id INTEGER,business_type INTEGER,file_name TEXT,file_url TEXT,type INTEGER,shards_no INTEGER,wait_del INTEGER,temporary_result INTEGER NOT NULL DEFAULT 0)");
sql.execute(Files.readString(Path.of("apps/backend/crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));
sql.execute(Files.readString(Path.of("../crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 路径从“以仓库根目录为基准”改成了“以模块目录为基准”(../crydaq-server/...)。这修好了 Maven 下的运行,但在 IDE 中以仓库根目录为工作目录运行时会找不到文件,属于又一种隐式依赖工作目录的写法。

建议改为从当前目录向上查找包含 apps/backend/crydaq-server 的仓库根目录,或者使用 Maven 注入的 basedir 系统属性来解析路径。SensorCalibrationStandardDisplayUnitTest.java:110 存在同样的问题。

System.setProperty("os.name", "Darwin");
loader.loadDlls();
nativeLoading.verify(() -> NativeLoader.loader(library.toString()), times(1));
String expectedPath = nativeDirectory + File.separator + "nested/library.dylib";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 期望值写成了 nativeDirectory + File.separator + "nested/library.dylib"。在 Windows CI 上,这会把加载器当前“字符串拼接、混用分隔符”的实现细节固化为测试契约。如果后续把路径规范化(例如使用 Path.resolve),行为本身正确,测试却会失败;反过来,测试也无法发现分隔符处理上的回归。

建议将实际参数与期望值都转换为 Path 并 normalize() 后再比较,或者在注释中说明,模拟 Darwin 时混合分隔符是有意保留的行为。

@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)

本次 PR 主要是测试修复,另有三处运行时改动:ProjectService 的空限值列表兜底、tr-TR.ts 的展开顺序、use-grpc-exec.ts 的长度判断收窄。大部分测试改动是在对齐 main 上已有的行为或平台差异,例如 file:// URI、toRealPath()、本地时区日期和插件隔离失败的状态,方向合理。

需要关注的问题:

  1. 合并后 CI 仍不通过。 描述中已说明仍有 53 个后端服务测试套件、7 个前端用例失败。本 PR 合入后 main 仍然是红的,请评审者确认是否接受分批修复。
  2. 标题与改动范围不符。 标题为 fix(ci),但包含导入逻辑和语言包合并顺序等运行时改动。按 squash 规则,标题会成为提交说明,容易误导后续回移(backport)和排障。建议拆分 PR,或改为更准确的类型和范围。
  3. 部分改动放宽了原有断言或缩小了默认覆盖。 包括取消路径的异常断言、跨仓 CLI 集成默认不运行、存储 URL 从 local:// 改为 file://。这些属于测试契约变化,需要维护者明确认可,而不只是“修复环境漂移”。
  4. 插件运行时测试的预期发生变化。 预期从整体进入 RECOVERY 改为只隔离出错插件(APP_READY/BACKEND_CORE_READY 加 failedPlugins)。diff 中没有对应的生产代码改动,请确认 main 上的实现和 ADR 已采用该语义,避免测试反向定义产品行为。

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

Long newProjectId) {
List<ResultLimitConfig> validLimitConfigs = filterResultLimitConfigsByExistingNodes(
exportLimitConfigs,
exportLimitConfigs == null ? List.of() : exportLimitConfigs,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 空列表兜底本身是正确的,但本 PR 没有新增覆盖该路径的测试。描述中说已用 main 前后对比证明了遗留导入缺陷,那份复现应该沉淀为回归测试:导入一个省略 limit 列表的旧工程包,断言导入成功,且判定规则映射结果正确。

另外,同一函数中的判定规则列表(filterJudgmentRuleConfigsByExistingNodes 的输入)以及其他可选列表在旧包中是否也可能缺失?建议一并核对,避免逐个暴露。

export default {
...getMeasurementUiSupplement('tr-TR'),
...en,
...getMeasurementUiSupplement('tr-TR'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 展开顺序反转后,getMeasurementUiSupplement('tr-TR') 返回的顶层命名空间会整体替换 en 中的同名对象,因为这里是浅合并。如果补充包某个命名空间(例如 workflow、feedback)只包含部分键,en 中该命名空间的其余键会从 tr 消息中消失,只能靠 vue-i18n 的 fallback 补救,并会产生 warn。

现有的 feedback-locale.test.ts 只监听 console.error,发现不了这类缺失。建议:

  • 改为按命名空间深合并;
  • 或增加一个测试,断言 en 的全部键路径在 tr-TR 消息中都能直接解析,不走 fallback。

doReturn(List.of(file)).when(service).list(any(FileQuery.class));
doReturn("local://"+root.resolve("wrong-current-root")).when(service).getWorkFileSystemUrl();
doReturn("local://"+root).when(service).getWorkFileSystemUrl("original-storage-root");
doReturn(root.resolve("wrong-current-root").toUri().toASCIIString()).when(service).getWorkFileSystemUrl();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 这一批测试把工作存储 URL 从 "local://" + path 统一改成了 path.toUri().toASCIIString()(file:///...)。同类改动还有 ChannelCursorTest、ResultCurveReaderTest、SavedMathPostProcessRoundtripTest 等。

如果生产环境的 getWorkFileSystemUrl() 实际返回的仍是 local:// 格式,那么 Windows 盘符、反斜杠和非 ASCII 路径在 local:// 下的解析就不再有测试覆盖。Windows CI 上原有的失败可能正是真实的生产缺陷,现在被换成了另一种 scheme 而掩盖。

建议:

  • 先确认生产实际使用的 URL 格式;
  • 如果是 local://,至少保留一个用生产格式拼接 Windows 路径的用例,或修复生产端的解析。

assertInstanceOf(RejectedExecutionException.class,
assertThrows(ExecutionException.class,
() -> append.get(2L, TimeUnit.SECONDS)).getCause());
if (cancel) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 closeNow 分支现在同时接受两种结果:appendData 正常返回,或抛出 RejectedExecutionException。原用例“阻塞中的准入被拒绝”的契约因此被放宽,两条路径哪条在执行也不确定,与描述中的“deterministic”不符。

既然新增的 HandoffFixture 用例已经确定性地覆盖了“offer 已接受后取消”的路径,建议这里保持原断言(appendData 必须以拒绝结束)。如果生产语义确实允许两种结果,请在测试或 ADR 中写明原因,并分别构造两种时序做确定性断言。

manager.setBlockOnQueueFull(true);
manager.registerWriterFactory(TYPE, (fileName, appendMode) -> writer);
manager.init();
Field executorsField = ConcurrentFileManager.class.getDeclaredField("fileExecutors");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 HandoffFixture 通过反射替换私有字段 fileExecutors,换成自建的 ThreadPoolExecutor 和 OfferGateQueue。这带来两个问题:

  1. 测试与私有字段名、集合类型强耦合,生产重构时会以反射异常的形式失败,而不是暴露行为回归。
  2. 被测对象已不是生产创建的执行器,生产端的队列容量、拒绝策略、线程工厂等配置偏差无法被发现。描述中所说的“Real executor/queue handoff”并不完全成立。

建议在 ConcurrentFileManager 上提供包级可见的执行器/队列工厂注入点,或通过配置构造,替代反射改写字段。

String developmentOutput = runPluginDevelopmentCommand(pluginRoot.getParent(), runtimeManifest, developmentBackend);
assertTrue(developmentOutput.contains("开发构建已部署到活动安装目录"), developmentOutput);
} else {
stageDevelopmentFiles(packages.packageDirectory(formalInstallation), runtimeManifest, developmentBackend);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 默认路径改为由 stageDevelopmentFiles 手工模拟插件开发 CLI 的部署结果,并且跳过了 runFrontendFullRefresh。真实 CLI 和前端整页刷新的覆盖只在设置 opentest.installed-development.integration=true 时才运行,而当前 CI 工作流并未设置该属性。

这样一来:

  • CLI 部署产物的布局一旦变化(文件集、plugin.json 字段、contracts/ 等),模拟数据会悄悄与真实行为偏离;
  • 前端刷新回归在 CI 中完全失去检测。

建议在有插件仓库的 CI 任务(例如社区包工作流)中显式开启该集成测试,或在跟踪 issue 中记录这个覆盖缺口。

@@ -1,13 +1,12 @@
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { flushPromises, mount } from '@vue/test-utils'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 移除了 enableAutoUnmount(afterEach),但这段 diff 中没有看到对应的手动 unmount()。已挂载的组件和 ElementPlus 实例可能在用例之间残留,并共享全局 i18n 语言状态,导致用例互相影响或内存泄漏。

如果移除是因为和其他清理逻辑冲突,请在每个用例末尾显式 wrapper.unmount()。

var sql = new JdbcTemplate(database);
sql.execute("CREATE TABLE file(id INTEGER PRIMARY KEY,tenant_id INTEGER,created_time TEXT,updated_time TEXT,business_id TEXT,request_id INTEGER,business_type INTEGER,file_name TEXT,file_url TEXT,type INTEGER,shards_no INTEGER,wait_del INTEGER,temporary_result INTEGER NOT NULL DEFAULT 0)");
sql.execute(Files.readString(Path.of("apps/backend/crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));
sql.execute(Files.readString(Path.of("../crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 改为 ../crydaq-server/... 后,测试依赖“工作目录必须是模块目录”。这在 Maven surefire 下成立,但从仓库根目录或部分 IDE 配置运行时会找不到文件,只是把原来的问题倒了过来。SensorCalibrationStandardDisplayUnitTest 有同样的问题。

建议基于 user.dir 向上查找仓库根目录(参考本 PR 中的 findHostRepository),或在 surefire 中注入路径属性,使两种运行方式都能工作。

System.setProperty("os.name", "Darwin");
loader.loadDlls();
nativeLoading.verify(() -> NativeLoader.loader(library.toString()), times(1));
String expectedPath = nativeDirectory + File.separator + "nested/library.dylib";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 期望值 nativeDirectory + File.separator + "nested/library.dylib" 在 Windows 上会得到 C:\...\nested/library.dylib 这样的混合分隔符路径。断言等于把生产端当前的字符串拼接细节固化下来了。

建议改为比较规范化后的 Path,例如 Path.of(actual).normalize() 与 nativeDirectory.resolve("nested/library.dylib") 对比,避免以后修正分隔符处理时测试误报。

const source = 'data:image/png;base64,AAAA'
const reportAdapter = {
component: defineComponent({}),
template: () => getFormStructure('fft'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 reportAdapter.template 对所有模板都返回 getFormStructure('fft'),同时 supportsTemplate 恒为 true。参数化的 GENERAL、SOUND_POWER、CAPACITOR 三个用例可能实际都在测同一份 fft 表单结构,与用例名中的“using real template collection”不符。

请确认 reportStructure 对这三种模板是否会使用 adapter 的 template()。如果会,应按模板返回对应结构,或在用例名中说明 adapter 只是占位。

@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)

总体评价:PR 描述与实际改动严重不符,建议拆分后再审。

描述称本次只新增两处改动:ChannelCursor 的资源释放,以及 FileSelect/directorySelect 取消行为的测试期望。描述还声明 Report 导航、module-select 和数值 null-bound/blur 测试保持冻结,且未改动生产代码。实际 diff 与此不符:

  • 生产代码有改动,描述未提及:ProjectService.java 增加空值保护;use-grpc-exec.ts 修改长度判定逻辑;tr-TR.ts 调整语言包合并顺序,会改变土耳其语的实际显示文案。
  • 声明冻结的测试被修改:module-select.test.ts 的报告导航期望被反转;local-preview.test.js、sequence-detached-dialog-host.test.ts 和 dialog-interaction-dialog.test.ts 中的数值 blur 测试改变了事件序列。
  • CI 与工作流有改动:.github/workflows/ci.yml 改了单元测试环境变量。按 CONTRIBUTING 规定,修改工作流需要 CODEOWNERS 指定的维护者审查,描述中未说明。
  • 大量其他测试期望被改写:插件运行时由整体进入 RECOVERY 改为单插件失败、应用仍为 APP_READY;还有 Provider 线程资源、i18n 文案、gRPC 常量等。这些都是产品契约层面的变化,需要逐项说明依据,并关联对应 Issue 或 ADR,例如“工作区部分可用”的语义。

建议:

  1. 将本 PR 收敛为描述所述的范围。
  2. 其余修复按领域拆成独立 PR,每个 PR 说明所确认的契约来源。
  3. 冻结区域的测试改动须先取得负责人确认。
  4. ChannelCursor 的修复缺少针对首个分片失败场景的回归测试。描述中的“7/7 passed”只能说明既有用例通过,不能证明泄漏已修复。

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

await wrapper.get('[data-testid="project-module-tab-report"]').trigger('click')

expect(mocks.warning).toHaveBeenCalledWith('project.pleaseCompleteTheTest')
expect(mocks.push).toHaveBeenCalledWith({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 PR 描述明确声明 Report 导航和 module-select 测试“remain frozen”,但这里反转了期望。

  • 原期望:从测量页点击报告时触发 project:open-report;在 setup 阶段点击时给出 pleaseCompleteTheTest 警告。
  • 新期望:两种情况都直接 push 到 Report,且不再警告。

用例名 warns instead of opening a report from setup 现在与断言完全相反。这实际上把一个可能的生产回归固化成了预期行为。CONTEXT.md 规定“顶部报告绑定当前活动测量工作区”,该改动可能与之冲突。

建议撤回此修改。如果确属契约变更,应单独提 PR,附上产品确认,同时修改用例名。

await input.trigger('input')
expect(form.model.value.input1).toBe(3)
form.wrapper.get('input').element.blur()
input.element.dispatchEvent(new Event('change', { bubbles: true }))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 该用例位于 numeric blur ordering,属于描述中声明冻结的数值 blur 测试。

现在在 blur() 之前额外派发了 change 事件,因此 input1 变为 1.5 可能是 change 提交的结果,而不是 blur 提交的结果。这样一来,用例不再验证 blur 时序本身,原本应暴露的回归会被掩盖。

建议撤回。如果组件的提交时机确实改为 change,应在生产侧变更中说明,并新增独立用例覆盖。

sendSequenceDialogEventMock.mockResolvedValueOnce({ success: false, error: 'Pending draft' })
await button.trigger('click')
await flushPromises()
await draft.trigger('change')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 这里的上下文注释写明“Synthetic click intentionally does not blur: preserve the last committed value”。但在点击之后、聚焦按钮之前,新代码插入了 draft.trigger('change'),人为制造了一次提交。这改变了 null-bound/blur 场景的验证语义,而该区域在描述中被声明为冻结。

dialog-interaction-dialog.test.ts:763 和 :815,以及本文件 :985,都有同样的问题。

请确认这些改动是否经过负责人同意;否则应撤回。

export default {
...getMeasurementUiSupplement('tr-TR'),
...en,
...getMeasurementUiSupplement('tr-TR'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 这是生产代码改动,但 PR 描述中没有提到。

合并顺序从 supplement → en 改为 en → supplement,结果是 supplement 的值覆盖英文。问题在于对象展开是浅合并:如果 getMeasurementUiSupplement('tr-TR') 返回的某个顶层命名空间(例如 feedback)只含部分键,就会整块替换 en 中的同名命名空间。未翻译的键因此从 tr-TR 消息中消失,只能依赖 vue-i18n 的 fallback,并可能产生缺失键警告。

与此同时,feedback-locale.test.ts 去掉了对 tr 的排除和对 console.warn 的屏蔽。

建议:

  • 改为按命名空间深合并;
  • 或确认 supplement 的每个命名空间都完整覆盖了 en 的键;
  • 补充一条测试,断言 tr-TR 未翻译的键仍能取到英文值;
  • 将该改动拆分到独立 PR。

try {
openNextShard();
} catch (IOException | RuntimeException error) {
close();

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. 如果 close() 本身抛出异常(例如 IOException),原始的 error 会被吞掉,排查时只能看到关闭异常。建议改为:
    try { close(); } catch (IOException | RuntimeException closeError) { error.addSuppressed(closeError); }
    throw error;
  2. 在构造器中调用 close() 时,部分字段可能尚未初始化,例如当前 reader 为 null。请确认 close() 对这种半初始化状态是安全的,不会抛出 NPE 覆盖原异常。

此外,本次修复没有对应的回归测试。建议在 ChannelCursorTest 中构造首个分片校验失败或加载失败的场景,断言构造器抛出原始异常,并且分片文件随后可以删除,或 reader 已关闭。

import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { flushPromises, mount } from '@vue/test-utils'
import { beforeEach, expect, it } from 'vitest'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 删除了 enableAutoUnmount(afterEach),但本文件中没有看到任何替代的卸载逻辑。挂载的组件会在用例之间残留,可能导致 i18n 全局 locale、监听器或 DOM 状态在用例之间串扰。

如果删除它是因为与 beforeEach 中切换语言包冲突,请改为在用例内显式调用 wrapper.unmount();否则请恢复。

}

@Test
@EnabledIfSystemProperty(named = "opentest.installed-development.integration", matches = "true")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 真实插件 CLI 编排和前端全量刷新的验证,现在只在设置 opentest.installed-development.integration=true 时才会运行。默认用例改为在进程内直接写文件来模拟部署,因此 CI 不再覆盖 CLI 部署路径。

另外,原有的同级目录回退查找被移除,现在必须显式传入插件仓库路径。

这降低了测试覆盖,PR 描述中也没有说明。请确认是否有其他 CI 任务会启用该系统属性;如果没有,应在描述或测试文档中注明这一覆盖缺口。

System.setProperty("os.name", "Darwin");
loader.loadDlls();
nativeLoading.verify(() -> NativeLoader.loader(library.toString()), times(1));
String expectedPath = nativeDirectory + File.separator + "nested/library.dylib";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 期望值写成 nativeDirectory + File.separator + "nested/library.dylib"。在 Windows CI 上,它会得到 dir\nested/library.dylib 这样混合分隔符的路径,测试等于把生产代码的拼接方式固化成了契约。

该用例模拟的是 Darwin,使用 POSIX 路径;但在 Windows 上,混合分隔符是否被认为正确并不明确。

建议改用 Path 语义比较(例如 nativeDirectory.resolve("nested").resolve("library.dylib")),或者在生产代码中统一规范化路径分隔符。

var sql = new JdbcTemplate(database);
sql.execute("CREATE TABLE file(id INTEGER PRIMARY KEY,tenant_id INTEGER,created_time TEXT,updated_time TEXT,business_id TEXT,request_id INTEGER,business_type INTEGER,file_name TEXT,file_url TEXT,type INTEGER,shards_no INTEGER,wait_del INTEGER,temporary_result INTEGER NOT NULL DEFAULT 0)");
sql.execute(Files.readString(Path.of("apps/backend/crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));
sql.execute(Files.readString(Path.of("../crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 迁移脚本路径从“相对仓库根目录”改为“相对模块目录”(../crydaq-server/...),测试因此依赖于工作目录正好是 crydaq-service 模块。在 IDE 中以仓库根目录为工作目录运行时会失败。SensorCalibrationStandardDisplayUnitTest.java:110 有同样的问题。

建议改用 Maven 提供的 basedir 系统属性来解析路径,或者通过测试类路径加载迁移脚本。

import { createRequire } from 'node:module'
import { fileURLToPath } from 'node:url'

process.env.OPENTEST_LICENSE_ENVIRONMENT ||= 'test'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 ||= 会优先使用开发者本机已经设置的 OPENTEST_LICENSE_URL 和 OPENTEST_LICENSE_ENVIRONMENT。如果本机配置的是正式授权环境,单元测试就可能访问真实的云许可证服务,或混用测试与正式授权材料;CONTEXT.md 规定这两者不可交叉组合。

如果单元测试必须与外部授权服务隔离,建议在 setup 中无条件赋值为测试值,或者在发现非测试环境时直接失败。

@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)

总体评价:PR 描述与实际改动范围明显不符,暂不建议合入。

描述称本次增量只包含两项:ChannelCursor 的资源清理,以及 FileSelect/directorySelect 取消行为的测试期望;并声明 Report 导航、模块选择和数值 null-bound/blur 测试“保持冻结”,未做生产改动。实际 diff 与此不符:

  • 冻结区域的测试被修改:
    • module-select.test.ts 的报告导航期望被整体反转。
    • 多处数值 blur 相关测试在 blur 前插入了 change 事件。
  • 存在未声明的生产代码改动:
    • ProjectService.java 增加了 null 防护。
    • use-grpc-exec.ts 修改了长度判定。
    • tr-TR.ts 调整了展开顺序,会改变土耳其语界面文案。
  • 存在未声明的工作流改动:.github/workflows/ci.yml 新增授权相关环境变量。按 CONTRIBUTING 规定,该改动需要 CODEOWNERS 审查。
  • 大量测试改动描述未提及:包括插件运行时失败隔离(RECOVERY → APP_READY)、路径 URL 从 local:// 改为 file: URI、多处 locale 文案期望变化等。

建议:

  1. 将 PR 拆分,或如实补充描述与影响范围(Blast Radius)。
  2. 对冻结区域的改动给出对应的需求或缺陷依据(Refs #),否则应回退。
  3. 为 ChannelCursor 新增的异常清理路径补充回归测试。当前 ChannelCursorTest 的 diff 只改动了 URL 构造,没有覆盖“首个分片校验或加载失败后关闭 reader”的场景,修复的正确性缺少证明。

另外,limit-editor-locale.test.ts 中 zh-CN 文案期望发生了变化,但对应的 locale 源文件不在本 diff 中。请确认目标分支上源文案确实已经是新值,否则该测试会失败。

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

await wrapper.get('[data-testid="project-module-tab-report"]').trigger('click')

expect(mocks.warning).toHaveBeenCalledWith('project.pleaseCompleteTheTest')
expect(mocks.push).toHaveBeenCalledWith({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 测试名与断言矛盾,且违反 PR 自述的冻结范围。

用例名为 warns instead of opening a report from setup,但新断言要求:

  • 从 setup 页直接 push 到 Report;
  • warning 不被调用。

这与用例名语义完全相反。描述明确写了 “Report navigation/module-select tests remain frozen”,这里却修改了导航契约。

此外,新期望使用空 query: {} 打开 Report,未携带当前活动测量工作区的 dashboard/scene。这与 CONTEXT 中“顶部报告绑定当前活动测量工作区的 dashboard 和 scene”的约定冲突。

建议: 回退本文件的改动;或提供对应需求依据,并同步修改用例名和 PR 描述。

expect(mocks.trigger).toHaveBeenCalledWith('project:open-report', 'octave')
expect(mocks.push).not.toHaveBeenCalled()
expect(wrapper.get('[data-testid="project-module-tab-measure"]').classes()).toContain('is-active')
expect(mocks.push).toHaveBeenCalledWith({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 原期望是触发 project:open-report(携带 'octave' 作为当前 provider),并保持 measure 标签激活。新期望改为直接路由到 Report,且 query 为空。

这会丢失当前测量工作区上下文,属于行为契约变更,而不是 CI 修复。如果生产代码确实已改成这种行为,那么问题出在生产回归,应修复生产代码,而不是改测试迎合它。请说明依据。

await input.trigger('input')
expect(form.model.value.input1).toBe(3)
form.wrapper.get('input').element.blur()
input.element.dispatchEvent(new Event('change', { bubbles: true }))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 该用例属于 numeric blur ordering,目的是验证 blur 会提交草稿值。

现在在 blur() 之前手动派发了 change 事件,值可能由 change 提交,blur 路径实际上不再被验证。如果 blur 提交已经失效,该测试也会继续通过。这还与描述中“Numeric null-bound/blur tests remain frozen”相矛盾。

建议:

  • 如果生产行为已改为依赖 change 提交,需要单独立项说明。
  • 否则应恢复为仅通过 blur 触发提交,并定位 blur 提交失败的真实原因。

sendSequenceDialogEventMock.mockResolvedValueOnce({ success: false, error: 'Pending draft' })
await button.trigger('click')
await flushPromises()
await draft.trigger('change')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 这里与 local-preview 中的问题相同:在点击按钮后、聚焦按钮前,额外触发了 draft.trigger('change')。

这样一来,原本要验证的“焦点离开输入框后提交草稿”路径由 change 代为完成,测试不再证明 blur 或焦点转移会提交。第 985 行也有同样的问题。

这属于描述中声明冻结的 null-bound/blur 测试,请回退或说明依据。

// Synthetic click intentionally does not blur: preserve the last committed value.
await button.trigger('click')
await flushPromises()
await draft.trigger('change')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 同上,额外的 change 事件(第 763 行和第 815 行)掩盖了 blur 或焦点转移的提交行为,削弱了冻结区域测试的有效性。

请回退,或在 PR 中明确该契约变更及其依据。

import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { flushPromises, mount } from '@vue/test-utils'
import { beforeEach, expect, it } from 'vitest'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 删除了 enableAutoUnmount(afterEach)。

如果各用例没有手动调用 wrapper.unmount(),挂载的组件和 ElementPlus 弹层会在用例之间残留,可能造成 i18n locale 状态或 DOM 互相污染。请确认每个用例都会自行卸载;否则应保留自动卸载。

System.setProperty("os.name", "Darwin");
loader.loadDlls();
nativeLoading.verify(() -> NativeLoader.loader(library.toString()), times(1));
String expectedPath = nativeDirectory + File.separator + "nested/library.dylib";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 期望路径写死为 nativeDirectory + File.separator + "nested/library.dylib"。在 Windows 上,这会断言一个混合分隔符的字符串(C:\...\nested/library.dylib),相当于把生产代码的字符串拼接细节固化成了契约。

建议: 比较规范化后的路径(如 Path.of(actual).normalize() 与 library.normalize()),避免路径格式调整时误报。

assertEquals("BACKEND_CORE_READY", runtime.candidate().path("status").asText());
assertFailedOwner(runtime, b, "测量 Provider 身份重复");
assertEquals(1, runtime.candidate().path("plugins").size());
assertEquals("org.test.a", runtime.candidate().path("plugins").get(0).path("pluginId").asText());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 该断言要求 Provider 身份冲突时保留 org.test.a、拒绝 org.test.b。这依赖于插件激活顺序是确定的。

如果激活顺序来自目录遍历或哈希集合,而不是安装顺序或 pluginId 排序,该测试在不同平台上可能不稳定。请确认运行时对“先到者保留”有明确的排序规则;第 219 行同理。

Comment thread .github/workflows/ci.yml
run: pnpm typecheck:tests
- name: Unit tests
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
env:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 未声明的工作流改动。

  • 修改工作流需要 CODEOWNERS 指定的维护者审查,但描述中没有提及。
  • apps/desktop/tests/setup.mjs 已通过 ||= 设置相同的默认值,这里的配置与之重复。

如果只有桌面单测需要这两个变量,保留 setup.mjs 中的设置即可,可以避免修改工作流;如果其他包也需要,请在 PR 描述中说明原因。

status,
statusText: String(status),
data: {},
data: status === 401 ? { code: 22, isLogin: false } : {},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 现在只有当 401 响应体为 { code: 22, isLogin: false } 时,测试才会验证“清理会话”。

如果生产逻辑已改为依据响应体判定登录失效,建议补充一个用例,覆盖“401 但响应体不表示登录失效”时不清理会话(或按约定处理),避免契约收窄后另一分支缺少覆盖。

@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)

总体评价

PR 描述与实际 diff 严重不符,需要先补充说明或拆分。

  • 描述称本次只改了 ChannelCursor 资源释放和 FileSelect/directorySelect 取消语义的测试,并称“Report navigation/module-select 测试保持冻结”“Numeric null-bound/blur 测试保持冻结”“FileSelect 之外无生产代码改动”。
  • 实际 diff 情况:
    • 修改了 module-select.test.ts 中的报告导航预期。
    • 修改了多处数字输入 blur 和 null-bound 测试(sequence-detached-dialog-host、dialog-interaction-dialog、local-preview)的事件序列。
    • 包含未声明的生产代码改动:ProjectService.java、use-grpc-exec.ts、tr-TR.ts。
    • 修改了 CI 工作流 .github/workflows/ci.yml,按规范需要 CODEOWNERS 维护者审查。
    • 插件运行时的大量测试把插件失败语义从 RECOVERY 改为 APP_READY,同时调整了 Windows 路径、URI、时区相关的测试夹具。
  • 验证说明只覆盖“三个前端测试文件 556/556”和 ChannelCursorTest,无法作为其余几十个文件改动的验证依据。

建议

  1. 更新 PR 描述,如实列出所有生产代码改动和测试语义变更。也可以按主题拆分为独立 PR:Windows 路径/URI 夹具、插件失败隔离测试、前端 locale/类型修复、报告导航。
  2. 对于“冻结”区域被改动的测试,必须说明依据(关联的 Issue/ADR 或已合入的产品决策)。否则这些改动等于让测试迁就当前行为,可能掩盖回归。
  3. ChannelCursor 的修复方向正确,但需要补充针对首个分片失败的回归测试,并保留原始异常(见行内意见)。

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

await wrapper.get('[data-testid="project-module-tab-report"]').trigger('click')

expect(mocks.warning).toHaveBeenCalledWith('project.pleaseCompleteTheTest')
expect(mocks.push).toHaveBeenCalledWith({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 PR 描述明确写了“Report navigation/module-select tests remain frozen”,但这里同时改动了两个用例的预期:

  • 上一个用例原本预期从测量页触发 project:open-report 并保持 measure 激活,现在改为直接 push 到 Report 路由。
  • 本用例名仍是 warns instead of opening a report from setup,但断言已改为“打开报告且不警告”,用例名与断言直接矛盾。

CONTEXT.md 规定“顶部报告绑定当前活动测量工作区的 dashboard 和 scene”,从 setup 阶段直接打开报告与该约束存在冲突。在没有生产改动和产品决策依据的情况下改测试迁就现状,可能掩盖导航回归。

建议:撤回此改动,或在 PR 中给出对应的 Issue/决策并同步修正用例名。

await input.trigger('input')
expect(form.model.value.input1).toBe(3)
form.wrapper.get('input').element.blur()
input.element.dispatchEvent(new Event('change', { bubbles: true }))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 该用例属于 numeric blur ordering,目的是验证仅 blur 就会提交草稿值并触发校验。现在在 blur() 前先手动派发 change,提交由 change 完成,blur 路径实际上不再被验证。

这同时违背了描述中“Numeric null-bound/blur tests remain frozen”的声明。

建议:保持只 blur 的序列。如果是 jsdom 下 setValue 行为变化导致失败,应定位真实原因(组件监听 change 还是 blur),不要通过补发事件绕过。

sendSequenceDialogEventMock.mockResolvedValueOnce({ success: false, error: 'Pending draft' })
await button.trigger('click')
await flushPromises()
await draft.trigger('change')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 注释说明“Synthetic click intentionally does not blur: preserve the last committed value”,即后续 button.element.focus() 应通过焦点转移触发提交。在 focus 前插入 draft.trigger('change') 后,提交由人为的 change 事件完成,焦点转移提交(以及 null bound 重试)的路径不再被覆盖。

第 985 行同理。这属于描述中声称冻结的 null-bound/blur 区域,请说明依据或撤回。

// Synthetic click intentionally does not blur: preserve the last committed value.
await button.trigger('click')
await flushPromises()
await draft.trigger('change')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 问题与 sequence-detached-dialog-host.test.ts 相同:在 focus 转移前人为派发 change,绕过了“焦点离开才提交”的行为验证,第 815 行同理。属于描述中声称冻结的测试范围,需要给出依据,或恢复原有的事件序列。

try {
openNextShard();
} catch (IOException | RuntimeException error) {
close();

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. 原始异常可能被覆盖:如果 close() 自身抛出 IOException 或 RuntimeException(例如部分字段尚未初始化导致 NPE,或释放 reader 失败),原始的分片校验或加载错误会丢失,排障时只能看到 close 的错误。建议:
} catch (IOException | RuntimeException error) {
    try { close(); } catch (Exception suppressed) { error.addSuppressed(suppressed); }
    throw error;
}

同时确认 close() 对构造中途状态(reader 为 null、后续字段未赋值)是安全的。
2. 缺少回归测试:ChannelCursorTest 只改了 URL 构造,没有新增“首个分片校验失败后 reader 已关闭、文件可删除”的测试。描述中提到的 Windows @​TempDir 清理问题应有对应的用例固化,例如构造一个损坏的首分片,断言抛出异常后 Files.delete 成功。

String developmentOutput = runPluginDevelopmentCommand(pluginRoot.getParent(), runtimeManifest, developmentBackend);
assertTrue(developmentOutput.contains("开发构建已部署到活动安装目录"), developmentOutput);
} else {
stageDevelopmentFiles(packages.packageDirectory(formalInstallation), runtimeManifest, developmentBackend);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 默认路径现在用 stageDevelopmentFiles 直接拷贝文件,代替运行真实的插件开发 CLI。前端 full-refresh 验证也只在 externalProcess 为真时执行,而该路径受 -Dopentest.installed-development.integration=true 控制,CI 没有设置该属性。

结果是,CI 不再覆盖“真实 CLI 部署到活动安装目录”和“前端全量刷新”这两项行为,原注释“Execute the real plugin CLI orchestration”也被删除。这是测试覆盖的实质性下降。

建议:在 PR 中说明,并为跨仓集成用例安排有插件仓库的 CI 任务;至少在测试文档中注明如何运行。

manager.setBlockOnQueueFull(true);
manager.registerWriterFactory(TYPE, (fileName, appendMode) -> writer);
manager.init();
Field executorsField = ConcurrentFileManager.class.getDeclaredField("fileExecutors");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 新夹具通过反射替换私有字段 fileExecutors,并依赖以下实现细节:

  • 第三次 appendData 才会走 offer(task, timeout, unit)。
  • 前两次走 execute 的单参数 offer。

如果实现改为任何提交都走带超时的 offer,第二次 appendData 会在构造线程里卡在 returnOffer.await(),并且没有超时,测试会挂起而不是失败。

建议:给 returnOffer.await 加上超时;或者让生产代码暴露包可见的 executor 注入点,避免反射耦合私有字段。

sql.execute("CREATE TABLE sensor_calibration_standard(id INTEGER PRIMARY KEY, min_range REAL, max_range REAL, unit TEXT)");
sql.execute("INSERT INTO sensor_calibration_standard VALUES(1,40,60,'mV/Pa')");
var migration = Files.readString(Path.of("apps/backend/crydaq-server/src/main/resources/db/migration/V2.5.0_20261103161000__add_model_range_display_units.sql"));
var migration = Files.readString(Path.of("../crydaq-server/src/main/resources/db/migration/V2.5.0_20261103161000__add_model_range_display_units.sql"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 Path.of("../crydaq-server/...") 依赖工作目录恰好是 crydaq-service 模块目录(Maven surefire 的默认 basedir)。如果在 IDE 中从仓库根目录运行,或者 surefire 配置了其他 workingDirectory,测试会失败。

原写法的问题方向相反(依赖仓库根目录)。建议通过 System.getProperty("basedir") 或类路径资源定位迁移脚本,消除对工作目录的依赖。FileServiceDirectivityPrefixSqliteTest.java 第 66 行同理。

Comment thread .github/workflows/ci.yml
- name: Unit tests
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
env:
OPENTEST_LICENSE_ENVIRONMENT: test

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 按《贡献指南》,修改工作流需要 CODEOWNERS 指定的维护者审查,请确认已请求。

另外,apps/desktop/tests/setup.mjs 已经用 ||= 设置了相同的默认值,这里重复配置的必要性需要说明:如果是前端单测也需要,应写明原因;否则建议只保留一处,避免两处不一致。

@@ -1,13 +1,12 @@
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils'
import { afterEach, beforeEach, expect, it } from 'vitest'
import { flushPromises, mount } from '@vue/test-utils'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 移除 enableAutoUnmount(afterEach) 后,如果各用例没有手动 unmount,挂载的组件(包括 Element Plus 的 teleport 或 popper)会在用例之间残留,可能导致 i18n 切换相互干扰或产生 DOM 泄漏。

请确认每个用例都显式卸载,或说明移除的原因。

@mingtaojin
mingtaojin force-pushed the fix/main-ci-baseline-20261116 branch from ae5f860 to 3ee6c76 Compare November 19, 2026 02:33

@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)

总体评价:PR 描述与实际改动范围严重不符,建议拆分后重新提交审查。

  1. 范围不一致:描述称新增改动只涉及 ChannelCursor 资源清理和 FileSelect/directorySelect 测试期望,并称“未做生产代码改动”。但 diff 修改了多处后端生产代码:BoxChannelService、GraphicConfigService、ProjectService、ReferenceTestProjectionContextResolver、BuiltInFftSignalAnalysisProvider、BuiltInOctaveSignalAnalysisProvider、DefaultBoxExecutionSession、FrozenHistoricalArtifactFactResolver、ReferenceTestExecutionPlanner。前端也有生产代码改动:use-grpc-exec.ts、tr-TR.ts。另外还修改了 CI 工作流 .github/workflows/ci.yml。描述称 module-select 测试“保持冻结”,但 apps/frontend/src/modules/project/components/__tests__/module-select.test.ts 出现在修改列表中。这些改动涉及测量执行、单位、事务恢复、历史结果身份等核心语义,“Blast Radius”一节没有覆盖,审查者无法依据描述判断风险。
  2. 测试期望被改写以适配新行为:多处已有断言被反转或放宽,例如 SequenceReferenceTestUnitServiceTest、ProviderEmptyCarrierUnitReadTest、ProjectChannelMutationTransactionSqliteTest、SoundPowerMultiRecordTest、DashboardFrameworkConformanceBoundaryTest。PR 没有关联对应的需求、ADR 或确认记录,无法区分是修复缺陷还是掩盖回归。请逐项说明依据,必要时同步更新测试名称。
  3. 无法核验的部分:ChannelCursorTest.java、BuiltInFftSignalAnalysisProviderTest.java 等关键测试,以及 FileSelect/directorySelect 相关测试文件未包含在本次提供的 diff 中。描述中的 7/7、556/556 结果无法据此核实。
  4. 修改 .github/workflows/ci.yml 需要 CODEOWNERS 指定的维护者审查。
  5. 多处新增代码使用了不必要的全限定类名,违反 AGENTS.md 的 Java 类型引用规范,具体位置见行内意见。

因篇幅限制未审查 65 个文件:apps/backend/crydaq-service/src/test/java/com/opentest/service/component/dashboard/SequenceDashboardStrategyTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/MeasurementCurrentSharedResultsTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/MeasurementEditsSpringContextTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/ProviderHistoricalMemberMetadataTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/RelatedResultCompleteFrameTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/RelatedResultStreamTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/SavedProviderTabularExportsTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/deviceplugin/DevicePluginManagementTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/ChannelCursorTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/ResultCurveReaderTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/SequenceSweepRmsConversionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/sync/ContinuousMeasurementSelectionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/provider/ProviderAudioPreviewOutputTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/provider/ProviderSavedCalculationModeTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/helper/DefaultDashboardResultConfigContextBuilderTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/AudioJNIBridgeServiceStreamV1Test.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/AudioJNIBridgeServiceTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/CalibrationWaveformEvidenceTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/GroupedFilePlaybackSampleRateTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/PostProcessJudgmentPublicationTest.java

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

private void planMonitorStableMemberMutation(StableMembershipState state,
Map<Long, LinkedHashSet<String>> desired, Set<StableMemberIdentity> changedMembers,
BatchGraphicChangePlan plan) {
if (state.bindings.stream()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 Stream.allMatch 在空流上返回 true。以下两种情况会直接 return,跳过整个成员变更规划:

  • state.bindings 为空;
  • 所有 binding 对应的 DashboardResultDto 都不在 dashboardResultMap 中(被 filter(Objects::nonNull) 过滤掉)。

其中包括“当前图谱尚无绑定,需要为新增成员插入 binding”的场景,此时新成员将被静默丢弃。

建议先确认存在至少一个可解析的结果,再判断是否全部为历史结果,例如:

List<DashboardResultDto> resolved = ...filter(Objects::nonNull).toList();
if (!resolved.isEmpty() && resolved.stream().allMatch(r -> r.getRequestId() != null)) return;

同时请补充空 binding 场景的测试。

} catch (RuntimeException persistenceFailure) {
// Preserve rows written before a later row failed so the recovery cascade
// can refresh the state already committed outside the rolled-back transaction.
confirmedChanges.merge(persistedChanges);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 这里的注释与事务语义矛盾。executeProjectChannelTransaction(PROPAGATION_REQUIRED, ...) 抛出异常后,事务内 persistBatchModifySuccessItems 写入的行已随事务回滚,并不存在“在回滚事务之外已提交”的状态。把 persistedChanges 合并回 confirmedChanges,会让外层恢复逻辑重放已回滚的工程侧类型变更。这正是外层 catch 注释“工程事务已回滚,只刷新已经由设备确认并提交的状态”所要避免的。

ProjectChannelMutationTransactionSqliteTest 原断言为 rolled-back project type must not be replayed during recovery,本 PR 将其改为期望 [0, 2],等于用测试确认了这一回归。

如果确有写入发生在独立事务(如 REQUIRES_NEW)中,请指出具体路径,并只合并那部分变更,不要合并整个副本。另外,merge 对 before 使用 putAll 会用副本值覆盖已确认的原始 before,建议改为 putIfAbsent。

*/
@Transactional(rollbackFor = Exception.class)
public void commitPlanBatch(BatchGraphicChangePlan plan, BatchOptions options) {
closeBatchProviderUnitQueryScope();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 commitPlanBatch 是公开的 @​Transactional 方法,却在入口处关闭一个由 batchApplyChannelMutationsWithinContextualUnitOperation 打开并“拥有”的 ThreadLocal 作用域。这会破坏所有权约定。

  • 如果 commitPlanBatch 在批处理方法内部被调用,后续仍在批处理范围内的单位查询会失去该作用域。
  • 嵌套调用会误判自己为 owner,重复打开和关闭作用域。
  • 如果它在批处理外被调用,则可能关闭同一线程上其他调用链遗留的作用域。

建议只由 owner 在 finally 中关闭作用域。如果提交前必须释放,请在批处理方法内显式处理,不要放在通用提交入口。

SequencePostProcessingUnitResolveCache postProcessingUnitCache,
boolean initializeCurrentDefaultUnits,
boolean declaredMemberFacts) {
if (declaredMemberFacts) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 declaredMemberFacts == true 时不再打开 UnitQueryScope,隐式依赖调用方已经设置 batchProviderUnitQueryScope。buildInitialStableAxisMembers 不止在批处理路径中调用。从其他入口以 declaredMemberFacts=true 调用时,provider 单位查询将在没有作用域的情况下执行,查询缓存和一致性语义都会改变。

建议在此处判断 batchProviderUnitQueryScope.get() != null,没有外层作用域时仍自行打开。

true);
currentState.setDashboardConfig(dashboard);
currentState.setAlgorithmCode(algorithmCode);
validateCurrentProviderMemberDeclarations(currentState);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 新增的 validateCurrentProviderMemberDeclarations 会在任一成员的 resolveMember 返回 null 时抛出 IllegalArgumentException,导致整个批量通道变更失败。下面这些情况在项目中是合法状态,provider 可能不返回声明,但现在会阻断无关通道的修改:

  • 未绑定通道槽位;
  • 物理通道已无法解析;
  • 插件被禁用或处于部分可用状态。

请确认 resolveMember 对这些状态的返回值,并补充对应测试。此外,第 15089 行和第 15122 行的两个重载几乎完全重复,建议抽取公共的单成员校验方法。


assertPointMapSurface(working.getGraphicConfigs(), 7);
verifyNoInteractions(files, axes, variables, executionDetails, artifacts);
verifyNoInteractions(files, axes, variables, artifacts);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 该测试的目的是验证“仅点图投影不查询文件和执行细节”。从 verifyNoInteractions 中移除 executionDetails 削弱了这一约束。如果生产代码新增了执行细节查询,请说明原因,并精确验证允许的调用(如 verify(executionDetails, only()).xxx(...)),不要整体放开。

var sql = new JdbcTemplate(database);
sql.execute("CREATE TABLE file(id INTEGER PRIMARY KEY,tenant_id INTEGER,created_time TEXT,updated_time TEXT,business_id TEXT,request_id INTEGER,business_type INTEGER,file_name TEXT,file_url TEXT,type INTEGER,shards_no INTEGER,wait_del INTEGER,temporary_result INTEGER NOT NULL DEFAULT 0)");
sql.execute(Files.readString(Path.of("apps/backend/crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));
sql.execute(Files.readString(Path.of("../crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 路径从仓库根相对路径改为模块相对路径 ../crydaq-server/...,测试仍然依赖进程工作目录:从仓库根目录或 IDE 以不同工作目录运行时会失败。SensorCalibrationStandardDisplayUnitTest.java:110 有同样问题。

建议参照 CanErrorLocalizationTest,基于 System.getProperty("basedir", ".") 解析路径。

manager.setBlockOnQueueFull(true);
manager.registerWriterFactory(TYPE, (fileName, appendMode) -> writer);
manager.init();
Field executorsField = ConcurrentFileManager.class.getDeclaredField("fileExecutors");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 测试通过反射替换私有字段 fileExecutors,并依赖其类型为可变 List<ThreadPoolExecutor>。生产代码重构该字段后,测试会在运行时而非编译期失败。另外,close()(第 157 行)只调用了 producers.shutdownNow(),没有 awaitTermination。生产者线程可能在测试结束后仍持有 latch 或 manager,并影响后续用例。

建议为 executor 提供测试注入点,并在 close() 中等待线程池终止。

return headers.keySet().stream()
.filter(name -> !name.equals(contract))
// Plugin modules own concrete providers; this boundary assertion covers the host runtime.
.filter(name -> !name.startsWith("com/opentest/plugins/"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 按包名前缀 com/opentest/plugins/ 排除,会让宿主模块中误放在该包下的实现逃过边界检查。建议改为按类来源(所属模块或 jar)过滤,或维护明确的允许清单。

Comment thread .github/workflows/ci.yml
run: pnpm typecheck:tests
- name: Unit tests
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
env:

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 中注入的 OPENTEST_LICENSE_ENVIRONMENT/OPENTEST_LICENSE_URL。开发者在本地直接运行 pnpm test:run 时环境不同,可能出现与 CI 不一致的结果。建议在测试 setup(如 apps/desktop/tests/setup.mjs)中设置这些默认值,让测试保持自包含。该文件属于工作流,需要 CODEOWNERS 审查。

@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)

PR 描述与实际改动严重不符,影响范围被低估。 描述称新增改动只涉及 ChannelCursor 的资源释放和前端测试期望,并声明没有修改生产行为。实际 diff 还修改了多处生产代码:

  • GraphicConfigService:新增成员声明校验、批量单位查询作用域、Monitor 稳定成员规划提前返回
  • BoxChannelService:批量修改失败后的恢复数据合并
  • BuiltInFftSignalAnalysisProvider / BuiltInOctaveSignalAnalysisProvider:BK FRF 结果路径
  • DefaultBoxExecutionSession:默认单位 meta
  • FrozenHistoricalArtifactFactResolver:历史时间窗身份哈希
  • ReferenceTestExecutionPlanner / ReferenceTestProjectionContextResolver
  • ProjectService
  • CI 工作流环境变量

其中多处会改变历史数据身份、恢复语义或业务结果。请在描述中如实列出这些改动及其依据,最好拆分成独立的拉取请求,并分别补充针对性测试。

多处测试被改成迎合新行为,没有说明契约变更依据:

  • SequenceReferenceTestUnitServiceTest:octave 的 supports 结果与单位被改变
  • ProviderEmptyCarrierUnitReadTest:测试名称是“仍失败”,断言却改为不失败
  • ProjectChannelMutationTransactionSqliteTest:原断言是“回滚的工程类型不得在恢复中重放”,现被反转
  • SoundPowerMultiRecordTest:放宽了 verifyNoInteractions

这些改动等于修改已确认的产品契约,需要关联需求或 ADR。

其他意见:

  • 描述中提到的 ChannelCursorTest 和三个前端测试文件不在本次可见 diff 中,无法核实。
  • 多个测试文件新增了无必要的全限定类名,违反 AGENTS.md 中的 Java 类型引用规范:java.util.Arrays/Collections/Optional、@​org.junit.jupiter.api.BeforeEach、com.opentest.dashboard.api.capability.CanChannelFacts、PluginDashboardConfigurationResolver 等。
  • FileServiceDirectivityPrefixSqliteTest、SensorCalibrationStandardDisplayUnitTest 改用 ../crydaq-server 相对路径,结果依赖当前工作目录。建议与 CanErrorLocalizationTest 一样基于 basedir 系统属性解析。

因篇幅限制未审查 65 个文件:apps/backend/crydaq-service/src/test/java/com/opentest/service/component/dashboard/SequenceDashboardStrategyTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/DirectRecordedResultAxisTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/MeasurementCurrentSharedResultsTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/ProviderHistoricalMemberMetadataTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/RelatedResultCompleteFrameTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/RelatedResultStreamTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/SavedProviderTabularExportsTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/deviceplugin/DevicePluginManagementTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/ChannelCursorTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/ResultCurveReaderTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/SequenceSweepRmsConversionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/sync/ContinuousMeasurementSelectionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/provider/ProviderAudioPreviewOutputTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/provider/ProviderSavedCalculationModeTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/helper/DefaultDashboardResultConfigContextBuilderTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/AudioJNIBridgeServiceStreamV1Test.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/AudioJNIBridgeServiceTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/GroupedFilePlaybackSampleRateTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/PostProcessJudgmentPublicationTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/SavedMathPostProcessRoundtripTest.java

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

private void planMonitorStableMemberMutation(StableMembershipState state,
Map<Long, LinkedHashSet<String>> desired, Set<StableMemberIdentity> changedMembers,
BatchGraphicChangePlan plan) {
if (state.bindings.stream()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 allMatch 对空流返回 true。当 state.bindings 为空,或所有 binding 都找不到对应的 DashboardResultDto 时,这里会直接 return,后续新增成员的规划被整体跳过。例如向空图谱新增 Monitor 成员时,不会生成任何 binding。

建议:

  • 先判断非空,再判断“全部为历史结果”,例如 !list.isEmpty() && list.stream().allMatch(...)。
  • 补充“空 bindings 新增成员”的用例。

} catch (RuntimeException persistenceFailure) {
// Preserve rows written before a later row failed so the recovery cascade
// can refresh the state already committed outside the rolled-back transaction.
confirmedChanges.merge(persistedChanges);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 注释称“保留已在回滚事务之外提交的行”。但这里使用 PROPAGATION_REQUIRED,persistBatchModifySuccessItems 和 applyBatchChannelTypeChanges 在同一个事务内执行,异常后会一起回滚,并不存在“事务外已提交”的行。

把 persistedChanges 合并回 confirmedChanges,会让恢复流程按已回滚的工程侧变更刷新状态。这与外层注释“只刷新已经由设备确认并提交的状态”直接矛盾,对应测试的断言也被反转(原文为“rolled-back project type must not be replayed”)。

此外,merge 使用 putAll 会用副本中的 before 覆盖原有快照。

请确认真实的事务边界。若确有部分行在独立事务中提交,应只合并这些已提交的条目,并说明契约变更的依据。

true);
currentState.setDashboardConfig(dashboard);
currentState.setAlgorithmCode(algorithmCode);
validateCurrentProviderMemberDeclarations(currentState);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 新增的 validateCurrentProviderMemberDeclarations(currentState) 在计算本次删除或解绑之前,校验当前全部 binding 成员,只要有一个成员缺少声明就抛出 IllegalArgumentException。

可能的后果:当某个通道已被 Provider 撤销声明、而本次操作正是要删除或解绑它时,整个批量通道操作都会失败,用户无法清理该成员。这与“解绑只改变执行可用性”的语义冲突。

建议:

  • 排除本次将被移除的成员。
  • 或只校验变更后仍保留的成员。
  • 补充“删除未声明成员”的用例。

另外,第 15089 行和第 15122 行的两个重载逻辑几乎相同,建议抽取公共的单成员校验方法。

*/
@Transactional(rollbackFor = Exception.class)
public void commitPlanBatch(BatchGraphicChangePlan plan, BatchOptions options) {
closeBatchProviderUnitQueryScope();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 commitPlanBatch 无条件关闭线程上的批量作用域,但该作用域由 batchApplyChannelMutationsWithinContextualUnitOperation 打开并拥有。

若 commitPlanBatch 在外层批量操作内部调用,外层作用域会被提前关闭,后续的 Provider 单位查询将在没有作用域的情况下执行;外层 finally 中的关闭也会变成空操作。这违反了“谁打开谁关闭”的约定。

建议删除此处的关闭调用,由拥有者在 finally 中关闭。若需要在提交前释放资源,应显式传递所有权。

SequencePostProcessingUnitResolveCache postProcessingUnitCache,
boolean initializeCurrentDefaultUnits,
boolean declaredMemberFacts) {
if (declaredMemberFacts) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 declaredMemberFacts == true 时不再打开 UnitQueryScope,隐含假设调用方一定处于 batchProviderUnitQueryScope 中。

如果有其他调用路径传入 true,且不经过批量方法,Provider 单位查询就会在没有作用域的情况下执行,缓存或一致性语义可能随之改变。

建议改为判断 batchProviderUnitQueryScope.get() != null,而不是依赖 declaredMemberFacts 这个语义无关的标志。

try {
openNextShard();
} catch (IOException | RuntimeException error) {
close();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 如果 close() 自身抛出异常,openNextShard() 的原始异常会被覆盖,排查时只能看到关闭失败。

建议改为 try { close(); } catch (Exception closeError) { error.addSuppressed(closeError); },再 throw error。

if (result == null || StrUtil.isBlank(result.getAlgorithmCode())) {
return null;
}
String resultCode = result == null ? null : result.getPrimaryCode();

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. 第 114 行已排除 result == null,这里的 result == null ? null : 是死代码。
  2. 第 118–122 行重复使用全限定名 com.opentest.common.enums.CalculateResultsEnum,违反 AGENTS.md 的类型引用规范,应改为 import 加简单类名。

另外,"Window" 字面量建议改为引用枚举或常量。

// Do not project sequence defaults from that dormant snapshot.
if (shared && BkFrfSequenceResultSupport.usesSharedInputs(
signal.getAlgorithmId(), signal.getAlgorithmConfig())
&& signal.getAlgorithmConfig().get(BkFrfSequenceResultSupport.CONFIG_KEY) == null) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 signal.getAlgorithmConfig().get(...) 前没有判空。若 usesSharedInputs 在配置为 null 时仍可能返回 true,这里会抛出 NPE。建议改用 null 安全的读取方式。


assertPointMapSurface(working.getGraphicConfigs(), 7);
verifyNoInteractions(files, axes, variables, executionDetails, artifacts);
verifyNoInteractions(files, axes, variables, artifacts);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 从 verifyNoInteractions 中移除 executionDetails,放宽了“仅点图投影不查询执行细节”的约束,但没有说明为什么现在需要访问它。若属于新增依赖,建议改为精确验证允许的调用。

.remove(-22002L);
}
}
private static com.opentest.service.dashboard.framework.PluginDashboardConfigurationResolver admissionDisabled() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 新增代码使用全限定类名 com.opentest.service.dashboard.framework.PluginDashboardConfigurationResolver,违反 AGENTS.md 的规范,应改为 import 加简单类名。

同类问题还出现在:

  • SensorCalibrationServiceTest 的 @​org.junit.jupiter.api.BeforeEach
  • MeasurementCurrentModifyTransactionTest 的 CanChannelFacts
  • MathTypeTransitionGraphicSqliteTest 中的 java.util.Arrays/Collections/Optional

@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)

总体评价

本 PR 混合了多处生产行为变更和大量测试夹具调整。其中涉及批量通道事务恢复、BK FRF 结果生成、Provider 单位查询作用域和历史结果身份推导,风险较高。描述中也说明 Windows 后端和完整前端 CI 结果仍未出来,在必需检查通过前不建议合入。建议把运行时行为修改和纯夹具修正拆成两个 PR 分别审查。

不能定位到具体行的意见

  • 未能审查的内容:前端运行时改动 use-grpc-exec.ts、tr-TR.ts,BuiltInOctaveSignalAnalysisProvider 新增的 appendBkCpbFrfItems 实现,以及 ChannelCursorTest、BuiltInFftSignalAnalysisProviderTest 等约 70 个文件没有出现在 diff 中。这些部分本次未审查,需要人工补审。MathTypeTransitionGraphicSqliteTest 的 diff 也被截断。
  • 测试预期被直接翻转:多处测试的预期值或断言被直接改掉,例如 SequenceReferenceTestUnitServiceTest、ProviderEmptyCarrierUnitReadTest、ProjectChannelMutationTransactionSqliteTest、SoundPowerMultiRecordTest。但本 diff 中没有对应的生产代码改动来说明原因。如果这些预期跟随的是 main 上已有的行为变更,请在描述中逐项给出对应提交或 Issue,避免把回归固化成测试基线。
  • 缺少必要测试:
    • GraphicConfigService 的批量单位查询作用域:嵌套调用和 commitPlanBatch 中途关闭作用域的场景。
    • validateCurrentProviderMemberDeclarations 遇到未绑定槽位时是否会阻断解绑。
    • BuiltInFftSignalAnalysisProvider 中参考/测试结果与普通 BK 结果混合请求的场景。
    • FrozenHistoricalArtifactFactResolver 的时间窗回退逻辑。
  • 项目规范:新增的生产代码和测试代码中有多处无必要的全限定类名,违反 AGENTS.md 中的 Java 类型引用规范,见下方具体意见。

因篇幅限制未审查 69 个文件:apps/backend/crydaq-service/src/test/java/com/opentest/service/component/dashboard/SequenceDashboardStrategyTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/DirectRecordedResultAxisTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/MeasurementCurrentSharedResultsTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/MeasurementEditsSpringContextTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/ProviderHistoricalMemberMetadataTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/RelatedResultCompleteFrameTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/RelatedResultStreamTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/SavedProviderTabularExportsTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/deviceplugin/DevicePluginManagementTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/ChannelCursorTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/ResultCurveReaderTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/SavedHierarchyExportWriterTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/SequenceSweepRmsConversionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/sync/CanOnlyTimeCompletionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/sync/ContinuousMeasurementSelectionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/provider/ProviderAudioPreviewOutputTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/provider/ProviderSavedCalculationModeTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/helper/DefaultDashboardResultConfigContextBuilderTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/AudioJNIBridgeServiceStreamV1Test.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/AudioJNIBridgeServiceTest.java

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

} catch (RuntimeException persistenceFailure) {
// Preserve rows written before a later row failed so the recovery cascade
// can refresh the state already committed outside the rolled-back transaction.
confirmedChanges.merge(persistedChanges);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 问题:persistedChanges 是在 PROPAGATION_REQUIRED 工程事务内部记录的变更,事务失败后这些写入已经回滚。把它合并回 confirmedChanges 后,后续恢复流程会把未提交的工程侧状态当作已确认状态来刷新。外层 catch 中原有注释写的是“只刷新已经由设备确认并提交的状态”,这与新逻辑相矛盾。

对应的 ProjectChannelMutationTransactionSqliteTest 也把原断言“rolled-back project type must not be replayed during recovery”改成了允许重放 2。这等于推翻了原有不变式,而本 PR 没有说明理由。

另外,新增注释声称这些行写在“已回滚事务之外”。只有当 persistBatchModifySuccessItems 内部确实使用独立事务(如 REQUIRES_NEW)逐行提交时,这个说法才成立。当前 diff 里看不到相应依据。

建议:

  • 只合并确实在独立事务中提交成功的条目,例如由持久化逐行返回“已提交”的记录。
  • 或者保留原有语义,并补充测试来证明哪些行真正落库。
  • 同时确认 merge 中 before.putAll 不会用事务内的中间值覆盖设备确认前的原始 before 值。

List<RequestedResultSpec> resultSpecs = resolveResultSpecs(resultConfigJson, algorithmId, algorithmConfigJson);
if(config.usesBkAlgorithm())for(var result:BkFftCurrentResultCatalog.mergedResults(config)) {
if(resultSpecs.stream().noneMatch(spec->result.getResultCode().equals(spec.resultCode)))resultSpecs.add(new RequestedResultSpec(result.getResultCode(),FREQUENCY_DOMAIN_CURVE_GRAPHIC_TYPE,null));
if (config.usesBkAlgorithm()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 问题:判断条件 resultSpecs.stream().noneMatch(spec -> spec.referenceTestPlan != null) 是针对整个请求的。只要有任意一个结果带参考/测试计划,下面两段逻辑就会对所有结果失效:

  • 不再补充 BkFftCurrentResultCatalog.mergedResults。
  • 不再执行 appendSharedBkTransferResults(第 194 行)。

结果是,同一请求里不带参考/测试计划的普通 BK 结果,会改走非 BK 的通用自谱/互谱路径。BK 算法配置被忽略,或者对应结果直接缺失。同时,第 200 行为 BK 配置跳过了校准自谱,行为也随之改变。

建议:按结果维度拆分,带 referenceTestPlan 的结果走参考/测试路径,其余 BK 结果仍走 BK 共享路径。并为这种混合请求补充回归测试。

private void planMonitorStableMemberMutation(StableMembershipState state,
Map<Long, LinkedHashSet<String>> desired, Set<StableMemberIdentity> changedMembers,
BatchGraphicChangePlan plan) {
if (state.bindings.stream()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 问题:空流上 allMatch 返回 true。因此在以下两种情况下,这里会直接 return,跳过本次成员变更规划:

  • state.bindings 为空。
  • 所有 binding 对应的 dashboardResultMap 条目都缺失,被 filter(Objects::nonNull) 过滤掉。

这时如果 desired 中有需要新增的成员,变更会被静默丢弃。

建议:先确认至少存在一个已解析的结果,再判断它们是否全部为历史结果(requestId != null),例如增加 !list.isEmpty() 条件。并补充“空绑定 + 新增成员”的测试。

SequencePostProcessingUnitResolveCache postProcessingUnitCache,
boolean initializeCurrentDefaultUnits,
boolean declaredMemberFacts) {
if (declaredMemberFacts) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 问题:当 declaredMemberFacts == true 时,这里完全不打开 Provider 单位查询作用域。这隐含假设调用方一定处在 batchApplyChannelMutationsWithinContextualUnitOperation 打开的批量作用域内。

这个假设在其他调用路径上未必成立:任何在批量作用域之外以 declaredMemberFacts=true 调用本方法的路径,都会在没有作用域的情况下查询单位。以前这些路径总是有作用域的,因此可能出现缓存失效,或作用域依赖的状态缺失。

建议:改为判断 batchProviderUnitQueryScope.get() != null 时复用已有作用域,否则仍然自行打开,而不是根据 declaredMemberFacts 决定。

*/
@Transactional(rollbackFor = Exception.class)
public void commitPlanBatch(BatchGraphicChangePlan plan, BatchOptions options) {
closeBatchProviderUnitQueryScope();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 问题:commitPlanBatch 是公开方法,它会无条件关闭当前线程的批量作用域,而这个作用域由外层 batchApply... 持有。

如果 commitPlanBatch 在批量操作内部被调用,之后同一批次的剩余逻辑就会在没有作用域的情况下运行。再结合第 13769 行的改动,这些逻辑将完全没有作用域。这破坏了 PR 描述中“在整个批量操作中保持同一个 provider unit-query scope”的目标。作用域的所有权也变得不清晰:持有者之外的代码也能关闭它。

建议:只由持有者在 finally 中关闭作用域。如果提交前确实必须关闭,请把这一点限制在持有者的调用点上,并说明理由。

try {
openNextShard();
} catch (IOException | RuntimeException error) {
close();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题:如果 close() 本身也抛出异常,原始的 openNextShard 异常就会丢失,排查时只能看到关闭失败。

建议:用 try/catch 包住 close(),把关闭时的异常通过 error.addSuppressed(closeError) 附加到原异常上,再抛出原始错误。

var sql = new JdbcTemplate(database);
sql.execute("CREATE TABLE file(id INTEGER PRIMARY KEY,tenant_id INTEGER,created_time TEXT,updated_time TEXT,business_id TEXT,request_id INTEGER,business_type INTEGER,file_name TEXT,file_url TEXT,type INTEGER,shards_no INTEGER,wait_del INTEGER,temporary_result INTEGER NOT NULL DEFAULT 0)");
sql.execute(Files.readString(Path.of("apps/backend/crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));
sql.execute(Files.readString(Path.of("../crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题:这里改用了 ../crydaq-server/...,这是相对于当前工作目录的路径。只有在工作目录是模块目录时(Maven Surefire 默认如此)才能解析成功;从仓库根目录或 IDE 运行时会找不到文件。SensorCalibrationStandardDisplayUnitTest 第 110 行存在同样的问题。

建议:参照 CanErrorLocalizationTest,基于 System.getProperty("basedir", ".") 来解析路径。

return headers.keySet().stream()
.filter(name -> !name.equals(contract))
// Plugin modules own concrete providers; this boundary assertion covers the host runtime.
.filter(name -> !name.startsWith("com/opentest/plugins/"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题:这里把 com/opentest/plugins/ 整个包前缀排除在边界检查之外,会削弱框架一致性约束。按 CONTEXT.md 的定义,宿主不依赖插件仓库;如果这些类确实出现在宿主测试类路径上,这本身就值得确认。

建议:

  • 改为精确排除已知的插件模块或类名,而不是按包前缀整体豁免。
  • 说明这些类为什么会进入宿主类路径。


assertPointMapSurface(working.getGraphicConfigs(), 7);
verifyNoInteractions(files, axes, variables, executionDetails, artifacts);
verifyNoInteractions(files, axes, variables, artifacts);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题:测试名声明“仅点位图投影不查询文件、也不规划曲线轴”,但这里从 verifyNoInteractions 中移除了 executionDetails,放宽了断言。这说明生产路径新增了对执行详情的读取,而本 PR 没有说明原因。

建议:如果这次读取是必要的,请改为精确校验调用次数和参数;如果不是,请移除生产代码中的多余查询,而不是放宽测试。

manager.setBlockOnQueueFull(true);
manager.registerWriterFactory(TYPE, (fileName, appendMode) -> writer);
manager.init();
Field executorsField = ConcurrentFileManager.class.getDeclaredField("fileExecutors");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 问题:测试通过反射替换 ConcurrentFileManager 的私有字段 fileExecutors,并依赖其具体类型(List<ThreadPoolExecutor>)。只要生产类重命名或重构这个字段,测试就会失效,而且失效时不会有编译期提示。

建议:在 ConcurrentFileManager 中提供包级可见的 executor 工厂或队列注入点,取代反射修改私有字段的做法。

@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)

总体评价:本 PR 的标题是 fix(ci),但除了 CI 和测试夹具调整,还包含多处后端运行时行为变更,例如 GraphicConfigService、BoxChannelService、BK FFT/CPB 结果路径、冻结时间窗身份和参考测试计划。这些变更影响真实业务语义,与"修复 CI 基线"的范围不一致。建议拆分:CI/测试稳定性一个 PR,运行时行为修复按领域分别提交,并用 Refs #<编号> 关联对应缺陷,方便测试按日常包逐项复验。

主要风险:

  • GraphicConfigService 新增的批量单位查询作用域依赖 ThreadLocal 隐式传递。declaredMemberFacts=true 的路径不再自行打开作用域,commitPlanBatch 又会提前关闭外层作用域,作用域生命周期较脆弱。
  • 新增的 provider 成员声明校验会在任一成员声明不完整时让整次批量通道操作失败,可能影响插件升级后的存量工程。
  • planMonitorStableMemberMutation 新增的提前返回在 bindings 为空时也会成立。
  • 多个测试的断言被改为符合新行为,但测试名称仍描述旧语义,例如 undeclaredUnitStillFailsInsteadOfInventingADefault 和 capabilityFollowsExactCurrentAlgorithm...。部分测试的覆盖被削弱,例如 MathTypeTransitionGraphicSqliteTest 调换了失败注入顺序。需要说明这些期望变化的依据。

缺少的测试:DefaultBoxExecutionSession 的去重逻辑、FrozenHistoricalArtifactFactResolver 的回退逻辑、ReferenceTestProjectionContextResolver 和 ReferenceTestExecutionPlanner 对休眠 BK CPB 配置的处理、BK FFT 单通道互谱路径,在本次可见 diff 中都没有对应的新增或修改测试。ChannelCursorTest、BuiltInFftSignalAnalysisProviderTest 等文件未提供,无法确认覆盖情况。

未能审查:前端运行时改动 use-grpc-exec.ts、tr-TR.ts 及全部前端测试文件未提供,无法审查。描述中提到 tr-TR.ts 是浅合并,并要求补充命名空间完整,建议补充一个测试,防止某个命名空间不完整时覆盖掉英文基线中的整组键。

项目规范:多处新增代码使用了无必要的全限定类名,例如 com.opentest.common.enums.CalculateResultsEnum、java.util.Arrays、@​org.junit.jupiter.api.BeforeEach,违反 AGENTS.md 的 Java 类型引用规范,下文逐条标注。

因篇幅限制未审查 69 个文件:apps/backend/crydaq-service/src/test/java/com/opentest/service/component/dashboard/SequenceDashboardStrategyTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/DirectRecordedResultAxisTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/GraphicConfigServiceMathSavePlanningTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/MeasurementCurrentSharedResultsTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/MeasurementEditsSpringContextTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/ProviderHistoricalMemberMetadataTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/RelatedResultCompleteFrameTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/RelatedResultStreamTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/SavedProviderTabularExportsTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/deviceplugin/DevicePluginManagementTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/ChannelCursorTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/ResultCurveReaderTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/SavedHierarchyExportWriterTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/SequenceSweepRmsConversionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/sync/CanOnlyTimeCompletionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/sync/ContinuousMeasurementSelectionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/provider/ProviderAudioPreviewOutputTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/provider/ProviderSavedCalculationModeTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/helper/DefaultDashboardResultConfigContextBuilderTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/AudioJNIBridgeServiceStreamV1Test.java

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

private void planMonitorStableMemberMutation(StableMembershipState state,
Map<Long, LinkedHashSet<String>> desired, Set<StableMemberIdentity> changedMembers,
BatchGraphicChangePlan plan) {
if (state.bindings.stream()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 allMatch 在空流上返回 true。以下情况都会直接 return,跳过全部成员变更规划:state.bindings 为空(例如空图首次加入成员);所有 binding 对应的 DashboardResultDto 都缺失,被 filter(Objects::nonNull) 过滤掉。这与本意"全部绑定都是历史结果时跳过"不符。

建议改为先收集非空结果,再判断:!results.isEmpty() && results.stream().allMatch(r -> r.getRequestId() != null)。同时补充"空 bindings 新增成员"的测试。

SequencePostProcessingUnitResolveCache postProcessingUnitCache,
boolean initializeCurrentDefaultUnits,
boolean declaredMemberFacts) {
if (declaredMemberFacts) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 declaredMemberFacts=true 时不再打开 provider 单位查询作用域。这隐式假设所有此类调用都发生在 batchApplyChannelMutationsWithinContextualUnitOperation 持有的 batchProviderUnitQueryScope 内。如果有其他调用方(或今后新增的调用方)在批量方法之外以 true 调用,查询会在没有作用域的情况下执行,行为与改动前不一致。

建议:当 batchProviderUnitQueryScope.get() == null 时仍自行打开作用域,不要按 declaredMemberFacts 分支;或者在入口断言作用域已存在。

true);
currentState.setDashboardConfig(dashboard);
currentState.setAlgorithmCode(algorithmCode);
validateCurrentProviderMemberDeclarations(currentState);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 新增的 validateCurrentProviderMemberDeclarations(currentState) 会遍历当前仪表盘全部图谱的全部 provider 成员。只要任一成员的 resolveMember 返回 null,或默认组合不在候选内,就抛出 IllegalArgumentException,导致整次批量通道操作失败,包括与该成员无关的通道变更。插件升级后,存量工程中残留的旧成员可能阻断所有通道修改,与"工作区部分可用"的处理思路相冲突。

建议:

  • 校验范围限定在本次受影响的成员;
  • 或者将不可解析成员降级为不可用状态并记录日志,不要整体失败;
  • 为上述场景补充测试。

另外,同一批次在 14984 行还会对稳定成员再校验一遍;两个重载的校验逻辑几乎重复,建议抽取单一实现,避免重复调用 resolveMember。

*/
@Transactional(rollbackFor = Exception.class)
public void commitPlanBatch(BatchGraphicChangePlan plan, BatchOptions options) {
closeBatchProviderUnitQueryScope();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 commitPlanBatch 是公开的事务方法。它在开头关闭线程上的批量作用域,而这个作用域由外层 batchApplyChannelMutationsWithinContextualUnitOperation 持有。如果 commit 在批量方法内部被调用,commit 之后外层剩余逻辑会在没有作用域的情况下运行。如果作用域由其他调用链在同一线程打开,这里也会被误关闭。

建议由作用域所有者统一关闭,不要在 commitPlanBatch 中隐式关闭;如果确实需要在提交前释放,请在注释中说明原因,并补充嵌套调用的测试。

} catch (RuntimeException persistenceFailure) {
// Preserve rows written before a later row failed so the recovery cascade
// can refresh the state already committed outside the rolled-back transaction.
confirmedChanges.merge(persistedChanges);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 persistedChanges 是在已经回滚的工程事务中记录的变更。注释说这些行"已在回滚事务之外提交",但闭包运行在 PROPAGATION_REQUIRED 事务内,正常情况下其中的写入会一起回滚。这与 1491 行的原注释"只刷新已经由设备确认并提交的状态"相矛盾。

另外,merge 使用 before.putAll / projectInputBefore.putAll,会用事务内的中间快照覆盖 confirmedChanges 中已有键的原始 before 状态,恢复时可能刷新成错误的基线。

建议:

  • 明确哪些写入确实在事务外提交,只合并这部分;
  • before 和 projectInputBefore 改用 putIfAbsent;
  • 修正注释,并说明 ProjectChannelMutationTransactionSqliteTest 中期望从 [0] 改为 [0, 2] 的业务依据。

@ExtendWith(MockitoExtension.class)
class SensorCalibrationServiceTest {

@org.junit.jupiter.api.BeforeEach

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 @​org.junit.jupiter.api.BeforeEach 应改为 import 加 @​BeforeEach,以符合 AGENTS.md 的规范。

var sql = new JdbcTemplate(database);
sql.execute("CREATE TABLE file(id INTEGER PRIMARY KEY,tenant_id INTEGER,created_time TEXT,updated_time TEXT,business_id TEXT,request_id INTEGER,business_type INTEGER,file_name TEXT,file_url TEXT,type INTEGER,shards_no INTEGER,wait_del INTEGER,temporary_result INTEGER NOT NULL DEFAULT 0)");
sql.execute(Files.readString(Path.of("apps/backend/crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));
sql.execute(Files.readString(Path.of("../crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 改成 ../crydaq-server/... 后,测试依赖工作目录必须是模块目录:Maven 下可以运行,但在 IDE 中以仓库根目录运行会失败。建议参照 CanErrorLocalizationTest,基于 System.getProperty("basedir", ".") 解析路径。SensorCalibrationStandardDisplayUnitTest 第 110 行有同样问题。

return headers.keySet().stream()
.filter(name -> !name.equals(contract))
// Plugin modules own concrete providers; this boundary assertion covers the host runtime.
.filter(name -> !name.startsWith("com/opentest/plugins/"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 按包名前缀排除 com/opentest/plugins/,削弱了边界检查。如果宿主运行时误引入该包下的实现,这条测试将无法发现。建议说明这些类出现在宿主类路径中的原因,例如作为测试依赖;更好的做法是从扫描来源(按模块或类路径条目)排除,不要按包名过滤。


assertPointMapSurface(working.getGraphicConfigs(), 7);
verifyNoInteractions(files, axes, variables, executionDetails, artifacts);
verifyNoInteractions(files, axes, variables, artifacts);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 从 verifyNoInteractions 中移除 executionDetails,放宽了"仅点图投影不查询执行细节"的约束。如果新增交互是预期行为,建议改为精确 verify 允许的调用,不要完全放开。

manager.setBlockOnQueueFull(true);
manager.registerWriterFactory(TYPE, (fileName, appendMode) -> writer);
manager.init();
Field executorsField = ConcurrentFileManager.class.getDeclaredField("fileExecutors");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 通过反射替换私有字段 fileExecutors,并依赖其类型为 List<ThreadPoolExecutor>,与内部实现强耦合,重构时测试容易无声失效。建议在 ConcurrentFileManager 中提供包级可见的执行器工厂注入点。

@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)

本次 PR 合并了多处产品行为修改和大量测试夹具调整,范围明显大于标题中的“修复 CI 基线”。以下问题建议合入前处理:

  1. BoxChannelService 恢复语义被反转:已回滚的工程侧变更会在恢复时被重放。ProjectChannelMutationTransactionSqliteTest 的断言也随之从“不得重放”改成了“重放”。

  2. GraphicConfigService 的批量单位查询作用域:引入后,非批量路径在 declaredMemberFacts=true 时不再打开作用域。新增的全量成员声明校验也可能阻断正在删除的成员。planMonitorStableMemberMutation 在 bindings 为空时,allMatch 为真,会直接跳过规划。

  3. 测试断言被放宽或反转,生产侧依据不明:

    • SequenceReferenceTestUnitServiceTest:supports 结果由 false 改为 true;Phase Assigned Spectrum 的单位由 Pa·Vrms 改为 V²。
    • ProviderEmptyCarrierUnitReadTest:由“必须失败”改为“返回空计划”。
    • MathTypeTransitionGraphicSqliteTest:失败注入被提前,不再覆盖“图谱写入后回滚”的场景。

    这些改动对应的生产代码不在本 diff 中,PR 描述也未说明原因。请补充依据,或在 PR 描述中列为行为变更。

  4. 违反 AGENTS.md 的 Java 类型引用规范:多处新增代码直接使用全限定类名,且不存在同名冲突。涉及 FrozenHistoricalArtifactFactResolver、MeasurementHistoryEditRollbackTest、MeasurementCurrentModifyTransactionTest、MathTypeTransitionGraphicSqliteTest(java.util.Arrays/Collections/Optional)、SensorCalibrationServiceTest(@​org.junit.jupiter.api.BeforeEach),均应改为 import 加简单类名。

  5. 未能审查的部分:前端文件未随本次 diff 提供,tr-TR.ts 和 use-grpc-exec.ts 无法审查。描述称 locale 仍是浅合并,且要求补充命名空间完整。若某个命名空间缺键,对应英文回退会被整体覆盖而丢失,建议补充一个校验命名空间完整性的测试。

  6. CI 依赖未经确认的 POM 属性:-Dskip.crowdin.download=true 依赖 POM 中存在该属性开关,本 diff 中看不到,请确认属性名与 POM 一致,否则该参数不会生效。

因篇幅限制未审查 69 个文件:apps/backend/crydaq-service/src/test/java/com/opentest/service/component/dashboard/SequenceDashboardStrategyTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/DirectRecordedResultAxisTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/GraphicConfigServiceMathSavePlanningTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/MeasurementCurrentSharedResultsTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/MeasurementEditsSpringContextTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/ProviderHistoricalMemberMetadataTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/RelatedResultCompleteFrameTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/RelatedResultStreamTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/dashboard/framework/SavedProviderTabularExportsTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/deviceplugin/DevicePluginManagementTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/ChannelCursorTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/ResultCurveReaderTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/export/SavedHierarchyExportWriterTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/SequenceSweepRmsConversionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/sync/CanOnlyTimeCompletionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/core/sync/ContinuousMeasurementSelectionTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/provider/ProviderAudioPreviewOutputTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/grpc/provider/ProviderSavedCalculationModeTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/helper/DefaultDashboardResultConfigContextBuilderTest.java、apps/backend/crydaq-service/src/test/java/com/opentest/service/jni/AudioJNIBridgeServiceStreamV1Test.java

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

} catch (RuntimeException persistenceFailure) {
// Preserve rows written before a later row failed so the recovery cascade
// can refresh the state already committed outside the rolled-back transaction.
confirmedChanges.merge(persistedChanges);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 persistedChanges 中新记录的条目,是在 PROPAGATION_REQUIRED 事务内由 persistBatchModifySuccessItems/applyBatchChannelTypeChanges 写入的。事务抛异常后这些写入已全部回滚,并非注释所说的“committed outside the rolled-back transaction”。

merge 会用 putAll 把它们并入 confirmedChanges,并覆盖设备已确认条目的 after。外层恢复逻辑因此会按已回滚的工程状态刷新投影,与第 1491 行注释“只刷新已经由设备确认并提交的状态”相矛盾。测试 mixedBatchKeepsConfirmedDeviceStateWhenProjectProjectionRollsBack 原本正是为防止这种情况,现在断言却被改成了 [0, 2]。

建议:

  • 如果确实存在事务外已提交的部分写入,应只合并那部分条目,不要合并整份 persistedChanges。
  • 否则应撤销此改动,并恢复原测试断言。

private void planMonitorStableMemberMutation(StableMembershipState state,
Map<Long, LinkedHashSet<String>> desired, Set<StableMemberIdentity> changedMembers,
BatchGraphicChangePlan plan) {
if (state.bindings.stream()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 state.bindings 为空,或全部 binding 的 result 在 Map 中缺失时,allMatch 对空流返回 true,方法会直接 return。结果是:向尚无成员的图谱添加 Monitor 成员时,不会生成任何插入计划。

建议改为“存在至少一个 result,且全部为历史结果”时才跳过,例如先收集结果列表,判断 !list.isEmpty() && list.stream().allMatch(...)。同时补一个空 binding 时新增成员的测试。

SequencePostProcessingUnitResolveCache postProcessingUnitCache,
boolean initializeCurrentDefaultUnits,
boolean declaredMemberFacts) {
if (declaredMemberFacts) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 declaredMemberFacts == true 时,这里不再打开 provider 单位查询作用域,而是默认外层已有批量作用域。但该判断没有检查 batchProviderUnitQueryScope.get() != null。

在 batchApplyChannelMutationsWithinContextualUnitOperation 之外以 declaredMemberFacts=true 调用本方法时,会在完全没有作用域的情况下查询单位,行为与修改前不一致。另外,commitPlanBatch 开头会关闭批量作用域,若提交后的流程仍会走到这里,同样没有作用域。

建议只在批量作用域存在时复用,否则仍按原逻辑 try (var scope = openProviderUnitQueryScope())。

*/
@Transactional(rollbackFor = Exception.class)
public void commitPlanBatch(BatchGraphicChangePlan plan, BatchOptions options) {
closeBatchProviderUnitQueryScope();

ghost Nov 19, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 commitPlanBatch 是公开的事务方法,却在入口直接关闭当前线程的批量作用域,而不判断调用方是否为作用域所有者。

  • 若某个批量操作在一次批处理中多次提交,或提交后仍有单位查询,后续查询会失去“同一批次共享一个作用域”的保证,与 PR 描述的目标矛盾。
  • 由于没有 owner 标记,嵌套调用方也会关闭外层的作用域。

建议让作用域只在所有者的 finally 中关闭;如需在提交前释放,应由所有者显式完成。

if (providerGraphicUnitService == null) {
return;
}
for (Map.Entry<Long, List<GraphicResultCodeDto>> entry : bindingsByResult.entrySet()) {

ghost Nov 19, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 这里校验的是 bindingsByResult 中全部现有成员,参数 desiredChannelsByResult 完全未被使用。

在通道删除或换型的场景中,DashboardResult 可能已先移除某个通道,第 15161 行注释也说明了这一点。此时该成员的 resolveMember 返回 null,这里会抛出 IllegalArgumentException,导致本应移除该成员的批量操作失败。第 31013 行的全量校验 validateCurrentProviderMemberDeclarations(currentState) 也有同样问题,它在应用变更之前执行。

建议只校验变更后仍保留的成员,即 desiredChannelsByResult 与现有成员的交集,并补充“删除已失去声明的成员”测试。另外,两个重载的校验逻辑几乎完全重复,建议抽出公共方法。

if (result == null || StrUtil.isBlank(result.getAlgorithmCode())) {
return null;
}
String resultCode = result == null ? null : result.getPrimaryCode();

ghost Nov 19, 2026

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. 第 118–122 行直接使用全限定名 com.opentest.common.enums.CalculateResultsEnum,不存在同名冲突,违反 AGENTS.md 的 Java 类型引用规范,应改为 import。
2. 第 114 行已排除 result == null,第 117 行的 result == null ? null : ... 是死代码。
3. 字面量 "Window" 出现了两次,建议提取为常量或使用已有枚举,避免拼写漂移。

try {
openNextShard();
} catch (IOException | RuntimeException error) {
close();

ghost Nov 19, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 如果 close() 自身抛出异常,原始的 openNextShard 异常会被覆盖。建议用 try/catch 包住 close(),并通过 error.addSuppressed(closeError) 保留原因后再抛出原异常。

binding.getDashboardResult().setProviderPresentationFacts(Map.of("defaultSignalType", "VOLTAGE"));
assertEquals("Graphic result carrier has no resolvable selected unit",
assertThrows(IllegalArgumentException.class, () -> read(binding, LegacyAxisReadContext.current())).getMessage());
var plan = read(binding, LegacyAxisReadContext.current());

ghost Nov 19, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 测试名为 undeclaredUnitStillFailsInsteadOfInventingADefault,断言却改成了“返回空计划”。未声明单位从“报错”变为“静默产生空轴和空绑定”,这是行为变更,可能让配置错误在界面上表现为空图。

请确认这是有意为之:

  • 若是,应重命名测试并在 PR 描述中说明;
  • 若不是,应恢复失败断言。

.remove(-22002L);
}
}
private static com.opentest.service.dashboard.framework.PluginDashboardConfigurationResolver admissionDisabled() {

ghost Nov 19, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 新增方法使用全限定名 com.opentest.service.dashboard.framework.PluginDashboardConfigurationResolver,违反 AGENTS.md 的类型引用规范,应改为 import 加简单类名。同类问题还有:

  • MeasurementCurrentModifyTransactionTest.java:269 的 CanChannelFacts
  • SensorCalibrationServiceTest.java:55 的 @​org.junit.jupiter.api.BeforeEach
  • MathTypeTransitionGraphicSqliteTest.java 中多处 java.util.Arrays/Collections/Optional

var sql = new JdbcTemplate(database);
sql.execute("CREATE TABLE file(id INTEGER PRIMARY KEY,tenant_id INTEGER,created_time TEXT,updated_time TEXT,business_id TEXT,request_id INTEGER,business_type INTEGER,file_name TEXT,file_url TEXT,type INTEGER,shards_no INTEGER,wait_del INTEGER,temporary_result INTEGER NOT NULL DEFAULT 0)");
sql.execute(Files.readString(Path.of("apps/backend/crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));
sql.execute(Files.readString(Path.of("../crydaq-server/src/main/resources/db/migration/V2.5.0_20261103170000__add_frozen_file_cleanup_root.sql")));

ghost Nov 19, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 相对路径 ../crydaq-server/... 依赖 JVM 工作目录恰好是模块目录:从仓库根目录或 IDE 运行时会找不到文件,SensorCalibrationStandardDisplayUnitTest.java:110 也有同样问题。建议参考 CanErrorLocalizationTest,基于 System.getProperty("basedir") 解析路径。

@JohnWuY
JohnWuY merged commit 3749290 into main Nov 19, 2026
@JohnWuY
JohnWuY deleted the fix/main-ci-baseline-20261116 branch November 19, 2026 10:31
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.

4 participants