Skip to content

test(ci): AI 审查飞书通知测试(勿合并) - #19

Closed
JohnWuY wants to merge 1 commit into
mainfrom
test/ai-review-notify-smoke
Closed

JohnWuY wants to merge 1 commit into
mainfrom
test/ai-review-notify-smoke

Conversation

@JohnWuY

@JohnWuY JohnWuY commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

用于验证 AI 审查完成后的飞书通知,验证后关闭,不合并。

@JohnWuY
JohnWuY requested a review from a team November 14, 2026 09:31

@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 仅新增一个临时脚本 tools/ai-review-smoke.mjs,描述说明用于验证通知、不会合并。如果误合入 main,该文件会成为无用代码,且 average 存在必现的运行时错误。建议验证完成后按计划关闭 PR,不要合并。如果需要保留该函数,请修复下方问题,并按 单元测试说明 的目录约定补充测试,覆盖正常数组、空数组和元素缺少 value 等边界情况。

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

Comment thread tools/ai-review-smoke.mjs
// Temporary file for testing the ai-review Feishu notification. This pull request will be closed without merging.
export function average(items) {
let total = 0;
for (let i = 0; i <= items.length; i++) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 高 循环边界越界(off-by-one):条件 i <= items.length 会在最后一轮访问 items[items.length],该值为 undefined,第 5 行读取 .value 时会抛出 TypeError: Cannot read properties of undefined。只要传入数组,函数必然抛错,无法返回结果。

建议改为 i < items.length,或直接使用:

const total = items.reduce((sum, item) => sum + item.value, 0);

Comment thread tools/ai-review-smoke.mjs
for (let i = 0; i <= items.length; i++) {
total += items[i].value;
}
return total / items.length;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 中 空数组未处理:修复越界后,items 为空数组时会返回 0 / 0,即 NaN,调用方很难察觉。请明确空输入的约定,例如提前返回 0、null,或抛出带说明的错误:

if (items.length === 0) {
  throw new RangeError('items must not be empty');
}

Comment thread tools/ai-review-smoke.mjs
export function average(items) {
let total = 0;
for (let i = 0; i <= items.length; i++) {
total += items[i].value;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 低 缺少输入校验:如果某个元素的 value 缺失或不是数字,total 会变成 NaN,或者因为字符串拼接得到错误结果。如果函数需要正式使用,建议校验 Number.isFinite(items[i].value),或在文档中注明输入约定。

@JohnWuY

JohnWuY commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator Author

AI 审查飞书通知测试完成,关闭,不合并。

@JohnWuY JohnWuY closed this Nov 14, 2026
@JohnWuY
JohnWuY deleted the test/ai-review-notify-smoke branch November 14, 2026 09:32
KyleHuangFromHZ added a commit that referenced this pull request Nov 16, 2026
## Summary

GB/T 1094.10 简易法和 GB/T 32524.2 工程法各自提供真实测量面积。宿主在 JNI
调用边界把该面积换算成等面积半球的输入,使现有 Windows 算法接口可继续使用。

```text
标准的真实面积 S → r = √(S / 2π) → 原简易法 / 工程法 JNI
标准的测量面、点位和报告依据 → 原样保留
```

## Evidence

- **Before:** 显式面积通过未发布的 `surfaceType=-1` 传入,依赖定制的算法 DLL。
**After:**
单测验证同一面积通过发布接口进入简易法及工程法的实时、结束计算路径,旧几何输入保持原有映射。提供显式面积时不再转发箱形或圆柱几何参数;简易法和工程法的参数记录都拒绝无效面积和面积与普通面型的混用。同步最新主线后
53 项相关单测通过。
- Windows-huang、51 号设备、现有客户端与现有授权:两项均做 9 点、背景和正式各 15 秒,新结果文件均可读,Data
Selector 和历史图谱正常。
  - 1094.10 简易法,Measure #19:LwZ 69.451 dBSWL,K2Z 0.478 dB。
  - 32524.2 工程法,Measure #20:LwZ 54.497 dBSWL,K2Z 0.974 dB。
- 另以现有运行库做 80 个简易法、5 个工程法 JNI 数值用例,覆盖 **0.75–125 m²**(包括
14.5497、31.46、48.8496 m²),通过等面积输入核对面积、修正值和声功率。复测前后证书和 DLL
校验一致。设备验收使用现有客户端;没有把候选 JAR 或主线 DLL 换到实测客户端。

上一轮 Windows 全量 CI 的 24 个前端失败文件和 5 个后端失败类,与[同期 main
运行](https://github.com/crysound/OpenTest/actions/runs/43826819291)以及[后续
main
运行](https://github.com/crysound/OpenTest/actions/runs/43837080640)一致。本
PR 只修改声功率代码。

配套:原宿主改动 #26 已合入;插件见 [OpenTest-Plugins-Internal
#5](https://github.com/crysound/OpenTest-Plugins-Internal/pull/5)。

## Merge Danger

**Door:** two-way,可正常回退 Java 提交;不改 DLL、授权文件、数据库或插件 API 形状。

**Blast Radius:** 声功率中显式传入测量面积的调用。

---------

Co-authored-by: 黄凯 <324400663+KyleHuangFromHZ@users.noreply.github.com>
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.

1 participant