Run history
dagz-run-history replays a range of commits through DAGZ, oldest first.
For each commit it checks the commit out and runs pytest --dagz.
The first commit runs without a baseline and records one;
each later commit runs against the history recorded so far,
so selection works on real changes exactly as it would have at the time.
Use it after integrating DAGZ to seed a realistic run history and see selection on your project's
actual commits.
It is installed with the dagz Python package.
The tool runs git checkout -B main <commit> and git reset --hard in the current repository,
including during patch verification.
Run it in a dedicated clone.
Usage
Run from the project root, inside the project's environment.
Both dagz-run-history and the pytest it launches must resolve to the environment
where dagz is installed.
With an activated venv:
dagz-run-history # dry run: list the commits that would be replayed
dagz-run-history --run # replay them
With uv:
uv run dagz-run-history
uv run dagz-run-history --run
The dry run lists the commits, oldest first.
[py] marks commits that change .py files, followed by a diff stat:
Found 3 commits from origin/master:
1. [py] 3c4d5e6f7a8b Add currency column
2. [ ] 7f8e9d0c1b2a Update README (1 files +4 -1)
3. [py] 1a2b3c4d5e6f Fix rounding in totals (2 files +10 -3)
Dry run. Pass --run to execute.
Each job is attributed to the commit's author:
the tool sets DAGZ_USER_EMAIL to the author's email for the run.
Options
| Flag | Description |
|---|---|
--branch BRANCH | Branch to take commits from. Default origin/master. |
-n, --num-commits N | Number of first-parent commits to replay. Default 20. |
--run | Execute the runs. Without it, only the commit list is printed. |
--patch-file FILE | Git patch applied on each commit before its run and reversed after. |
--allow-patch-failure | Skip commits where the patch does not apply, instead of stopping before any run. |
--pytest-args-file FILE | File with extra pytest arguments, whitespace-separated. # starts a comment. |
--prerun SCRIPT | Script executed before pytest on the first commit and on commits that change .py files. |
--skip-redundant | Pass --dagz-skip-redundant true on every commit after the first. |
Replaying commits that predate the integration
When the commits you replay are older than the DAGZ integration itself,
carry the integration as a patch with --patch-file.
The patch is applied before each run and reversed after it,
so every historical commit runs with the integration in place.
Before running anything, the tool verifies the patch applies on every commit
and marks failures PATCH-FAIL in the listing.
If any commit fails, the tool stops;
pass --allow-patch-failure to skip the failing commits and replay the rest.