Skip to content

feat(action): ✨ Add confidence to inline comments#6

Merged
jorben merged 7 commits into
masterfrom
feat/inline-comment-confidence
Mar 4, 2026
Merged

feat(action): ✨ Add confidence to inline comments#6
jorben merged 7 commits into
masterfrom
feat/inline-comment-confidence

Conversation

@jorben

@jorben jorben commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add confidence display to inline review comments so users can tune action inputs with better context
  • Place the confidence line above the From SubAgent tag in inline comment bodies
  • Add confidence label localization (Confidence / 置信度) and normalize output to two decimal places
  • Extend inline body tests to verify confidence rendering and placement order

Test Plan

  • npm run check
  • npm test

🤖 Generated with Codex Cli

@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown

AI 代码审查汇总

PR: #6 (feat(action): ✨ Add confidence to inline comments)
指定语言: 简体中文

总体评价

共发现 13 条可执行问题,建议优先处理 CRITICAL/HIGH。

主要问题(按严重级别)

  • MEDIUM (10)
    • src/agents.js:28 - finding schema 从必填数值改为 nullable optional 后缺少兼容性测试
    • src/aggregate.js:140 - 默认 na 策略允许未知置信度绕过最小置信度阈值
    • src/config.js:78 - 配置新增枚举输入解析缺少非法值与大小写归一化测试
    • src/index.js:196 - 新增置信度格式化与展示路径缺少针对边界值的单元测试
    • src/index.js:238 - Review body 新增字段未国际化,中文模式会出现英文文案
    • src/index.js:339 - Review/Summary 新增 unknownConfidenceFindings 统计缺少一致性测试
    • test/agents.test.js:168 - createReviewerAgent 对 confidence 边界值仅覆盖上越界,缺少下越界与 NaN/Infinity 场景
    • test/aggregate.test.js:276 - 缺少 fallbackConfidenceValue 非法/越界输入的钳制测试
  • LOW (3)
    • test/agents.test.js:165 - 测试对校验错误文案做精确匹配,容易因依赖升级产生脆弱失败
    • test/aggregate.test.js:165 - 缺少 mergeFinding 在置信度相等时的稳定性与可观测性测试
    • test/config.test.js:135 - 配置测试缺少“策略联动”断言,无法验证 fallback_confidence_value 在非 fallback 策略下被忽略的行为

可执行建议

  • buildReviewBody 中所有可见字符串改为从 getTextBundle 获取,避免硬编码英文。
  • 补充单测覆盖 missing_confidence_policy 三种策略(drop/na/fallback)对最终 normalizedFindings 数量及 unknown 计数的影响。
  • 增加端到端断言:summary 中 unknown 数与 review body 中 unknown 数一致。
  • 新增 test/index.test.js 用例覆盖 formatConfidenceValuebuildInlineBodybuildReviewBody 导出函数。
  • test/config.test.js 中加入 parseEnumInput 相关场景,重点覆盖非法值抛错。
  • test/agents.test.js(或相应文件)增加 finding schema 的 nullable confidence 契约测试。
  • 增加一条端到端轻量测试:输入含缺失 confidence 的 findings,断言 summary 与 review body 的 unknown 计数一致。
  • 在 action 配置说明或变更日志中明确:默认 missingConfidencePolicy 为 na,confidence 可能为 null(行为变更)
  • 在输出边界(发布/序列化前)增加轻量防御:对 confidence 字段做类型约束或显式格式化,避免下游隐式数值假设
  • 考虑新增一个兼容模式开关(例如 legacyConfidenceDefault=0.8)用于平滑升级旧使用方
  • normalizeFindings 增加一组表驱动测试,覆盖 missingConfidencePolicy 为非法值时回退到 na
  • normalizeFindings 补充 fallbackConfidenceValue'abc'/-1/2/undefined 场景,断言 clamp/default 结果。

