feat(benchmarks): add 25-defect dataset, manifest loader, and Pass@k evaluation harness - #5
Merged
Merged
Conversation
…ble_default_arguments, 5/25)
…andled_nonetype, off_by_one_slicing, float_precision, resource_leaks)
…egories including mutable defaults, float precision, off-by-one errors, and resource leaks
…ainst oracle tests
…the end of the file
…t the end of the file
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.
What this adds
Implements the benchmark evaluation harness described in the project spec: a
25-defect synthetic dataset with oracle tests, a typed manifest loader, and a
harness that runs the full LangGraph agent against each defect and grades the
result against a hidden oracle test — never against the SLM's own
self-written tests, since a model that writes weak tests would otherwise
score as "fixed" even when it isn't.
Files added
benchmarks/manifest.py— Pydantic schema (DefectRecord,DefectManifest)and loaders for the dataset manifest, source files, and oracle tests. Fails
fast (raises) on missing files or malformed JSON, unlike the tools in
patchwork/tools/, since this loads a fixed local dataset rather thanuntrusted SLM output or flaky subprocesses. Validates defect IDs are unique
at load time via a
model_validator, not just in tests.benchmarks/dataset/— 25 buggy Python files across 5 categories (mutabledefault arguments, unhandled NoneType, off-by-one slicing, float precision,
resource leaks), each with a corresponding oracle test in
benchmarks/dataset/oracle_tests/.benchmarks/evaluate.py—evaluate_defect()runs one defect throughbuild_patchwork_graph()and grades the final patched code against theoracle;
evaluate_all()runs the full 25-defect set and computes Pass@1 /Pass@overall rates plus VRAM/duration telemetry via
profile_call.Crash-isolated per defect: a transport-level failure
(
RuntimeError/ConnectionError/TimeoutError/OSError) on one defectis caught and recorded, not allowed to kill the rest of the batch.
tests/test_manifest.py,tests/test_evaluate.py— real-dataset,real-subprocess integration tests.
structured_llmis mocked everywhere(no live Ollama call in CI); grading, sandbox execution, and file I/O are
real.
Config changes
pyproject.toml— added[tool.pytest.ini_options](testpaths),[tool.ruff](target-version,extend-excludeforbenchmarks/dataset/, which is intentionally-broken specimen code notmeant to pass lint/type checks),
[tool.mypy](strict = truemadepermanent,
excludefor the same dataset path), and apynvmlstub-suppression override consumed by
patchwork/telemetry/profiler.py.Testing
128 tests passing. Coverage:
manifest.py100%,evaluate.py74% (remaininggap is
main()/save_results()/_print_summary()— CLI glue meant to runonce against a real model, not unit-tested against a mock). Total project
coverage 90%, above the ≥80% target in the project spec.
ruff check,ruff format --check, andmypy --strictall clean acrosspatchwork/,tests/,benchmarks/.