Skip to content

feat: add conservative code location repair workflow#32

Open
ruirui6946 wants to merge 1 commit into
Tencent:mainfrom
ruirui6946:agent/issue-4-location-repair
Open

feat: add conservative code location repair workflow#32
ruirui6946 wants to merge 1 commit into
Tencent:mainfrom
ruirui6946:agent/issue-4-location-repair

Conversation

@ruirui6946

Copy link
Copy Markdown

Closes #4

Summary

  • add a standard-library-only location repair workflow for data/entries.jsonl
  • validate every entry_point, critical_operation, and trace node at its exact repository commit
  • emit deterministic repaired JSONL, an automatic-fix audit, a human-review queue, and a run summary
  • add an independent artifact/source verifier, documentation, and regression tests

Repair policy

The resolver checks the recorded location first, then searches in the required order:

  1. the original line range plus or minus 5 lines
  2. the full original file
  3. the full repository at the pinned commit

Only unique matches are repaired. Whitespace, tabs, and multiline snippets are normalized for matching. Ambiguous, missing, empty, low-information, or unavailable-source cases remain unchanged and are written to needs_human.csv. Repository commits are batch-fetched into a reusable local bare cache.

Results

  • 408 entries / 2,889 code-location nodes checked
  • 109 automatic fixes: 95 current-start span repairs, 12 nearby repairs, 2 same-file unique repairs
  • 56 nodes conservatively queued for human review
  • 0 schema errors and 0 repository errors
  • cold full run: 309.469 seconds; cached deterministic rerun: 89.484 seconds
  • cached rerun produced byte-identical JSONL and CSV artifacts

Prioritized samples:

  • entry-00103: corrected 605-614 to 606-614 and 146-155 to 146-154, including description synchronization
  • entry-00185: corrected 75-82 to 76-82
  • entry-00320: all 6 locations already exact
  • entry-00511: all 7 locations already exact

Validation

  • python -m unittest discover -s tests -v — 15 tests passed
  • python scripts/verify_entry_location_outputs.py — 408 entries, 184 reports, 109 fixes, 56 human-review rows, 0 schema errors
  • source-backed verification — 2,833 non-human nodes matched their exact commit/file/span; 56 human-review nodes intentionally skipped
  • python examples/load_dataset.py — 184 reports / 408 entries loaded
  • Ubuntu 24.04 / Python 3.12 — syntax checks, all tests, artifact verification, and dataset loading passed
  • git diff --check passed

The verifier canonicalizes text newlines so hashes and multiline CSV evidence remain stable across Windows and Linux checkouts.

@ruirui6946 ruirui6946 marked this pull request as ready for review July 11, 2026 12:42
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.

【2026犀牛鸟】修复 VulnGym 数据中的代码片段定位偏差

1 participant