潜在风险

  • 国际化文案混用导致用户可见体验回退。
  • 策略配置与展示统计若无测试,后续改动可能引入口径漂移。
  • 缺少测试导致 CI 无法及时发现文案键缺失或统计回归。
  • 置信度默认语义变化可能引发历史基线偏移。
  • 配置输入错误在运行时失败,影响 PR 自动审查可用性。
  • 行为兼容性风险:历史依赖 minConfidence 的用户会看到更多“未知 confidence”结果
  • 生态兼容风险:第三方处理脚本若未处理 null,可能出现排序/比较异常
  • 配置容错分支未被测试锁定,后续重构可能引入静默行为变化。
  • 合并 tie-break 未定义清晰测试契约,可能造成结果不稳定。
  • 告警噪声注入导致真实高置信度安全问题被淹没
  • 团队误以为 minConfidence 可统一约束所有发现,产生策略错觉
  • 未来依赖升级导致错误消息变化,引发测试假阳性失败。

测试建议

  • npm test 中新增 index/config/agents 对应回归测试文件或用例。
  • 在 CI 增加一个 review_language=zh 的快照测试场景,验证评论正文与摘要语言一致。
  • 执行 npm test 前补充上述单测并确保 Node 22 环境一致。
  • 对新增文本键进行最小快照测试(中英文各一例)。
  • 补充边界值与异常路径测试,优先覆盖新增分支。
  • 运行并补充端到端测试,验证含 null confidence 的 findings 在最终 PR 评论中展示正常
  • 增加一条“默认配置回归快照测试”,锁定 normalize + dedupe 的输出结构,便于后续版本演进
  • normalizeFindings(..., {missingConfidencePolicy:'invalid'}) 断言与 na 一致。
  • fallbackConfidenceValue 参数化:['abc', -0.2, 1.2, undefined]
  • merge 场景参数化:[baseConf,incomingConf]=[0.8,0.8],[null,null] 并验证关键字段。
  • 端到端验证:混合可信/不可信子代理输出下,安全维度最终结果的精确率与召回率
  • 回归测试:默认配置变更后对历史用例数量与排序的影响评估

文件级覆盖说明

  • src/index.js: 存在中等测试覆盖缺口,建议优先补齐新增函数与统计链路测试。 (该文件改动集中在输出文案与统计展示,最适合通过纯函数单测快速兜底。)
  • src/config.js: 新增输入解析逻辑需要负向测试保障鲁棒性。 (建议与现有 config 测试风格保持一致,避免 brittle 测试。)
  • src/agents.js: schema 变更应补充契约测试,当前风险可控但易引发隐式行为变化。 (该改动虽小但影响面跨模块,建议至少增加 1 组回归测试。)
  • src/aggregate.js: 存在策略层面的中风险:未知置信度默认保留可能绕过阈值过滤。未见直接代码执行类漏洞。 (本文件改动未涉及外部网络访问、文件系统路径拼接、命令执行或凭据处理。)
  • test/aggregate.test.js: 测试覆盖了新策略语义(drop/na/fallback)与排序合并行为,有助于防回归;但缺少“安全默认策略”断言。 (测试文件本身无直接安全漏洞。)
  • test/index.test.js: 新增测试质量较高,覆盖 confidence 格式化与多语言 inline 渲染;但 buildReviewBody 仍存在 i18n/零值/缺省分支覆盖空白。 (当前断言存在一定文案耦合,可结合关键片段+结构标记降低脆弱性。)
  • test/agents.test.js: schema 新增用例有效,但 confidence 非法值边界覆盖尚不完整。 (建议将非法输入整理为表驱动测试,减少重复并提升可读性。)
  • test/config.test.js: 配置解析测试已显著完善,包含默认值、大小写归一化与范围校验。 (与 README 语义一致性的契约测试建议补齐。)
  • README.md: 文档补充清晰,参数与语义说明完整。 (可在 CI 中加入最小示例配置的端到端 smoke test。)

无法 inline 的已处理项

  • test/agents.test.js: 测试对校验错误文案做精确匹配,容易因依赖升级产生脆弱失败 (max_inline_comments_cap_reached)
  • test/aggregate.test.js: 缺少 mergeFinding 在置信度相等时的稳定性与可观测性测试 (max_inline_comments_cap_reached)
  • test/config.test.js: 配置测试缺少“策略联动”断言,无法验证 fallback_confidence_value 在非 fallback 策略下被忽略的行为 (max_inline_comments_cap_reached)

