blot-git 0.4.0__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. {blot_git-0.4.0 → blot_git-0.6.0}/.pre-commit-hooks.yaml +1 -1
  2. blot_git-0.6.0/CLAUDE.md +68 -0
  3. {blot_git-0.4.0 → blot_git-0.6.0}/PKG-INFO +6 -2
  4. {blot_git-0.4.0 → blot_git-0.6.0}/README.md +38 -2
  5. {blot_git-0.4.0 → blot_git-0.6.0}/action.yml +1 -1
  6. {blot_git-0.4.0 → blot_git-0.6.0}/bench/README.md +27 -0
  7. blot_git-0.6.0/bench/RESULTS.md +113 -0
  8. blot_git-0.6.0/bench/cases.json +443 -0
  9. blot_git-0.6.0/bench/labels/django-django.json +646 -0
  10. blot_git-0.6.0/bench/labels/expressjs-express.json +246 -0
  11. blot_git-0.6.0/bench/labels/facebook-react.json +916 -0
  12. blot_git-0.6.0/bench/labels/pallets-flask.json +56 -0
  13. blot_git-0.6.0/bench/labels/psf-requests.json +216 -0
  14. {blot_git-0.4.0 → blot_git-0.6.0}/docs/PRD.md +17 -4
  15. {blot_git-0.4.0 → blot_git-0.6.0}/docs/PYPI.md +5 -1
  16. {blot_git-0.4.0 → blot_git-0.6.0}/pyproject.toml +1 -1
  17. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/__init__.py +1 -1
  18. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/bench.py +76 -5
  19. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/checks/cochange.py +12 -1
  20. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/checks/removed_fix.py +2 -1
  21. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/classify.py +9 -7
  22. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/cli.py +52 -1
  23. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/diff.py +6 -2
  24. blot_git-0.6.0/src/blot/guard.py +177 -0
  25. blot_git-0.6.0/src/blot/hooks.py +178 -0
  26. {blot_git-0.4.0 → blot_git-0.6.0}/tests/test_bench.py +31 -4
  27. {blot_git-0.4.0 → blot_git-0.6.0}/tests/test_checks.py +16 -0
  28. {blot_git-0.4.0 → blot_git-0.6.0}/tests/test_classify.py +8 -0
  29. blot_git-0.6.0/tests/test_guard.py +160 -0
  30. {blot_git-0.4.0 → blot_git-0.6.0}/tests/test_why_github.py +18 -0
  31. blot_git-0.4.0/bench/RESULTS.md +0 -73
  32. blot_git-0.4.0/bench/cases.json +0 -83
  33. blot_git-0.4.0/src/blot/hooks.py +0 -77
  34. {blot_git-0.4.0 → blot_git-0.6.0}/.gitattributes +0 -0
  35. {blot_git-0.4.0 → blot_git-0.6.0}/.github/ISSUE_TEMPLATE/bench_case.md +0 -0
  36. {blot_git-0.4.0 → blot_git-0.6.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  37. {blot_git-0.4.0 → blot_git-0.6.0}/.github/ISSUE_TEMPLATE/check_idea.md +0 -0
  38. {blot_git-0.4.0 → blot_git-0.6.0}/.github/pull_request_template.md +0 -0
  39. {blot_git-0.4.0 → blot_git-0.6.0}/.github/workflows/blot.yml +0 -0
  40. {blot_git-0.4.0 → blot_git-0.6.0}/.github/workflows/ci.yml +0 -0
  41. {blot_git-0.4.0 → blot_git-0.6.0}/.github/workflows/release.yml +0 -0
  42. {blot_git-0.4.0 → blot_git-0.6.0}/.gitignore +0 -0
  43. {blot_git-0.4.0 → blot_git-0.6.0}/CONTRIBUTING.md +0 -0
  44. {blot_git-0.4.0 → blot_git-0.6.0}/LICENSE +0 -0
  45. {blot_git-0.4.0 → blot_git-0.6.0}/assets/demo/demo.gif +0 -0
  46. {blot_git-0.4.0 → blot_git-0.6.0}/assets/demo/make_demo.py +0 -0
  47. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/blue/alert.svg +0 -0
  48. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/blue/faces.svg +0 -0
  49. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/blue/happy.svg +0 -0
  50. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/blue/idle.svg +0 -0
  51. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/blue/sad.svg +0 -0
  52. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/blue/sleepy.svg +0 -0
  53. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/blue/walk.svg +0 -0
  54. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/blue/worried.svg +0 -0
  55. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/build_sprites.py +0 -0
  56. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/mustard/alert.svg +0 -0
  57. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/mustard/faces.svg +0 -0
  58. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/mustard/happy.svg +0 -0
  59. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/mustard/idle.svg +0 -0
  60. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/mustard/sad.svg +0 -0
  61. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/mustard/sleepy.svg +0 -0
  62. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/mustard/walk.svg +0 -0
  63. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/mustard/worried.svg +0 -0
  64. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/orange/alert.svg +0 -0
  65. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/orange/faces.svg +0 -0
  66. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/orange/happy.svg +0 -0
  67. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/orange/idle.svg +0 -0
  68. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/orange/sad.svg +0 -0
  69. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/orange/sleepy.svg +0 -0
  70. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/orange/walk.svg +0 -0
  71. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/orange/worried.svg +0 -0
  72. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/sage/alert.svg +0 -0
  73. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/sage/faces.svg +0 -0
  74. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/sage/happy.svg +0 -0
  75. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/sage/idle.svg +0 -0
  76. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/sage/sad.svg +0 -0
  77. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/sage/sleepy.svg +0 -0
  78. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/sage/walk.svg +0 -0
  79. {blot_git-0.4.0 → blot_git-0.6.0}/assets/sora/sage/worried.svg +0 -0
  80. {blot_git-0.4.0 → blot_git-0.6.0}/docs/EXPLAINER.md +0 -0
  81. {blot_git-0.4.0 → blot_git-0.6.0}/docs/competitors.md +0 -0
  82. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/__main__.py +0 -0
  83. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/checks/__init__.py +0 -0
  84. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/checks/base.py +0 -0
  85. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/checks/readded_bug.py +0 -0
  86. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/config.py +0 -0
  87. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/git.py +0 -0
  88. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/github.py +0 -0
  89. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/index.py +0 -0
  90. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/report.py +0 -0
  91. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/store.py +0 -0
  92. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/trace.py +0 -0
  93. {blot_git-0.4.0 → blot_git-0.6.0}/src/blot/why.py +0 -0
  94. {blot_git-0.4.0 → blot_git-0.6.0}/tests/conftest.py +0 -0
  95. {blot_git-0.4.0 → blot_git-0.6.0}/tests/test_action.py +0 -0
  96. {blot_git-0.4.0 → blot_git-0.6.0}/tests/test_cli.py +0 -0
  97. {blot_git-0.4.0 → blot_git-0.6.0}/tests/test_config.py +0 -0
  98. {blot_git-0.4.0 → blot_git-0.6.0}/tests/test_diff.py +0 -0
  99. {blot_git-0.4.0 → blot_git-0.6.0}/tests/test_git.py +0 -0
  100. {blot_git-0.4.0 → blot_git-0.6.0}/tests/test_hooks.py +0 -0
  101. {blot_git-0.4.0 → blot_git-0.6.0}/tests/test_index.py +0 -0
@@ -1,6 +1,6 @@
1
1
  # Lets users of the pre-commit framework add blot with:
2
2
  # - repo: https://github.com/Sym-jay/Blot
3
- # rev: v0.4.0
3
+ # rev: v0.6.0
4
4
  # hooks: [{id: blot}]
5
5
  # The first commit indexes the repo's history; later commits refresh the index incrementally.
6
6
  - id: blot
@@ -0,0 +1,68 @@
1
+ # Blot: notes for Claude
2
+
3
+ Blot is a pre-commit check that has read a repo's git history. It warns (never blocks) when a commit
4
+ removes a fix (`removed-fix`), re-adds a line a fix removed (`readded-bug`), or forgets a file that
5
+ always changes with another (`forgot-related-file`). Mascot: Sora the slime. Owner: Shyam (GitHub
6
+ `Sym-jay`). PyPI name `blot-git`, command `blot`. Repo: https://github.com/Sym-jay/Blot
7
+
8
+ ## Layout
9
+ - `src/blot/`: stdlib-only on Python 3.11+ (3.10 also needs `tomli`; keep it that way)
10
+ - `cli.py` commands: index, check, why, install-hook, guard, install-agent-hook, bench. `check`/`why` build/refresh the index themselves.
11
+ - `index.py` builds `.git/blot.db` (parallel `git log` slices for 2000+ commits); `store.py` SQLite schema v2
12
+ - `classify.py` fix severity 0/1/2 + refactor detection: most precision lives here
13
+ - `checks/` one file per check; `trace.py` blame that follows lines past refactor commits
14
+ - `guard.py` (Claude Code hook; installer in `hooks.py`), `why.py`, `github.py` (`index --github` via `gh api graphql`), `bench.py` (cases + `--replay N`)
15
+ - `bench/cases.json` scripted real-world cases (32/32); `bench/labels/` hand verdicts for every replay
16
+ warning on the 5 reference repos; `bench/RESULTS.md` replay numbers and precision
17
+ - `action.yml` GitHub Action; `.github/workflows/blot.yml` runs it on Blot's own PRs
18
+ - `assets/sora/build_sprites.py` and `assets/demo/make_demo.py` regenerate the mascot and demo GIF
19
+ - `docs/PRD.md` roadmap; `docs/PYPI.md` is the PyPI page (no relative images there)
20
+
21
+ ## Develop
22
+ ```bash
23
+ python -m venv .venv && .venv/Scripts/python -m pip install -e ".[dev]"
24
+ .venv/Scripts/python -m pytest -q
25
+ .venv/Scripts/blot bench --workdir <short path> # must stay 32/32
26
+ ```
27
+ - Any change to `classify.py` or a check: on each of the 5 clones, checked out at the `head` in its
28
+ labels file, run `blot bench --replay 500 --labels bench/labels/<repo>.json --update-labels`. Keep a
29
+ rule only if precision rises and no `useful` warning disappears; label any new `null` verdicts
30
+ (rules in bench/README.md). Targets: ≤ 1 warning / 10 commits, precision ≥ 80%.
31
+ - Clones live in `%LOCALAPPDATA%\Temp\wl\replay\` (labelled heads) and `...\wl\bench\` (case runs).
32
+ - `blot check` must stay under ~500 ms and never fail a commit because of Blot's own errors.
33
+
34
+ ## Release (each release so far followed this)
35
+ 1. Branch, bump `version` in `pyproject.toml` and `src/blot/__init__.py`, PR, wait for CI (6 jobs + "blot").
36
+ 2. Squash-merge, then `gh release create vX.Y.Z --target main`: `.github/workflows/release.yml`
37
+ publishes to PyPI via trusted publishing. PyPI/pip can lag a minute or two after publish.
38
+ 3. Verify: fresh venv, `pip install blot-git==X.Y.Z`, run `blot why src/flask/app.py:355` on a Flask clone.
39
+
40
+ ## Conventions
41
+ - Work on a branch, open a PR, merge only when the owner says so. Squash-merge.
42
+ - No `Co-Authored-By` trailer in commits or PRs (the owner's choice); PR bodies end with the Claude Code line.
43
+ - Contributors (e.g. O1sumitkumar) should comment on the issue before starting a PR.
44
+ - Never claim results that weren't run; label replay findings honestly (e.g. the Express
45
+ CVE-2024-51999 advisory was later withdrawn, so its revert was deliberate).
46
+
47
+ ## Windows gotchas (this machine)
48
+ - Long paths: clone big repos and make venvs under a short path like `%LOCALAPPDATA%\Temp\wl\`.
49
+ - The user folder has a space ("N Jayasankar"): quote paths; don't word-split commands in loops.
50
+ - Writing code through bash heredocs mangles `\b`, `\n`, `\s`: use the Edit tool for regexes/strings.
51
+ - `gh api` paths: no leading slash (Git Bash rewrites it).
52
+
53
+ ## State (2026-11-06)
54
+ - Released 0.6.0: checks, `why`, `--github`, agent guard (`blot guard` / `install-agent-hook`, tested
55
+ live in Claude Code 2026-11-06), bench/replay with labels, parallel indexing, pre-commit framework
56
+ support (`rev: v0.6.0`), GitHub Action (`uses: Sym-jay/Blot@v0.6.0`).
57
+ - Launch: dev.to post published 2026-10-24; the CVE sentence there should mention the withdrawn advisory.
58
+ - Open issues: #2–#4, #6 (bench cases); #33 (live guard report), #34 (quiet readded-bug case), #35–#36 (noise).
59
+ - Precision (0.5.0, measured 2026-10-30): 57/109 useful (52%); Django 1.19 / 10 commits, others ≤ 0.6.
60
+ `forgot-related-file` has 0 useful warnings in 45 labelled; candidate to become opt-in.
61
+ - `--github` measured (2026-11-01): precision unchanged (52.5%), +7 useful warnings, almost no demotions.
62
+ - Tried and dropped (2026-11-01): "fix word + PR number" as an offline fix rule: +85 warnings at 22%
63
+ useful. Don't retry it without a narrower signal (see bench/RESULTS.md).
64
+ - Agent guard (2026-11-04, branch `agent-guard`, unreleased): `blot guard` is a Claude Code PreToolUse
65
+ hook (`src/blot/guard.py`) running removed-fix + readded-bug on a proposed Edit/Write/MultiEdit;
66
+ `blot install-agent-hook` edits `.claude/settings.json`. Flask edit of `self_ref` warns in ~450 ms.
67
+ Not yet tried in a live Claude Code session.
68
+ - Next: remaining noise (renames, API swaps, added arguments, docstrings) in bench/RESULTS.md.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: blot-git
3
- Version: 0.4.0
3
+ Version: 0.6.0
4
4
  Summary: A pre-commit check that has read your project's history: warns when a change removes a fix, re-adds a fixed bug, or forgets a file that always changes too.
5
5
  Project-URL: Homepage, https://github.com/Sym-jay/Blot
6
6
  Project-URL: Issues, https://github.com/Sym-jay/Blot/issues
@@ -46,6 +46,10 @@ blot why src/app.py:42 # which commit explains this line, skipping refactors
46
46
  blot index --github # optional: issue/PR titles and labels via the gh CLI
47
47
  ```
48
48
 
49
- > **Status:** pre-alpha. All three checks work. Replayed on 500 recent commits each of Flask, requests, Express, Django and React, Blot warns on 0.6–10% of commits; see the bench results on GitHub. Please report false alarms.
49
+ **Guard coding agents.** `blot install-agent-hook` adds a Claude Code hook that runs the same checks on
50
+ an edit an agent is about to make, so the agent sees "this line exists because of fix 8efea0c" before
51
+ it "simplifies" it away. It warns by default; `--ask` makes Claude Code ask you first.
52
+
53
+ > **Status:** pre-alpha. All three checks work. Replayed on 500 recent commits each of Flask, requests, Express, Django and React, Blot warns on 0.6–9.5% of commits, and about half of its warnings (labelled by hand) are worth a reviewer's time; see the bench results on GitHub. Please report false alarms.
50
54
 
51
55
  Meet Sora the slime, read the docs, or contribute on GitHub: https://github.com/Sym-jay/Blot
@@ -22,7 +22,7 @@ It runs locally, needs no account or AI, and stays quiet unless the history give
22
22
 
23
23
  *A real run on Flask. Plain `git blame` points to a 2023 commit that only moved this line; Blot traces past it to the 2020 fix that explains it. (Regenerate with `python assets/demo/make_demo.py`.)*
24
24
 
25
- > **Status:** pre-alpha. Milestones M1 and M2 are done: `blot index` builds the history index (Flask's 3,800 commits in ~2 s), `blot install-hook` wires up git, and `blot check` runs the three checks. On Flask it traces an edit to `self_ref = weakref.ref(self)` past the 2023 file split to the 2020 fix, in under 500 ms. Replayed on the last 500 commits of Flask, requests, Express, Django and React, it warns on 0.6–10% of commits; see [bench/RESULTS.md](bench/RESULTS.md). Roadmap: [PRD](docs/PRD.md#12-milestones-4-weeks-part-time).
25
+ > **Status:** pre-alpha. Milestones M1 and M2 are done: `blot index` builds the history index (Flask's 3,800 commits in ~2 s), `blot install-hook` wires up git, and `blot check` runs the three checks. On Flask it traces an edit to `self_ref = weakref.ref(self)` past the 2023 file split to the 2020 fix, in under 500 ms. Replayed on the last 500 commits of Flask, requests, Express, Django and React, it warns on 0.6–9.5% of commits, and about half of its warnings (57 of 109, each labelled by hand) are worth a reviewer's time; see [bench/RESULTS.md](bench/RESULTS.md). Roadmap: [PRD](docs/PRD.md#12-milestones-4-weeks-part-time).
26
26
 
27
27
  ## Meet Sora
28
28
 
@@ -71,6 +71,42 @@ src/flask/app.py:355
71
71
 
72
72
  `blot why FILE:LINE` (or `FILE:START-END`) finds the commit that explains a line, skipping commits that only moved it. Plain `git blame` stops at the refactor.
73
73
 
74
+ ## Guard coding agents
75
+
76
+ Coding agents are the most likely to "clean up" a line they don't understand. `blot guard` is a
77
+ [Claude Code](https://code.claude.com/docs/en/hooks) `PreToolUse` hook on `Edit`, `Write` and `MultiEdit`:
78
+ it runs the `removed-fix` and `readded-bug` checks on the edit the agent is about to make, and hands any
79
+ finding to the agent as context:
80
+
81
+ ```
82
+ blot: 1 warning
83
+
84
+ ! removed-fix src/flask/app.py:355
85
+ You're removing or changing a line that a bug fix added.
86
+ Check that the bug it fixed can't come back.
87
+ 8efea0c "Break reference cycle created by default in Flask instances." (2020-10-03)
88
+ traced past refactor 0ec7f71 "Split the App and Blueprint into Sansio and IO parts"
89
+ Run `blot why FILE:LINE` for the full history before you change it.
90
+ ```
91
+
92
+ ```bash
93
+ blot install-agent-hook # adds the hook to .claude/settings.json and builds the index
94
+ blot install-agent-hook --local # or .claude/settings.local.json, which isn't committed
95
+ blot install-agent-hook --ask # also ask you to approve edits that touch a fix
96
+ ```
97
+
98
+ The hook command names this machine's Python by absolute path (like `install-hook`), so prefer `--local`
99
+ if your team commits `.claude/settings.json`. Remove it with `blot install-agent-hook --uninstall`
100
+ (add `--local` if you installed it there); other hooks in the file are left alone.
101
+
102
+ By default the guard only warns: Claude Code adds the warning to the agent's context with the edit's
103
+ result, and the normal permission flow is unchanged. With `--ask`, Claude Code stops before the edit and
104
+ asks you, showing the warning. The guard prints nothing when it has nothing to say, stays quiet for
105
+ files outside a git repo or not tracked at HEAD, and never blocks an edit because of its own errors. It
106
+ doesn't build a first index (that can take a minute): `install-agent-hook` does, or run `blot index`.
107
+ After that it refreshes the index incrementally. On Flask a guarded edit takes about 450 ms.
108
+ `forgot-related-file` is left out: it had no useful warnings among the 45 labelled in replays.
109
+
74
110
  ## Issue and PR titles (optional)
75
111
 
76
112
  ```bash
@@ -91,7 +127,7 @@ jobs:
91
127
  blot:
92
128
  runs-on: ubuntu-latest
93
129
  steps:
94
- - uses: Sym-jay/Blot@v0.4.0
130
+ - uses: Sym-jay/Blot@v0.6.0
95
131
  ```
96
132
 
97
133
  The action checks out the pull request with its full history, installs Blot, runs `blot index` and
@@ -1,6 +1,6 @@
1
1
  # Run Blot on a pull request and show its findings as warning annotations.
2
2
  # Usage (in a workflow triggered by pull_request):
3
- # - uses: Sym-jay/Blot@v0.4.0
3
+ # - uses: Sym-jay/Blot@v0.6.0
4
4
  # See "Use in CI" in README.md.
5
5
  name: Blot
6
6
  description: History-aware checks on the commits of a pull request, shown as warning annotations
@@ -38,5 +38,32 @@ using only the history that existed before it. It prints how many commits would
38
38
  and lists every warning, so you can label each one as useful or noise. Noise patterns become fixes in
39
39
  `classify.py` or the checks, plus a quiet case here so they never come back.
40
40
 
41
+ ### Labels: precision you can re-measure
42
+
43
+ ```bash
44
+ cd ~/wl/flask && git checkout <head from the labels file>
45
+ blot bench --replay 500 --labels path/to/Blot/bench/labels/pallets-flask.json
46
+ ```
47
+
48
+ `bench/labels/` holds a hand verdict for every replay warning on the five reference repos. With
49
+ `--labels`, replay prints `precision: X useful / Y labelled` and marks each warning `[useful]`,
50
+ `[noise]` or `[?]`. Add `--update-labels` to append new, unlabelled warnings (`"verdict": null`) to the
51
+ file, then fill them in. Labels match on commit, check, path and the commit the warning cites, so
52
+ they survive small line-number drift. Replay at the `head` the file records, or the commits differ.
53
+
54
+ How to label:
55
+
56
+ - **useful**: the cited commit really fixed a bug, and the change touches what that fix did, so a
57
+ reviewer would want to know. This holds even if the change turned out fine (Express's deliberate
58
+ revert of the CVE-2024-51999 patch is useful). For co-change: the partner file really should have
59
+ been looked at.
60
+ - **noise**: the cited commit isn't a real fix (a feature, a refactor, docs), or the change doesn't
61
+ touch what the fix did (formatting, comments, a rename, unrelated code nearby).
62
+
63
+ Write a short `reason` either way; grouping noise by reason shows which rule to fix next.
64
+
65
+ Add `--github` to replay with issue and PR labels too, as after `blot index --github` (needs the
66
+ GitHub CLI logged in and a GitHub `origin` or `upstream` remote).
67
+
41
68
  Target: **at most 1 warning per 10 commits**, and most of those should be worth reading.
42
69
  See [RESULTS.md](RESULTS.md) for the latest numbers.
@@ -0,0 +1,113 @@
1
+ # Bench results
2
+
3
+ Measured 2026-10-30 with `blot bench`, on Windows 11, Python 3.12.
4
+
5
+ ## Cases: 32/32 correct
6
+
7
+ | Check | Cases | Precision | Recall |
8
+ |---|---|---|---|
9
+ | removed-fix | 24 (16 warn, 8 quiet) | 100% | 100% |
10
+ | readded-bug | 5 (4 warn, 1 quiet) | 100% | 100% |
11
+ | forgot-related-file | 3 (3 quiet) | n/a | n/a |
12
+
13
+ A quiet case now fails if its scripted edit can't be applied (it used to pass without running).
14
+
15
+ The 21 cases added in this round are real commits from the labelled replays below: each one replays
16
+ that commit's own hunk on its parent. Quiet cases pin the noise patterns fixed here so they stay fixed.
17
+
18
+ ## Replay: last 500 non-merge commits of 5 repos, every warning labelled
19
+
20
+ Each commit is checked as if it were being committed at that moment, using only the history before
21
+ it. Every warning was then labelled by hand as **useful** or **noise** (rules in
22
+ [README.md](README.md#labels-precision-you-can-re-measure)); the labels live in [`labels/`](labels/),
23
+ so these numbers can be re-measured after any rule change. "Before" is Blot 0.4.0; "after" is this
24
+ release.
25
+
26
+ | Repo | Labelled at | Commits | Warnings / 10 commits, before → after | Precision, before → after |
27
+ |---|---|---|---|---|
28
+ | pallets/flask | `d086db856` | 500 | 0.10 → **0.08** | 3/5 (60%) → **3/4 (75%)** |
29
+ | psf/requests | `611c6162c` | 500 | 0.16 → **0.16** | 2/8 (25%) → **2/8 (25%)** |
30
+ | expressjs/express | `0dee2c52c` | 498 | 0.18 → **0.18** | 5/9 (56%) → **5/9 (56%)** |
31
+ | django/django | `79502d084` | 497 | 1.29 → **1.19** | 40/64 (63%) → **40/59 (68%)** |
32
+ | facebook/react | `9ffcb463b` | 483 | 1.26 → **0.60** | 7/61 (11%) → **7/29 (24%)** |
33
+ | **All** | | 2,478 | 0.59 → **0.44** | 57/147 (39%) → **57/109 (52%)** |
34
+
35
+ The rule changes removed 38 warnings, all of them labelled noise; no useful warning was lost.
36
+
37
+ **Against the PRD targets:** at most 1 warning per 10 commits is met everywhere except Django (1.19).
38
+ Precision of 80% is **not** met: 52% overall, 68% on Django, where most warnings are fixes touching
39
+ code from earlier fixes and CVEs.
40
+
41
+ ### What a useful warning looks like
42
+
43
+ - Django `8fd29079e` relaxed the POST permission check that the CVE-2019-19118 fix added.
44
+ - Django `7ff7fcc05` redid the `parse_header_parameters` simplification that an earlier commit had
45
+ reverted as a bug (#36520). Both `removed-fix` and `readded-bug` fired.
46
+ - Flask `cabda59` changed `bp_subdomain is None` to `is not None` on a line from fix #4834; a later
47
+ commit had to fix the behaviour.
48
+ - Express `697547cd` reverted the CVE-2024-51999 patch. That revert was deliberate (the advisory,
49
+ GHSA-pj86-cfqh-vqx6, was later withdrawn), so it is useful as "a security fix is being undone",
50
+ not as a caught regression.
51
+
52
+ ### Noise this release removed
53
+
54
+ | Noise (warnings) | Fix |
55
+ |---|---|
56
+ | React feature-flag forks, per-bundler and per-platform copies of one file (27) | co-change skips variants: same name stem and extension (`ReactFeatureFlags.native-fb.js` ↔ `ReactFeatureFlags.js`); `foo.c` ↔ `foo.h` still pair |
57
+ | deleting a whole file (4) | `removed-fix` skips deleted files |
58
+ | commits cited as fixes that weren't: `Fixed #21189: Cleaned up ...`, `Fixed #12882 - Moved ...`, `[DevTools] upgrade to Manifest V3`, `Change Flask.__init__ to accept ...`, error-message wording (6) | `Fixed #N:` / `Fixed #N -` ticket styles judged by their description; cleanups count as refactors; `[Tag]` prefixes and "change" subjects count as features; error messages are routine |
59
+ | docstrings with `backticks` or (asides) (1) | they count as prose |
60
+
61
+ ### Noise still there (52 warnings)
62
+
63
+ | Pattern | Warnings | Why there's no rule yet |
64
+ |---|---|---|
65
+ | co-change partner not needed (React) | 9 | **0 of 45 co-change warnings across all five repos were useful.** See below. |
66
+ | renames, equivalent API swaps (`substr` → `slice`, `req.connection` → `req.socket`) | 11 | a rename and a switch to a different variable look the same on one line |
67
+ | new argument or keyword argument on a fix's call | 3 | adding an argument can change behaviour |
68
+ | formatter reflows with f-strings or joined lines (requests' Black commit) | 4 | dropping parentheses can change precedence |
69
+ | deleting a legacy module or feature in pieces (React) | 6 | intentional, but only the commit message says so |
70
+ | docstring lines that still read as code | 3 | needs to know it's inside a docstring, not just how the line looks |
71
+ | other: code moved to another file, fix behaviour kept while restructuring, generic re-added lines | 16 | case by case |
72
+
73
+ **`forgot-related-file` has shown no useful warning yet**: 0/45 before this release, 0/9 after. It
74
+ stays on, because the remaining warnings are rare (React only), but it is the first candidate to
75
+ become opt-in if real-world reports agree.
76
+
77
+ ## Does `--github` help? (measured 2026-11-01)
78
+
79
+ `blot bench --replay 500 --github` reads issue and PR labels the way `blot index --github` does.
80
+ Flask, requests, Express and React track bugs on GitHub; Django's GitHub Issues are off (it uses
81
+ Trac), so it is unchanged. New warnings were labelled with the same rules.
82
+
83
+ | Repo | Without `--github` | With `--github` | Commits re-judged by labels |
84
+ |---|---|---|---|
85
+ | pallets/flask | 3/4 (75%) | 3/4 (75%) | 0 |
86
+ | psf/requests | 2/8 (25%) | **4/10 (40%)** | 15 upgraded |
87
+ | expressjs/express | 5/9 (56%) | 5/9 (56%) | 25 upgraded |
88
+ | facebook/react | 7/29 (24%) | **12/40 (30%)** | 154 upgraded, 4 demoted |
89
+ | **All five, with Django** | 57/109 (52.3%) | **64/122 (52.5%)** | |
90
+
91
+ **`--github` doesn't raise precision; it finds more useful warnings** (7 more, with 5 more noise).
92
+ Labels almost never demote a commit (4 of ~3,200 issues and PRs looked up). What they do is
93
+ upgrade commits like `ReactDOM: Fix missing form data ... (#28056)`, which Blot rates as unclear
94
+ without labels: "Fix" isn't at the start, and there's no "fixes #N" or strong defect word.
95
+
96
+ Caveat: labels are read as they are today, so a label added after a commit was made counts too.
97
+
98
+ ### Tried and dropped: "a fix word plus a PR number" (2026-11-01)
99
+
100
+ Could a rule do offline what the `bug` label does? Rule tried: a fix word anywhere in the subject
101
+ plus an issue or PR number makes a commit a fix. It added **85 warnings** (React went from 0.60 to
102
+ 1.95 per 10 commits), because almost every React and Express subject ends in its PR number. Of 46
103
+ labelled (all of requests' and Express's, 20 of React's), **10 were useful (22%)**. Most were
104
+ `fix(deps): …@^2.0.0` bumps, "Fix Flow type" commits and import lines. Overall precision would fall
105
+ from 52% to about 39%, so the rule was not kept. Its 46 labels stay in `labels/` for any narrower
106
+ attempt. A label written by a maintainer says more than a keyword can.
107
+
108
+ ## Reproduce
109
+
110
+ ```bash
111
+ git clone https://github.com/pallets/flask && cd flask && git checkout d086db856
112
+ blot bench --replay 500 --labels path/to/Blot/bench/labels/pallets-flask.json
113
+ ```