Skip to content

feat: add conservative code location repair workflow#43

Open
Nerdlet369 wants to merge 2 commits into
Tencent:mainfrom
Nerdlet369:fix/issue4-code-location
Open

feat: add conservative code location repair workflow#43
Nerdlet369 wants to merge 2 commits into
Tencent:mainfrom
Nerdlet369:fix/issue4-code-location

Conversation

@Nerdlet369

@Nerdlet369 Nerdlet369 commented Jul 14, 2026

Copy link
Copy Markdown

Summary

Conservative code location repair workflow for data/entries.jsonl.

Repair Pipeline

Tier Strategy Description
1 correct Current {file, line, code} already matches
2 nearby_fix Searches ±5 lines; expands range for multi-line code
3 file_search Searches entire file
4 repo_search Searches repository snapshot; repairs file + line on unique match
degenerate Single closing braces (}, ), ];) never auto-fixed → flagged for human review

Ambiguous matches (0 hit, multiple hits, fetch failure) are left untouched and recorded for manual review.

Result

Processed: 408 entries
Auto-fixed: 102   (100 nearby + 2 file)
Needs human: 72   (17 degenerate snippets)
Errors:     0

@Nerdlet369

Copy link
Copy Markdown
Author

已完成实现并提交 PR:#43

该方案采用保守修复策略,包含:

  1. 原位验证
  2. line ± 5 搜索
  3. 文件级搜索
  4. 仓库级唯一命中搜索

并输出:

  • entries.fixed.jsonl
  • fix_diff.csv
  • needs_human.csv

@Nerdlet369

Copy link
Copy Markdown
Author

Update(最新改动同步)

本次 push 在原方案基础上补充了工程化验证环节,核心改动:

  1. 单元测试:新增 tests/test_fix_entries.py,覆盖 normalize_codesearch_code_in_lines、行号解析、退化片段判断、desc 同步等 21 个用例
  2. 独立校验脚本:新增 scripts/verify_fix.py,检查 schema / diff 一致性 / code 字段完整性 / 幂等性
  3. 退化片段过滤:单独的 } / ) / ]; 等无意义片段不再自动修复,明确写入 needs_human.csv
  4. desc 同步:行号变化时保守同步 desc 中的行号引用;fix_diff.csv 新增 original_desc / new_desc

最新全量结果:

Processed: 408 entries
Auto-fixed: 102   (100 nearby + 2 file)
Needs human: 72   (17 degenerate snippets)
Errors:     0

@Nerdlet369

Copy link
Copy Markdown
Author

Quick note: fix_entries.py output is idempotent —
re-running on entries.fixed.jsonl produces 0 additional fixes,
confirming all repairs are convergent.

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