覆盖状态

  • Target files: 9
  • Covered files: 9
  • Uncovered files: 0
  • No-patch/binary covered as file-level: 0
  • 置信度未知(N/A)的问题数: 0

未覆盖文件清单:

无 patch 文件覆盖清单:

轮次与预算

  • 轮次: 1/2
  • 计划批次: 3
  • 执行批次: 3
  • SubAgent 执行次数: 7
  • Planner 调用: 1
  • SubAgent 调用: 7
  • 模型调用: 8/64
  • 结构化输出降级为仅汇总评论: 否

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

自动化 PR 审查已完成。

  • Findings kept: 3
  • Inline comments attempted: 3
  • Target files: 2
  • Covered files: 2
  • Uncovered files: 0
    详细结论请查看汇总评论。

Comment thread src/index.js Outdated
}).join(' | ');
}

function formatConfidenceValue(confidence) {

This comment was marked as outdated.

Comment thread src/index.js Outdated
function formatConfidenceValue(confidence) {
const value = Number.parseFloat(String(confidence));
if (!Number.isFinite(value)) {
return '0.80';

This comment was marked as outdated.

Comment thread src/index.js
return {
suggestionLabel: '建议',
riskLabel: '风险',
confidenceLabel: '置信度',

This comment was marked as outdated.

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

自动化 PR 审查已完成。

  • Findings kept: 3
  • Inline comments attempted: 3
  • Target files: 2
  • Covered files: 2
  • Uncovered files: 0
    详细结论请查看汇总评论。

Comment thread src/index.js
}

function formatConfidenceValue(confidence) {
const value = Number.parseFloat(String(confidence));

This comment was marked as outdated.

Comment thread test/index.test.js
assert.match(body, /Confidence: 0.93/);
assert.match(body, /ai-code-review-agent:inline-key/);
assert.match(body, /\[From SubAgent: security\]/);
assert.ok(body.indexOf('Confidence: 0.93') < body.indexOf('[From SubAgent: security]'));

This comment was marked as outdated.

Comment thread test/index.test.js
assert.ok(body.indexOf('Confidence: 0.93') < body.indexOf('[From SubAgent: security]'));
});

test('formatConfidenceValue handles invalid and boundary values predictably', () => {

This comment was marked as outdated.

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

自动化 PR 审查已完成。

  • Findings kept: 13
  • Findings with unknown confidence: 0
  • Inline comments attempted: 10
  • Target files: 7
  • Covered files: 7
  • Uncovered files: 0
    详细结论请查看汇总评论。

Comment thread src/agents.js
side: z.enum(['LEFT', 'RIGHT', 'FILE']).default('RIGHT'),
line: z.number().int().positive().nullable().default(null),
confidence: z.number().min(0).max(1).default(0.8),
confidence: z.number().min(0).max(1).nullable().optional().default(null),

This comment was marked as outdated.

Comment thread src/aggregate.js

function mergeFinding(base, incoming) {
const preferIncoming = incoming.confidence > base.confidence;
const baseRank = confidenceRank(base.confidence);

This comment was marked as outdated.

Comment thread src/aggregate.js
const summary = String(finding.summary || '').trim();
const confidenceRaw = Number.parseFloat(String(finding.confidence ?? '0.8'));
const confidence = Number.isFinite(confidenceRaw) ? clamp(confidenceRaw, 0, 1) : 0.8;
const confidenceRaw = Number.parseFloat(String(finding.confidence));

This comment was marked as outdated.

Comment thread src/aggregate.js
}

const confidenceDiff = (b.confidence || 0) - (a.confidence || 0);
const confidenceDiff = confidenceRank(b.confidence) - confidenceRank(a.confidence);

This comment was marked as outdated.

Comment thread src/config.js
return parsed;
}

function parseEnumInput(name, defaultValue, allowedValues) {

This comment was marked as outdated.

Comment thread src/config.js
reviewDimensions: normalizedDimensions,
reviewLanguage,
minFindingConfidence: parseFloatRangeInput('min_finding_confidence', 0.72, 0, 1),
missingConfidencePolicy: parseEnumInput('missing_confidence_policy', 'na', ['drop', 'na', 'fallback']),

This comment was marked as outdated.

Comment thread src/index.js
}).join(' | ');
}

function formatConfidenceValue(confidence, unknownValue = 'N/A') {

This comment was marked as outdated.

Comment thread src/index.js
}

lines.push(`<!-- ai-code-review-agent:inline-key ${inlineKey} -->`);
lines.push(`${text.confidenceLabel}: ${formatConfidenceValue(finding.confidence, text.unknownConfidenceValue)}`);

This comment was marked as outdated.

Comment thread src/index.js
const degradedText = degradedSummaryOnly
? `${text.yes}\n\n${text.reasons}:\n${degradedReasons.map((x) => `- ${x}`).join('\n') || '- unknown'}`
: text.no;
const unknownConfidenceFindings = Number.isFinite(coverage.unknownConfidenceFindings)

This comment was marked as outdated.

Comment thread test/config.test.js
github_token: 'ghs_xxx',
openai_api_key: 'sk-test',
min_finding_confidence: '0.85',
missing_confidence_policy: 'fallback',

This comment was marked as outdated.

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

自动化 PR 审查已完成。

  • Findings kept: 13
  • Findings with unknown confidence: 0
  • Inline comments attempted: 10
  • Target files: 9
  • Covered files: 9
  • Uncovered files: 0
    详细结论请查看汇总评论。

Comment thread src/config.js
return parsed;
}

