git-jit-defects / README.md
mustafaabdullahk's picture
git-jit-defects v1: 48 repos, 360K commits, SZZ labels + git features
674bec1 verified
|
Raw History Blame Contribute Delete
6.28 kB
metadata
license: cc-by-4.0
task_categories:
  - tabular-classification
language:
  - en
tags:
  - software-engineering
  - defect-prediction
  - just-in-time
  - szz
  - git
  - mining-software-repositories
size_categories:
  - 100K<n<1M
pretty_name: git-jit-defects

git-jit-defects

360,463 commits from 48 open-source repositories (C/C++, Rust, Go, Python, TypeScript/JavaScript), each labelled bug-inducing or not by SZZ, with 15 features derivable from local git alone. Snapshot: April 2026.

Built for just-in-time (JIT) defect prediction that works on unseen repositories without any API access: every feature here can be computed from a local clone at pre-push time, and the labels came from git blame only. No GitHub/GitLab API, no issue tracker, no rate limits. The full pipeline (build.py) is included and reproducible.

What is in the box

file content
commits.parquet one row per labelled commit: 18 columns (below), zstd, ~21 MB
build.py the labelling + feature pipeline (bare clone → SZZ → parquet)
benchmark.py baseline: LA rule vs LightGBM, 5-fold repo-level cross-validation
repos.txt the repositories scanned (72 requested; 48 met the ≥2000-commit / clone criteria)

Columns

column type meaning
repo str owner/name on GitHub
sha str full commit hash
t int author timestamp (unix seconds)
author str sha1 of author email (pseudonymous, stable within and across repos)
subj str commit subject line
nfiles int files touched
la / ld int lines added / deleted
hunks int diff hunks
ndirs / nexts int distinct top-level directories / file extensions touched
test_ratio float share of touched files that are test files
a_prior_n int author's prior commits in this repo
a_prior_rate float author's prior bug-inducing rate in this repo (Laplace-smoothed, past only)
a_days float days since the author's first commit in this repo
msg_len int subject length (chars)
msg_ref int 1 if subject references an issue/PR (#123)
y int label: 1 = bug-inducing (SZZ), 0 = clean

benchmark.py derives the remaining model inputs on the fly (log1p of counts, hour/day-of-week from t, and repo_rate = the repo's own expanding past bug rate), so every input is legal to compute at inference time from local git history.

The diff text and added lines are not included (licensing, size). build.py regenerates them from the public repos.

How labels were made (read this before trusting them)

Plain SZZ on git blame -w, with a few filters, no refactoring-aware step:

  1. Fix commits = subject matches \b(fix(es|ed)?|bug|bugfix|hotfix|regression|crash|segfault|leak|race|deadlock|overflow)\b and does not match a noise list (typo, lint, format, style, docs, ci, build, tests, chore, revert, merge, bump, deps, …); ≤10 files, 1–200 removed lines; test files excluded.
  2. For each fix, the removed lines are blamed (-w); the blamed commits are bug-inducing candidates.
  3. A commit gets y = 1 if the earliest fix blaming it lands within 365 days of the commit.
  4. Only commits inside the labelable window are kept: after the oldest scanned fix and at least 180 days before the newest commit (so every commit had a fair chance of being fixed).
  5. Repos with fewer than 2000 commits were dropped.

Overall inducing rate is 11.7%, per-repo from 1% (ValveSoftware/Proton) to 35% (dragonflydb/dragonfly).

Known limitations. SZZ labels are noisy; manual studies put precision of basic SZZ around 50–70% (Herbold et al., arXiv:1911.08938). Fix detection is regex-based on the subject line only. There is no refactoring or cosmetic-change filter. Big-bang / squash-merge commits are not treated specially. No manual validation sample was taken. Treat this as a large, cheap, multi-language JIT dataset, not a high-confidence one; for a curated C/C++ benchmark see ReDef (arXiv:2509.09192).

Baseline results (unseen repositories)

5-fold cross-validation by repository (a repo is either entirely train or entirely test), early stopping on a temporal split inside the training repos. Metric: ROC-AUC per test repo.

method pooled AUC median repo AUC repos beating LA rule by ≥0.02
LA rule (rank by lines added) 0.778 0.770 –
Logistic regression, size only 0.777 0.772 0%
LightGBM, 15 git features (benchmark.py) 0.834 0.813 83%
Hashed TF-IDF on diff text, LR 0.745 0.737 8%
LightGBM, git features + TF-IDF 0.830 0.811 85%
LightGBM, git features + UniXcoder-base embedding of the diff 0.837 0.813 88%

Take-aways we found while building it:

  • Nearly all the gain over the LA rule comes from the interaction of change size with author / repo history (a_prior_rate, repo_rate); ablating history drops the median to 0.795.
  • Code semantics (TF-IDF, or a 768-d pre-trained code-change embedding) add nothing on unseen repos, consistent with Zeng et al. 2021 and ReDef 2025.
  • Pooled calibration looks perfect (ECE 0.005) but per-repo it is not: median ECE 0.024, p90 0.073, max 0.109; the model over-predicts in low-rate repos. Calibrate per repo before using probabilities.

Reproduce / extend

pip install polars lightgbm scikit-learn
python benchmark.py commits.parquet          # ~5 min on a 12-core CPU
python build.py repos.txt 6                  # rebuild from scratch (bare clones, ~1 GB disk peak per worker)

build.py only needs git; add any public repository to repos.txt to extend the dataset.

Citation

@misc{gitjitdefects2026,
  title  = {git-jit-defects: SZZ-labelled commits with git-only features from 48 repositories},
  author = {Kus, Mustafa Abdullah},
  year   = {2026},
  url    = {https://huggingface.co/datasets/amazeng-co/git-jit-defects}
}

Commit metadata belongs to the respective repositories and their authors; this derived dataset (features, labels, scripts) is released under CC BY 4.0.