Skip to content
shinjiyuPublic

About

Locate a bug file, or flag a diff, by cross-checking small source batches with JEV.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jev-debug

Locate the file a bug report is about, and review a diff, with JEV (jev-latest). JEV answers a yes/no question about a piece of text. It does not search a repository. This package does the search with a fixed algorithm, then asks JEV only about small batches of source.

The same procedure reviews a diff: the changed files are already the shortlist.

Method

  1. Shortlist. Read identifiers out of the bug report (paths, function names, error codes). Rank library files by overlap with the path and with names in the syntax tree. No model call.
  2. Cross-check. Put the shortlisted source into windows of at most 3 files and 60k characters. Build two groupings: path order, and files interleaved by directory. Ask whether the code that must change is in that batch.
  3. Score. A file scores by how well “the bug is in this file” predicts every answer: add log p(yes) when the file is in the batch, otherwise log(1 - p(yes)).
  4. Alone. Files within 0.5 of the best score are asked one at a time. Neighbors that only looked guilty together drop out.

Code review skips step 1. A unified diff is parsed into per-file hunks and those hunks are the batches. The question is whether a reviewer should flag a defect (logic, contract, security), not formatting.

A full-repository scan is the same cross-check without the shortlist. It costs two passes over the source. The shortlist is what makes a large tree cheap. The numbers below are from the full scan plus a separate shortlist run, on SWE-bench Lite instances that touch one library file.

What the pilot showed

Twelve SWE-bench Lite instances, one per repository, each with a single library Python file in the gold patch. The model was not given the patch, the tests, or an explanation of the bug. File means the gold file, not the function and not a passing test.

Shortlist, no model (12 cases, a few seconds): the gold file is in the top 10 for 11 of 12. Seaborn is the miss (_oldcore.py ranks 39) because the report and traceback name _core.py.

repo gold file rank
flask, requests, pytest, sphinx, sklearn, matplotlib, django 1
xarray 2
astropy 4
sympy 5
pylint 6
seaborn 39

Full-source cross-check (10 repositories that finished): the gold file is in the top-scoring group in all 10. Six are unique at the group stage: flask, sphinx, astropy, sklearn, matplotlib, django. Requests and pylint are tied with neighbors, then unique after the alone question (sessions.py 0.99, misc.py 0.97). Seaborn’s gold file is the highest alone score (0.82) but two other files also answer yes. Pytest and xarray were still tied when this note was written; sympy was not finished. This is file-level, not function-level.

Path-only questions are a different task. JEV then matches names in the report. Showing source is what separated django global_settings.py from the storage module the report talks about.

Use

export TYPESAFE_API_KEY=...   # or JEV_KEY

# rank files from the report; no API call
python -m jevdebug.debug retrieve --root ./repo --problem report.txt

# shortlist, then cross-check those files
python -m jevdebug.debug localize --root ./repo --problem report.txt

# review a diff
python -m jevdebug.review changes.diff

retrieve prints the shortlist. localize and review print batch score, and alone= when a tie was broken. Requires Python 3.9+. The standard library is enough.

python -m unittest discover -s tests

Layout

  • jevdebug/retrieve.py — report terms against path and syntax-tree names
  • jevdebug/cross.py — two groupings, log score, alone check
  • jevdebug/debug.py — bug localization
  • jevdebug/review.py — diff review
  • jevdebug/client.py — JEV system-one client

About

Locate a bug file, or flag a diff, by cross-checking small source batches with JEV.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages