修复 VulnGym 数据中的代码片段定位偏差 - #72
Open
ccsosd wants to merge 1 commit into
Open
Conversation
ccsosd
marked this pull request as ready for review
July 26, 2026 04:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
本 PR 针对 issue #4,新增入口位置自动修复脚本及对应交付物。
主要内容包括:
tools/fix_entry_locations.py,用于检查并修复data/entries.jsonl中entry_point、critical_operation和trace[*]节点的file/line/code/desc定位信息。tools/README_fix_entry_loc.md,说明脚本运行方式、依赖、修复策略、日志输出和限制。outputs/location_fix/entries.fixed.jsonl,保存修复后的数据文件。outputs/location_fix/fix_diff.csv,记录自动修复前后的 file、line、desc 及修复策略。outputs/location_fix/needs_human.csv,记录无法自动确定、需要人工复核的节点及原因。修复策略
脚本会基于每条 entry 自身的
repo_url和commit,在对应本地仓库快照中校验节点位置。若原始位置无法匹配,则按以下顺序尝试修复:code,唯一命中则修正line。code,唯一命中则修正line。code,唯一命中则同时修正file和line。匹配时会忽略前后空白、tab/空格差异和连续空白差异,并支持连续多行代码片段。
脚本整体策略偏保守:多处命中、完全找不到、低信息锚点或无法判断的节点不会自动修改,而是写入
needs_human.csv。验证
已在当前数据集上运行脚本并生成交付物:
entries.fixed.jsonlfix_diff.csvneeds_human.csv同时对生成的
entries.fixed.jsonl执行了基础 schema 校验。修复结果
本次脚本已在完整数据集上运行,处理结果如下:
fix_diff.csv记录数:12needs_human.csv记录数:75生成的主要结果文件包括:
outputs/location_fix/entries.fixed.jsonl:修复后的完整 JSONL 数据文件,保留 408 条 entry。outputs/location_fix/fix_diff.csv:记录 12 处自动修复的节点,包含修复前后的file/line/desc和修复策略。outputs/location_fix/needs_human.csv:记录 75 处无法安全自动判断的节点,用于后续人工复核。整体结果符合保守修复策略:脚本只对唯一命中且信息量足够的节点进行自动修复;多处命中、完全找不到、低信息锚点或
desc可能需要语义确认的节点均进入人工复核清单。Related to #4