Skip to content

Commit ebac00b

Browse files
measure the 50% claim: it holds on 2 of 3 repos, and multi-file is the bound
Not "how many fixes match a catalogue" and not "how many are one token", but the architectural question: how many real fixes are small and local enough for a taught class to express. SpanEdit already does multi-line, so the bound is one file, a few lines, learnable shape. repo fix commits ONE file one file+one hunk crosses 50% at raylib 1,041 85.4% 35.2% <= 9 changed lines cglm 225 60.9% 30.2% <= 14 changed lines Box2D 300 41.3% 23.0% NEVER (tops at 41.3%) "More than half of bugs" is measurably true on raylib and cglm if a class can span ~10 lines in one file — far above the 2-4% the shipped classes cover and above the 7-16% single-line ceiling. Box2D never crosses it and the reason is NOT shape or size: 59% of its fix commits touch more than one file. No line budget reaches those, because the search is single-file by construction. So the binding constraint is multi-file, and that lane already exists: the PAIR law's PARTITION ruling is exactly "the failing tests split into independent groups, so this is N separate single-bug repairs". Fused, verified over all 256 situations, NOT actuated — and a two-bug fixture measured it turning a refusal into a green suite in one extra 2.7s pass. The roadmap to the 50% claim is therefore not a bigger vocabulary. It is actuating PARTITION. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent bbc6b58 commit ebac00b

2 files changed

