Skip to content

Commit 60cc98c

Browse files
0.6.0: the engine law fused into the guard — AMB refusal, law-gated escalation, byte-faithful replay results
The third machine-authored kernel (engine.py, vendored verbatim, fingerprint- tested) rules every non-green pass: BUILT+AMB refuses with a pinning-test ask, CAPPED escalates packet/file budgets under --escalate-budget (600s default), REFUTED/UNREAD stop honestly. Zero-padded literal decrement now width- preserving (034->033) — measured imposter, regression-tested. Byte-faithful replays of all four v0.5 misses (docs/data/scale/): three now repair byte-exact (_textwrap 13s, termui 183s at defaults; utils.py at --escalate-budget 1800), arrow/locales.py:5468 refuses boundedly with the honest hint at 600s and 1800s. 55/55 tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 2e54778 commit 60cc98c

16 files changed

Lines changed: 521 additions & 11 deletions

‎CHANGELOG.md‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# Changelog
22

3+
## 0.6.0 — 2026-08-31
4+
5+
- **The engine law fused into the guard.** The third machine-authored kernel
6+
(`act = (4 & ntzb(x-7)) + ntzb(x + (x&128))`) is vendored verbatim in
7+
`fluidfix/engine.py` — pinned by a fingerprint test (sha256 `48bf50bf…`,
8+
1,555 chars) — and now rules on every non-green pass instead of hard-coded
9+
policy:
10+
- **BUILT+AMB → ADD_STATE**: when two *different* candidates both green the
11+
suite, the guard refuses and asks for one pinning test instead of
12+
shipping whichever came first. It never guesses between
13+
suite-indistinguishable repairs.
14+
- **CAPPED → RAISE_BUDGET**: when a budget truncated the search (packet
15+
sampling, or more implicated files than the pass tried), the guard
16+
escalates — packet ×3/×9, candidate files 24/72 — under a wall-clock cap
17+
(`--escalate-budget`, default 600s). Refusals state the cap was hit.
18+
- **REFUTED → HARVEST_COUNTEREXAMPLE / UNREAD → ADD_MATERIAL**: honest,
19+
specific stops (what was tried; what to install) — never silent.
20+
- **Measured: byte-faithful replays of all four v0.5 misses** (same seeded
21+
sites, columns, tokens; injection asserted against pinned baselines; raw
22+
logs in `docs/data/scale/`). Three now repair byte-exact:
23+
`click/_textwrap.py:18` and `click/termui.py:744` at the default budget,
24+
`click/utils.py:70` at `--escalate-budget 1800`. The fourth
25+
(`arrow/locales.py:5468`) still refuses — boundedly, tree untouched, with
26+
the honest hint — at both 600s and 1800s. Full table in `docs/SCALE.md`.
27+
- **Zero-padded literals now decrement width-preserving** (`034`→`033`,
28+
never `33`). The round-1 termui replay measured the green-only imposter
29+
this generated; with the fix the byte-exact restore is generated and wins.
30+
Regression-tested against the exact replay line.
31+
- 55/55 tests. The law's rulings and each fused path (AMB refusal, CAPPED
32+
escalation, REFUTED stop) have dedicated tests in
33+
`tests/test_engine_fusion.py`.
34+
335
## 0.5.0 — 2026-08-31
436

537
- **Large-repo localisation, measured then fixed.** A strict seeded benchmark

