Skip to content

fix(evaluator): 支持区间行号匹配#44

Open
Qiyuanqiii wants to merge 1 commit into
Tencent:mainfrom
Qiyuanqiii:agent/evaluator-line-ranges
Open

fix(evaluator): 支持区间行号匹配#44
Qiyuanqiii wants to merge 1 commit into
Tencent:mainfrom
Qiyuanqiii:agent/evaluator-line-ranges

Conversation

@Qiyuanqiii

@Qiyuanqiii Qiyuanqiii commented Jul 14, 2026

Copy link
Copy Markdown

问题是什么?

SCHEMA.md 从 v0.1.2 起允许节点行号使用正整数或 "start-end" 区间,但 examples/evaluate.py 仍通过 int(line) 读取行号。只要 ground truth 的 entry_pointcritical_operation 使用区间,匹配就会直接失败。

当前 data/entries.jsonl 中:

  • 56 个 entry point / critical operation 使用区间行号。
  • 共影响 44 / 408 条 entry。
  • 例如 finding 报告第 112 行时,无法命中 ground truth 的 "112-119"

如何修复?

  • 新增正整数与 "start-end" 的统一行号解析。
  • 将行号视为闭区间:区间重叠时距离为 0,分离时取最近端点之间的距离。
  • 保持整数对整数的原有语义不变,仍等价于 |line_F - line_E|
  • 对旧版或自定义数据中的无效行号继续保守跳过。
  • 保留原 JSON 报告中的 line_zero_policyskipped_entries_line_zero 字段,并增加区间匹配策略信息。
  • 同步更新中英文 README 的默认匹配策略。

兼容性

本 PR 不改变路径、仓库、commit、entry point / critical operation 方向或默认容差规则。现有纯整数 finding 的匹配结果保持不变。

验证命令

python -m unittest discover -s tests -v
python examples/evaluate.py examples/example_result.jsonl
python -m py_compile examples/evaluate.py tests/test_evaluate.py
git diff --check

验证结果:

  • 8 个单元测试通过。
  • 当前 408 条 ground truth 在容差 0 下自匹配为 408 / 408。
  • 原示例结果保持 3 / 408,不发生整数匹配回归。
  • Python 编译和 diff 检查通过。

验证截图

image

@Qiyuanqiii
Qiyuanqiii marked this pull request as ready for review July 14, 2026 13:45
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