Lines changed: 118 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# How much of real bug-fixing is within reach — the 50% question
2+
3+
Not "how many fixes match a catalogue" (RECURRENCE.md) and not "how many are one
4+
token" (CEILING.md), but the architectural question: **how many real bug fixes
5+
are small and local enough for a taught class to express?** `SpanEdit` already
6+
does multi-line, so the bound is one file, a few lines, in a learnable shape.
7+
8+
Reproduce: `python3 reach.py <path-to-a-full-clone>`
9+
10+
| repo | fix commits | touch ONE file | one file, one hunk | crosses 50% at |
11+
|---|---|---|---|---|
12+
| raylib | 1,041 | **85.4%** | 35.2% | **≤ 9 changed lines** |
13+
| cglm | 225 | **60.9%** | 30.2% | **≤ 14 changed lines** |
14+
| Box2D | 300 | 41.3% | 23.0% | **never — tops out at 41.3%** |
15+
16+
## The answer
17+
18+
**"More than half of bugs" is measurably true on two of these three
19+
repositories** — if a taught class can span roughly ten lines inside one file.
20+
raylib crosses 50% at nine changed lines; cglm at fourteen. That is far above
21+
the 2-4% the shipped six classes cover, and above the 7-16% single-line ceiling.
22+
23+
**Box2D never crosses it, and the reason is not shape or size.** 59% of its fix
24+
commits touch MORE THAN ONE FILE. No line budget reaches them, because the limit
25+
is not how much a class can express — it is that the search is single-file by
26+
construction.
27+
28+
## So the binding constraint is multi-file, not entropy
29+
30+
The distribution says the same thing three times:
31+
32+
* one file, any size 41-85% of fixes
33+
* one file, one contiguous hunk 23-35%
34+
* one file, <= 3 lines 16-23%
35+
36+
Line count is cheap to widen; a taught span already covers it. **Crossing from
37+
~35% to ~85% on raylib means repairing more than one site.**
38+
39+
That lane already exists and is already verified. The PAIR law's `PARTITION`
40+
ruling is precisely this case: when the failing tests split into independent
41+
groups, the situation is N separate single-bug repairs — linear, not
42+
combinatorial. It is fused, exhaustively checked over all 256 situations, and
43+
**not actuated**. A separate measurement showed a genuine two-bug fixture where
44+
PARTITION turns a refusal into a green suite in one extra 2.7-second pass.
45+
46+
**That is the honest roadmap to the 50% claim:** not a bigger vocabulary, not
47+
cleverer classes — actuate PARTITION and let the search repair disjoint sites
48+
one at a time.
49+
50+
## Caveats
51+
- Three C/C++ repositories. "fix-worded" is a commit-message heuristic.
52+
- Being *reachable* is not being *repaired*: the repo's own suite must still see
53+
the defect, and on cglm 3 of 6 real one-token fixes were invisible to its own
54+
tests. Reach is a ceiling, not a hit rate.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
"""How big is a real bug fix? The cumulative curve, and where it crosses 50%.
2+
3+
fluidfix's architecture reaches: one FILE, a small number of LINES, in a shape a
4+
taught class can express (SpanEdit already does multi-line). So the ceiling is
5+
not "single token" — it is "how many fixes are small and local enough".
6+
7+
This measures the distribution and reports where the cumulative share crosses
8+
50%, so the claim "more than half of bugs, when the classes are shaped well"
9+
can be checked rather than asserted.
10+
"""
11+
import collections, re, subprocess, sys
12+
13+
root = sys.argv[1]
14+
FIX = re.compile(r"fix|bug|crash|wrong|incorrect|regress|issue|broken|error", re.I)
15+
SKIP = re.compile(r"(^|/)(test|tests|third_party|external|vendor|deps|examples?|samples?)/", re.I)
16+
17+
log = subprocess.run(
18+
["git", "-C", root, "log", "--no-merges", "-U0", "--format=COMMIT\t%H\t%s",
19+
"-p", "--", "*.c", "*.cpp", "*.h", "*.hpp", "*.cc", "*.m"],
20+
capture_output=True, text=True, errors="replace").stdout
21+
22+
cur = subj = None; curfile = ""
23+
files = set(); changed = 0; hunks = 0
24+
rows = []
25+
26+
def end():
27+
if cur is not None and FIX.search(subj) and files:
28+
rows.append((len(files), hunks, changed))
29+
30+
for line in log.splitlines():
31+
if line.startswith("COMMIT\t"):
32+
end(); _, cur, subj = line.split("\t", 2)
33+
files, changed, hunks, curfile = set(), 0, 0, ""
34+
elif line.startswith("+++ "):
35+
curfile = line[4:]
36+
elif line.startswith("@@"):
37+
if curfile and not SKIP.search(curfile): hunks += 1
38+
elif line.startswith(("+", "-")) and not line.startswith(("+++", "---")):
39+
if curfile and not SKIP.search(curfile):
40+
files.add(curfile); changed += 1
41+
end()
42+
43+
n = len(rows) or 1
44+
name = root.rstrip("/").rsplit("/", 1)[-1]
45+
print(f"{name}: {n} fix commits touching source")
46+
one_file = [r for r in rows if r[0] == 1]
47+
print(f" touch exactly ONE file : {len(one_file):>5} {100*len(one_file)/n:5.1f}%")
48+
print(f" ONE file AND ONE contiguous hunk : "
49+
f"{sum(1 for r in one_file if r[1] == 1):>5} "
50+
f"{100*sum(1 for r in one_file if r[1] == 1)/n:5.1f}%")
51+
print(" cumulative share of ALL fix commits, by changed lines in one file:")
52+
cum = 0
53+
for k in (1, 2, 3, 5, 8, 12, 20, 40):
54+
c = sum(1 for r in one_file if r[1] == 1 and r[2] <= k)
55+
print(f" <= {k:>2} lines, one hunk : {c:>5} {100*c/n:5.1f}%")
56+
# where does one-file cross 50%?
57+
for k in range(1, 400):
58+
c = sum(1 for r in one_file if r[2] <= k)
59+
if 100*c/n >= 50:
60+
print(f" ONE file crosses 50% of all fix commits at <= {k} changed lines")
61+
break
62+
else:
63+
c = 100*len(one_file)/n
64+
print(f" ONE file NEVER reaches 50% (tops out at {c:.1f}%)")

0 commit comments

Comments
 (0)