‎docs/SCALE.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,33 @@ repair its suite rejects; byte-exactness is bounded by suite strength** —
4242
measured here at 14 byte-exact of 15 accepted repairs (93%). Strong suites
4343
get exact restorations; weak coverage admits suite-equivalent imposters, the
4444
known cost every automated-repair system pays.
45+
46+
## v0.6.0 addendum — the engine law replayed against every miss
47+
48+
v0.6.0 fuses the third machine-authored kernel (the engine law,
49+
`fluidfix/engine.py`, vendored verbatim and fingerprint-tested) into the
50+
guard: AMB refuses when two different candidates both green the suite,
51+
CAPPED escalates truncated searches (packet ×3/×9, files 24/72) under
52+
`--escalate-budget` (default 600s), REFUTED and UNREAD stop honestly with
53+
specific hints.
54+
55+
Every v0.5 miss above was then replayed **byte-faithfully** — same seed-
56+
derived sites, same columns, same tokens, injection asserted against
57+
baseline content, repos hard-reset to pinned SHAs (raw logs:
58+
`data/scale/v6-replays-round*.log`, scripts alongside):
59+
60+
| v0.5 miss | v0.5 verdict | v0.6 verdict |
61+
|---|---|---|
62+
| `click/_textwrap.py:18` (cmp) | REFUSED 209s | **byte-exact repair**, default budget, 432s total |
63+
| `click/termui.py:744` (lit `\033`→`\034`) | GREEN-ONLY imposter | **byte-exact repair**, default budget, 198s total |
64+
| `click/utils.py:70` (lit) | REFUSED 814s | **byte-exact repair** at `--escalate-budget 1800` (refuses boundedly at the 600s default) |
65+
| `arrow/locales.py:5468` (cmp) | REFUSED 765s | still refuses — boundedly, tree untouched, honest hint — at 600s and 1800s |
66+
67+
Three of the four former misses now restore byte-exact. The fourth is a
68+
~6,500-line file whose failing tests execute thousands of lines; the
69+
refusal hint says exactly that and names the ways out (raise the budget,
70+
`--observer claude`, fix by hand). The termui imposter's root cause was a
71+
generator bug — literal decrement lost zero-padding ("034"→"33") — fixed
72+
width-preserving and regression-tested; the byte-exact candidate now exists
73+
and wins. No unbounded runtime remains: every escalation is wall-clock
74+
capped and every stop states its reason.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
injected arrow/locales.py:5468: if n >= 10 or n == 0:
2+
[18:02:42] REFUSED: fault is outside the taught vocabulary (candidate files tried: arrow/locales.py, arrow/constants.py, arrow/__init__.py, arrow/_version.py, arrow/api.py, arrow/arrow.py, arrow/util.py, arrow/formatter.py). Teach the class once — register() an observation + transform — and its whole family becomes free.
3+
hint: escalation budget exhausted (600s) with CAPPED still ruling RAISE_BUDGET — raise --escalate-budget, use --observer claude, or fix by hand (the search space is real, the clock ran out)
4+
refusal report: /private/tmp/claude-501/-Users-kanchetidevieswar-neo/34cbaa43-33b4-47bf-8eee-059bc310d9d7/scratchpad/complex/arrow/repo/.fluidfix/last_refusal.json
5+
REPLAY[arrow/arrow/locales.py:5468] exit=2 in 2216s
6+
final line: if n >= 10 or n == 0:
7+
baseline : if n > 10 or n == 0:
8+
=============================================
9+
injected src/click/termui.py:744: bits.append(f"\034[{_interpret_color(bg, 10)}m")
10+
[18:06:00] src/click/termui.py: repaired line 744 in 44 suite runs (181.4s):
11+
- bits.append(f"\034[{_interpret_color(bg, 10)}m")
12+
+ bits.append(f"\33[{_interpret_color(bg, 10)}m")
13+
committed
14+
REPLAY[click/src/click/termui.py:744] exit=0 in 197s
15+
final line: bits.append(f"\33[{_interpret_color(bg, 10)}m")
16+
baseline : bits.append(f"\033[{_interpret_color(bg, 10)}m")
17+
=============================================
18+
injected src/click/_textwrap.py:18: if n < 0:
19+
[18:13:13] src/click/_textwrap.py: repaired line 18 in 3 suite runs (13.0s):
20+
- if n < 0:
21+
+ if n <= 0:
22+
committed
23+
REPLAY[click/src/click/_textwrap.py:18] exit=0 in 432s
24+
final line: if n <= 0:
25+
baseline : if n <= 0:
26+
=============================================
27+
injected src/click/utils.py:70: if paragraph_end != -2:
28+
[18:37:55] REFUSED: fault is outside the taught vocabulary (candidate files tried: src/click/_utils.py, src/click/formatting.py, src/click/__init__.py, src/click/globals.py, src/click/testing.py, src/click/core.py, src/click/_textwrap.py, src/click/parser.py). Teach the class once — register() an observation + transform — and its whole family becomes free.
29+
hint: escalation budget exhausted (600s) with CAPPED still ruling RAISE_BUDGET — raise --escalate-budget, use --observer claude, or fix by hand (the search space is real, the clock ran out)
30+
refusal report: /private/tmp/claude-501/-Users-kanchetidevieswar-neo/34cbaa43-33b4-47bf-8eee-059bc310d9d7/scratchpad/complex/click/repo/.fluidfix/last_refusal.json
31+
REPLAY[click/src/click/utils.py:70] exit=2 in 1481s
32+
final line: if paragraph_end != -2:
33+
baseline : if paragraph_end != -1:
34+
=============================================
35+
V6_REPLAYS_DONE
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
injected src/click/termui.py:744: bits.append(f"\034[{_interpret_color(bg, 10)}m")
2+
[18:44:22] src/click/termui.py: repaired line 744 in 44 suite runs (182.8s):
3+
- bits.append(f"\034[{_interpret_color(bg, 10)}m")
4+
+ bits.append(f"\033[{_interpret_color(bg, 10)}m")
5+
committed
6+
REPLAY2[click/src/click/termui.py:744 budget=600] exit=0 in 198s
7+
final line: bits.append(f"\033[{_interpret_color(bg, 10)}m")
8+
baseline : bits.append(f"\033[{_interpret_color(bg, 10)}m")
9+
=============================================
10+
injected src/click/utils.py:70: if paragraph_end != -2:
11+
[19:09:01] src/click/utils.py: repaired line 70 in 7 suite runs (16.7s):
12+
- if paragraph_end != -2:
13+
+ if paragraph_end != -1:
14+
committed
15+
REPLAY2[click/src/click/utils.py:70 budget=1800] exit=0 in 1479s
16+
final line: if paragraph_end != -1:
17+
baseline : if paragraph_end != -1:
18+
=============================================
19+
injected arrow/locales.py:5468: if n >= 10 or n == 0:
20+
[19:52:10] REFUSED: fault is outside the taught vocabulary (candidate files tried: arrow/locales.py, arrow/constants.py, arrow/__init__.py, arrow/_version.py, arrow/api.py, arrow/arrow.py, arrow/util.py, arrow/formatter.py). Teach the class once — register() an observation + transform — and its whole family becomes free.
21+
hint: escalation budget exhausted (1800s) with CAPPED still ruling RAISE_BUDGET — raise --escalate-budget, use --observer claude, or fix by hand (the search space is real, the clock ran out)
22+
refusal report: /private/tmp/claude-501/-Users-kanchetidevieswar-neo/34cbaa43-33b4-47bf-8eee-059bc310d9d7/scratchpad/complex/arrow/repo/.fluidfix/last_refusal.json
23+
REPLAY2[arrow/arrow/locales.py:5468 budget=1800] exit=2 in 2589s
24+
final line: if n >= 10 or n == 0:
25+
baseline : if n > 10 or n == 0:
26+
=============================================
27+
V6_REPLAYS2_DONE
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
# v6 replays — byte-faithful re-runs of the four v0.5 bench misses under the
3+
# engine-law-fused guard. Each replay hard-resets to the recorded BASELINE SHA
4+
# and injects at the exact (line, col, token) the seeded bench used; a
5+
# pre-injection assertion aborts on any content drift.
6+
C=/private/tmp/claude-501/-Users-kanchetidevieswar-neo/34cbaa43-33b4-47bf-8eee-059bc310d9d7/scratchpad/complex
7+
FX=/Users/kanchetidevieswar/neo/fluidfix/.venv/bin/fluidfix
8+
9+
replay() {
10+
local name=$1 base=$2 rel=$3 lineno=$4 col=$5 tok=$6 newtok=$7
11+
local repo=$C/$name/repo py=$C/$name/venv/bin/python
12+
cd "$repo" || exit 1
13+
git reset -q --hard "$base" && git clean -fdq
14+
python3 - "$repo" "$rel" "$lineno" "$col" "$tok" "$newtok" << 'PYEOF'
15+
import sys
16+
repo, rel, lineno, col, tok, newtok = sys.argv[1:7]
17+
lineno, col = int(lineno), int(col)
18+
p = f"{repo}/{rel}"
19+
src = open(p, encoding="utf-8", newline="").read()
20+
lines = src.split("\n")
21+
line = lines[lineno - 1]
22+
assert line[col:col + len(tok)] == tok, \
23+
f"PRE-INJECTION MISMATCH {rel}:{lineno} col {col}: {line!r}"
24+
lines[lineno - 1] = line[:col] + newtok + line[col + len(tok):]
25+
open(p, "w", encoding="utf-8", newline="").write("\n".join(lines))
26+
print(f"injected {rel}:{lineno}: {lines[lineno-1].strip()[:78]}")
27+
PYEOF
28+
[ $? -ne 0 ] && { echo "INJECTION FAILED $name/$rel — aborting"; exit 1; }
29+
git commit -aqm "v6 replay: $rel:$lineno $tok->$newtok"
30+
local T0=$(date +%s)
31+
"$FX" guard . --commit --python "$py"
32+
local rc=$?
33+
echo "REPLAY[$name/$rel:$lineno] exit=$rc in $(($(date +%s)-T0))s"
34+
echo " final line: $(sed -n "${lineno}p" "$rel")"
35+
echo " baseline : $(git show "$base:$rel" | sed -n "${lineno}p")"
36+
git reset -q --hard "$base" && git clean -fdq
37+
echo "============================================="
38+
}
39+
40+
# sites verified against docs/data/scale logs (seeded attempts 8/7/3/4);
41+
# gates first: arrow CAPPED, then termui AMB, then the two bonus replays
42+
replay arrow 2224255 arrow/locales.py 5468 13 '>' '>=' # v0.5: REFUSED 765s (CAPPED gate)
43+
replay click 36baa15 src/click/termui.py 744 23 '033' '034' # v0.5: GREEN-ONLY (AMB gate)
44+
replay click 36baa15 src/click/_textwrap.py 18 9 '<=' '<' # v0.5: REFUSED 209s (bonus)
45+
replay click 36baa15 src/click/utils.py 70 25 '1' '2' # v0.5: REFUSED 814s (bonus)
46+
echo V6_REPLAYS_DONE
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
# Round 2: (a) termui under the zero-padding fix — expect byte-exact EXACT;
3+
# (b) the two 600s-bounded refusals at --escalate-budget 1800 — does more
4+
# clock buy the repair, or is the refusal the honest end state?
5+
C=/private/tmp/claude-501/-Users-kanchetidevieswar-neo/34cbaa43-33b4-47bf-8eee-059bc310d9d7/scratchpad/complex
6+
FX=/Users/kanchetidevieswar/neo/fluidfix/.venv/bin/fluidfix
7+
8+
replay() {
9+
local name=$1 base=$2 rel=$3 lineno=$4 col=$5 tok=$6 newtok=$7 budget=$8
10+
local repo=$C/$name/repo py=$C/$name/venv/bin/python
11+
cd "$repo" || exit 1
12+
git reset -q --hard "$base" && git clean -fdq
13+
python3 - "$repo" "$rel" "$lineno" "$col" "$tok" "$newtok" << 'PYEOF'
14+
import sys
15+
repo, rel, lineno, col, tok, newtok = sys.argv[1:7]
16+
lineno, col = int(lineno), int(col)
17+
p = f"{repo}/{rel}"
18+
src = open(p, encoding="utf-8", newline="").read()
19+
lines = src.split("\n")
20+
line = lines[lineno - 1]
21+
assert line[col:col + len(tok)] == tok, \
22+
f"PRE-INJECTION MISMATCH {rel}:{lineno} col {col}: {line!r}"
23+
lines[lineno - 1] = line[:col] + newtok + line[col + len(tok):]
24+
open(p, "w", encoding="utf-8", newline="").write("\n".join(lines))
25+
print(f"injected {rel}:{lineno}: {lines[lineno-1].strip()[:78]}")
26+
PYEOF
27+
[ $? -ne 0 ] && { echo "INJECTION FAILED $name/$rel — aborting"; exit 1; }
28+
git commit -aqm "v6 replay2: $rel:$lineno $tok->$newtok"
29+
local T0=$(date +%s)
30+
"$FX" guard . --commit --python "$py" --escalate-budget "$budget"
31+
local rc=$?
32+
echo "REPLAY2[$name/$rel:$lineno budget=$budget] exit=$rc in $(($(date +%s)-T0))s"
33+
echo " final line: $(sed -n "${lineno}p" "$rel")"
34+
echo " baseline : $(git show "$base:$rel" | sed -n "${lineno}p")"
35+
git reset -q --hard "$base" && git clean -fdq
36+
echo "============================================="
37+
}
38+
39+
replay click 36baa15 src/click/termui.py 744 23 '033' '034' 600 # padding fix: expect EXACT
40+
replay click 36baa15 src/click/utils.py 70 25 '1' '2' 1800 # was: bounded refusal at 600s
41+
replay arrow 2224255 arrow/locales.py 5468 13 '>' '>=' 1800 # was: bounded refusal at 600s
42+
echo V6_REPLAYS2_DONE

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "fluidfix"
7-
version = "0.5.0"
7+
version = "0.6.0"
88
description = "Zero-token repair decisions for mechanical single-line bugs: a machine-authored routing kernel decides, your test suite judges, and an LLM is only ever the eyes."
99
readme = "README.md"
1010
requires-python = ">=3.10"