function parseEnumInput(name, defaultValue, allowedValues) {

This comment was marked as outdated.

Comment thread src/agents.js
side: z.enum(['LEFT', 'RIGHT', 'FILE']).default('RIGHT'),
line: z.number().int().positive().nullable().default(null),
confidence: z.number().min(0).max(1).default(0.8),
confidence: z.number().min(0).max(1).nullable().optional().default(null),

This comment was marked as outdated.

Comment thread src/config.js
reviewDimensions: normalizedDimensions,
reviewLanguage,
minFindingConfidence: parseFloatRangeInput('min_finding_confidence', 0.72, 0, 1),
missingConfidencePolicy: parseEnumInput('missing_confidence_policy', 'na', ['drop', 'na', 'fallback']),

This comment was marked as outdated.

Comment thread src/index.js
}).join(' | ');
}

function formatConfidenceValue(confidence, unknownValue = 'N/A') {

This comment was marked as outdated.

Comment thread src/index.js
}),
config.maxFindings
);
const unknownConfidenceFindings = normalizedFindings.filter((finding) => !Number.isFinite(finding.confidence)).length;

This comment was marked as outdated.

Comment thread test/config.test.js
);
});

test('loadConfig normalizes missing_confidence_policy casing and whitespace', () => {

This comment was marked as outdated.

Comment thread test/index.test.js
assert.equal(formatConfidenceValue('abc'), 'N/A');
assert.equal(formatConfidenceValue(-0.1), '0.00');
assert.equal(formatConfidenceValue(1.2), '1.00');
assert.equal(formatConfidenceValue('0.345'), '0.34');

This comment was marked as outdated.

Comment thread README.md
| `review_language` | no | `English` | Preferred language for review comments and summary |
| `min_finding_confidence` | no | `0.72` | Keep only findings at or above this confidence (0-1) |
| `missing_confidence_policy` | no | `na` | Handling for missing/invalid confidence: `drop`, `na`, or `fallback` |
| `fallback_confidence_value` | no | `0.5` | Fallback confidence used only when `missing_confidence_policy=fallback` |

This comment was marked as outdated.

Comment thread README.md
| `uncovered_files` | Number of uncovered files |
| `degraded` | `true` if summary-only degradation was triggered |

## Confidence Semantics

This comment was marked as outdated.

Comment thread src/aggregate.js
const severity = SEVERITY_RANK[incoming.severity] > SEVERITY_RANK[base.severity]
? incoming.severity
: base.severity;
const mergedConfidence = incomingRank >= baseRank ? incoming.confidence : base.confidence;

This comment was marked as outdated.

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

自动化 PR 审查已完成。

  • Findings kept: 13
  • Findings with unknown confidence: 0
  • Inline comments attempted: 10
  • Target files: 9
  • Covered files: 9
  • Uncovered files: 0
    详细结论请查看汇总评论。

Comment thread src/agents.js
side: z.enum(['LEFT', 'RIGHT', 'FILE']).default('RIGHT'),
line: z.number().int().positive().nullable().default(null),
confidence: z.number().min(0).max(1).default(0.8),
confidence: z.number().min(0).max(1).nullable().optional().default(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.

[MEDIUM] finding schema 从必填数值改为 nullable optional 后缺少兼容性测试

schema 语义变化较大(默认 0.8 -> null),会影响下游过滤/展示逻辑,缺少对应 contract 测试。

建议: 增加 agents/schema 测试:缺失 confidence、显式 null、合法数值、越界数值的解析结果;并验证与 normalize/filter 流程联动行为符合预期。

风险: 上游模型输出轻微变化可能触发解析/过滤行为差异,造成结果数量和质量波动。

置信度: 0.92

[来自 SubAgent:testing]

Comment thread src/aggregate.js
function normalizeFindings(findings, allowedPaths, options = {}) {
const pathSet = new Set(allowedPaths);
const minConfidence = Number.isFinite(options.minConfidence) ? options.minConfidence : 0;
const missingConfidencePolicy = ['drop', 'na', 'fallback'].includes(options.missingConfidencePolicy)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MEDIUM] 默认 na 策略允许未知置信度绕过最小置信度阈值

missingConfidencePolicy 默认值为 na 时,confidence 无法解析将被置为 null 并保留;后续阈值判断仅对数值型置信度生效,导致未知置信度不会被 minConfidence 过滤。若上游结果可被操控,可注入大量“未知置信度”发现,降低安全审查可信度。

建议: 将默认策略改为 dropfallback(并设置保守 fallback 值),至少在安全维度下强制 drop;同时增加上游来源可信度校验与速率/数量限制。

风险: 可能造成安全告警结果被噪声淹没、误导人工审计优先级,形成间接安全运营风险。

置信度: 0.90

[来自 SubAgent:security]

Comment thread src/config.js
return parsed;
}

function parseEnumInput(name, defaultValue, allowedValues) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MEDIUM] 配置新增枚举输入解析缺少非法值与大小写归一化测试

新增 parseEnumInput 并接入关键配置,但未见对默认值、大小写、空白、非法值抛错的测试。

建议: 补充 config 测试:missing_confidence_policyDROP/ na /fallback 归一化成功;非法值报错信息包含输入名与允许列表;未提供输入时走默认 na

风险: 配置解析异常会导致 action 在运行时直接失败,影响 CI 稳定性。

置信度: 0.96

[来自 SubAgent:testing]

Comment thread src/index.js
}).join(' | ');
}