‎src/fluidfix/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from .oracle import Oracle
2222
from .router import pack, route, route_packed
2323

24-
__version__ = "0.5.0"
24+
__version__ = "0.6.0"
2525
__all__ = [
2626
"route", "route_packed", "pack",
2727
"EMIT", "ADVANCE", "HALT", "mask_of", "kind_of",

‎src/fluidfix/acts.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,15 @@ def _flip_strictness(line: str, obs: Observation) -> list:
9393

9494

9595
def _dec_at(line: str, m) -> str:
96-
new_lit = str(int(m.group()) - 1)
96+
lit = m.group()
97+
val = int(lit) - 1
98+
new_lit = str(val)
99+
# A zero-padded literal keeps its width ("034" -> "033", not "33"):
100+
# inside string escapes the padding is meaning, and byte-exact
101+
# restoration is the product's whole claim (measured: click termui
102+
# \033 -> \034 replay shipped "\33" without this).
103+
if val >= 0 and len(lit) > 1 and lit.startswith("0"):
104+
new_lit = new_lit.zfill(len(lit))
97105
out = line[:m.start()] + new_lit + line[m.end():]
98106
# Simplify `x + 1` -> decrement -> `x + 0` -> `x`, but ONLY at the
99107
# decrement site, and only when the zero stands alone: a global

‎src/fluidfix/cli.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def cmd_guard(args) -> int:
7575
observer = _observer(args)
7676
while True:
7777
report = guard_once(oracle, observer, coverage_target=args.cov,
78-
candidate_timeout=args.candidate_timeout)
78+
candidate_timeout=args.candidate_timeout,
79+
escalate_budget=args.escalate_budget)
7980
print(f"[{_time.strftime('%H:%M:%S')}] {report.summary()}")
8081
if report.status == "repaired" and args.commit:
8182
outcome = commit_repair(oracle.root, report)
@@ -254,6 +255,8 @@ def common(sp, need_file=True):
254255
sp.add_argument("--model", default="claude-opus-5")
255256
sp.add_argument("--candidate-timeout", type=int, default=None,
256257
help="per-candidate suite budget (default: --suite-timeout)")
258+
sp.add_argument("--escalate-budget", type=int, default=600,
259+
help="wall-clock cap for law-driven escalation rounds (s)")
257260
sp.add_argument("--interval", type=int, default=None,
258261
help="seconds between checks; omit for one pass (CI mode)")
259262
sp.add_argument("--commit", action="store_true",

0 commit comments

Comments
 (0)