function formatConfidenceValue(confidence, unknownValue = 'N/A') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MEDIUM] 新增置信度格式化与展示路径缺少针对边界值的单元测试

新增格式化函数包含 NaN/非数值、越界截断与保留两位小数逻辑,但未看到对应测试覆盖,容易在显示层出现回归。

建议: 补充 formatConfidenceValue 单测:null/undefined/''/'abc' 返回 N/A;-0.1=>0.001.2=>1.000/1/0.345 的格式化结果;并覆盖 buildInlineBody 中置信度行渲染。

风险: 置信度文案错误会误导审查结果解读,且该字段已进入 inline 评论,影响面较大。

置信度: 0.95

[来自 SubAgent:testing]

Comment thread src/index.js
return [
text.reviewCompleted,
`- Findings kept: ${findingsKept}`,
`- Findings with unknown confidence: ${unknownConfidenceFindings}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MEDIUM] Review body 新增字段未国际化,中文模式会出现英文文案

buildReviewBody 新增了 Findings with unknown confidence 的输出,但使用了英文硬编码字符串,没有走 text 语言包。在 review_language=zh 时会与其他中文文案混排,造成可见回归。

建议: 为 review body 的该行新增并使用语言包键(例如 text.unknownConfidenceFindingsLine 或复用已有 unknownConfidenceFindings 标签拼接),避免硬编码英文。

风险: 用户界面语言不一致,降低可读性并影响国际化可维护性;后续新增语言时更易遗漏。

置信度: 0.95

[来自 SubAgent:general]

Comment thread src/index.js
const degradedText = degradedSummaryOnly
? `${text.yes}\n\n${text.reasons}:\n${degradedReasons.map((x) => `- ${x}`).join('\n') || '- unknown'}`
: text.no;
const unknownConfidenceFindings = Number.isFinite(coverage.unknownConfidenceFindings)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MEDIUM] Review/Summary 新增 unknownConfidenceFindings 统计缺少一致性测试

unknownConfidenceFindings 被同时用于 summary 与 review body,且有默认值兜底分支;缺少测试验证统计口径和展示一致性。

建议: 增加集成/单测:1) findings 含 null/undefined/NaN/数字时计数正确;2) coverage.unknownConfidenceFindings 缺失时 summary 回退到 0;3) review body 与 summary 数值一致。

风险: 统计不一致会降低结果可信度,用户可能误判模型输出质量。

置信度: 0.90

[来自 SubAgent:testing]

Comment thread test/agents.test.js
/Expected number, received string/
);

assert.throws(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MEDIUM] createReviewerAgent 对 confidence 边界值仅覆盖上越界,缺少下越界与 NaN/Infinity 场景

schema 测试对 confidence 的非法输入覆盖不完整,当前主要验证类型错误与上界越界。

建议: 补充 assert.throws 用例:confidence=-0.01、NaN、Infinity;并验证错误信息包含范围约束,确保 zod 规则变更时可被检测。

风险: 若实现意外放宽或遗漏下界/非有限数校验,异常值可能穿透到排序/过滤逻辑引发不可预期行为。

置信度: 0.91

[来自 SubAgent:testing]

Comment thread test/aggregate.test.js
assert.equal(normalized.length, 0);
});

test('normalizeFindings applies fallback confidence and min threshold when policy is fallback', () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MEDIUM] 缺少 fallbackConfidenceValue 非法/越界输入的钳制测试

代码对 fallback 值做了 parse + clamp + 默认 0.5 的防御处理,但测试只验证了 0.85 与 0.5 两个正常值,未覆盖 NaN、负数、大于1等关键边界。

建议: 增加参数化测试:fallbackConfidenceValue 分别为 'abc'-0.11.5null/undefined,断言最终 confidence 分别为 0.5010.5,并结合 minConfidence 校验保留/丢弃结果。

风险: 若后续改动破坏 clamp 或默认值逻辑,可能引入异常筛选结果(如把应保留的问题错误过滤)。

置信度: 0.95

[来自 SubAgent:testing]

Comment thread test/aggregate.test.js
assert.equal(normalized[0].line, null);
});

test('normalizeFindings drops findings with missing confidence when policy is drop', () => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MEDIUM] 缺少 missingConfidencePolicy 非法值回退到默认 'na' 的测试

实现新增了非法策略值自动回退到 'na' 的逻辑,但当前测试仅覆盖了 drop/fallback/na 显式合法值,未覆盖非法值输入时的默认行为。

建议: 补充用例:missingConfidencePolicy: 'unexpected'minConfidence 生效时,验证缺失/NaN confidence 按 na 语义保留(不参与阈值过滤),并与数值 confidence 的过滤行为并存正确。

风险: 未来重构若误改默认分支(如改为 drop)将导致无 confidence 的 finding 被静默丢弃,现有测试无法及时发现。

置信度: 0.93

[来自 SubAgent:testing]

Comment thread test/index.test.js
degradedReasons: []
});

const reviewBody = buildReviewBody({

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MEDIUM] 缺少对 buildReviewBody 在中文与 N/A 语义下的直接测试

新增测试已验证 summary 与 review body 的未知置信度计数一致性,但只覆盖英文固定文案与单一计数,未覆盖中文 bundle、零值、缺省值等关键分支。

建议: 新增 buildReviewBody 的参数化测试:至少覆盖 English/zh-CN、unknownConfidenceFindings 为 0/正数、coverage 缺字段时的降级文案,避免仅靠 summary 测试间接兜底。

风险: 多语言或格式调整时,review body 可能出现文案回退/错译/计数遗漏而测试不报错。

置信度: 0.88

[来自 SubAgent:testing]

@jorben jorben merged commit ea6fe72 into master Mar 4, 2026
2 checks passed
@jorben jorben deleted the feat/inline-comment-confidence branch March 4, 2026 05:01
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