Skip to content

[AUTOMATED] fix(p3): (NOVEL) restore the stubbed RuleSubRight truncation lowering - #251

Merged
mahaloz merged 1 commit into
mainfrom
fix/decbench-subright
Aug 3, 2026
Merged

mahaloz merged 1 commit into
mainfrom
fix/decbench-subright

Conversation

@mahaloz

@mahaloz mahaloz commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Rebased onto main @d89a4d95. #248 (cortexmvectors) and #249 (funcptralign) both
change ARM output, so the breadth numbers below were re-measured from scratch against
that base with a fresh stubbed/ported build pair, and the ablation was re-run. #250
(paramcopyhoist) landed after that; it is a default-OFF P6 pass and the interaction check
below shows it does not touch this rewrite. The witness output and both stage tests were
re-verified on the final base.

The bug

RuleSubRight::apply_op (p3_dataflow/ruleaction_6.rs, upstream ruleaction.cc:7271) was
a port stub. Only the leading doesSpecialPrinting / isPieceStructured half was
transcribed; the body then read

        // Remainder transcribed for the next wave; unreachable at this merge base:
        //   PcodeOp *lone = outvn->loneDescend();  ... lump a lone right-shift ...
        // W6
        0

so upstream's sub(V,c) => sub(V>>c*8,0) rewrite never ran and every SUBPIECE with a
nonzero byte offset reached the printer
, which renders one as the raw p-code operator.
SUB41 / SUB81 / SUB84 are undeclared identifiers — kuna emits no header that
defines them — so those function bodies were not compilable C.

openssh ssh (O2-noinline, stripped) sshbuf_put_u64 @ 0x4cd60, --mode reliable:

/* before */                              /* after */
unsigned long sub_4cd60(unsigned long a0,unsigned long a1) // early-return
{                                         {
  ...                                       ...
  *v2 = SUB81(a1,7);                        *v2 = (char)((uint8)a1 >> 0x38);
  v2[1] = SUB81(a1,6);                      v2[1] = (char)((uint8)a1 >> 0x30);
  v2[2] = SUB81(a1,5);                      v2[2] = (char)((uint8)a1 >> 0x28);
  v2[3] = SUB81(a1,4);                      v2[3] = (char)((uint8)a1 >> 0x20);
  v2[4] = SUB81(a1,3);                      v2[4] = (char)((uint8)a1 >> 0x18);
  v2[5] = SUB81(a1,2);                      v2[5] = (char)((uint8)a1 >> 0x10);
  v2[6] = SUB81(a1,1);                      v2[6] = (char)((uint8)a1 >> 8);
  v2[7] = (char)a1;                         v2[7] = (char)a1;
  return 0;                                 return 0;
}                                         }

Upstream Ghidra on the same function emits *local_18 = (char)((ulong)param_2 >> 0x38);,
and the source (sshbuf-getput-basic.i) is a plain shift:
((u_char *)(p))[0] = (__v >> 56) & 0xff;. The last line of kuna's own before pane is
the proof that the printer was never at fault — the offset-0 SUBPIECE already rendered
(char)a1.

The fix

The ~45-line tail is now transcribed from ruleaction.cc:7291-7340
(GHIDRA_REV=cef869af), with every guard upstream applies, because each one protects a
rendering kuna already gets right:

  • c == 0 — already least-significant; it prints as a cast.
  • output and input both address-tied with overlap == c — the SUBPIECE is the storage
    marker ActionCopyMarker converts; rewriting it would turn stack-piece writes back into
    shift chains.
  • the isPieceStructured special-print branch (already ported) still runs first, so
    struct/union/array field extraction is untouched.

Then the rewrite: lump a lone INT_RIGHT/INT_SRIGHT descendant with a constant shift when
outvn->getSize() + c == a->getSize() (declining an INT_RIGHT whose combined amount would
evaluate to zero, clamping INT_SRIGHT to the sign bit), synthesize the shift ahead of the
SUBPIECE typed TYPE_UINT/TYPE_INT at the input width, and zero the SUBPIECE's offset.

Nothing needed wiring: the rule was already registered in upstream's own schedule position
(rrow!("subright", "cleanup", ...), infra/universalaction.rs:552).

One kuna-side deviation, marked // (kuna): the type-factory availability check is hoisted
above the first mutation, so a hand-built Funcdata with no type factory (the rule-level
unit-test fixtures) cannot leave a half-applied transform behind. On a real architecture the
factory is always present.

No option — and why

CLAUDE.md gates features ("behavior that is a judgment call, not universally better") and
exempts "a strict bug fix that only corrects wrong output". This is the exempt case:

  1. The old output is not C. There is no honest use_when prose for a subright option —
    nobody wants the non-compiling spelling.
  2. It restores upstream, it does not diverge from it. This is finishing a port; the
    output shape is byte-identical to Ghidra's on the witness.
  3. The ablation is silent — 0 of 675 vendored-from-upstream datatest assertions move,
    exactly what "restoring upstream behavior" predicts.
  4. The switch already exists. subright is a registered rule-group name, so
    option togglerule subright off already gives a bisector the pre-fix rendering. A new
    settableTable row would add catalog-count churn and a knob nobody should flip.

An independent decider subagent was asked to make this call from the repo's own rules and
precedent and returned ungated; its verdict is recorded verbatim in
docs/features/subright/record.json. Precedent is unanimous for this shape — #226 (DIV-46),
#232 (DIV-48), #235 (DIV-49), #238 (DIV-50), #242 (DIV-52) are all fix(pN): corrections
that change emitted C with no settable option.

Recorded in docs/history.md under Convergences, not as a DIV row — the registry's own
rule is that "a port defect whose fix moves kuna back onto upstream's default earns no DIV
row, but a corpus-wide output shift still needs a record for anyone bisecting."

Breadth

Triage's corpus-wide count (matched per-function comparison over 788 binaries / 76,046
functions both tools recovered): nonzero-offset SUBPIECE kuna 5,919 in 2,394 functions
(3.1%) vs ghidra 18 in 13 (0.017%) vs ida 0
— a 329x ratio.

Measured directly for this PR, two release builds of this worktree (stubbed vs ported),
7 whole-binary decompile-all --mode reliable runs, x86-64 -O0/-O2 and ARM Cortex-M.
All totals are over the function set common to both panes, so the 120 s per-function
watchdog cannot move them on this (loaded) box:

binary raw SUBnn (offset != 0) functions carrying one functions whose text changed
O2 openssh ssh 69 → 0 29 → 0 29 / 1,853 (1.57%)
O2 iproute2 ip 80 → 43 34 → 3 32 / 1,912 (1.67%)
O2 e2fsprogs e2fsck 48 → 2 38 → 2 37 / 1,909 (1.94%)
O0 gzip 22 → 0 6 → 0 6 / 262 (2.29%)
O2 bzip2 13 → 0 9 → 0 10 / 153 (6.54%)
O2 betaflight STM32F405 (ARM) 1,068 → 31 409 → 10 407 / 5,795 (7.02%)
O2 cleanflight DALRCF405 (ARM) 612 → 19 208 → 5 207 / 2,836 (7.30%)
total 1,912 → 95 (95.0% removed) 733 → 20 728 / 14,720 (4.95%)

Emitted lines over the same set: 443,737 → 443,785 (+0.011%).

Every one of the 95 residuals is a case upstream's own guards decline — 42 address-tied
global-array stores (s_92e50[7] = SUB81(s_92e50[0],7);, round 1's separately-filed
rodata-phantom-store), 47 address-tied local partial-symbol writes (v19 = SUB42(v14,2);,
the P6 thread that renders sym._2_2_ upstream), and 6 piece-structured field extractions on
the special-print branch. subright owns 1,817 of the 1,912.

Measured cost: exactly two functions in 14,720 gain a dead partial-register shift
statement — v5 = (undefined7)((uint8)a2 >> 8); in bzip2 sub_da00 and one
(undefined3)((uint4)v11 >> 8) on ARM. That is the SUB87/SUB43 partial-register form,
which upstream lowers the same way. Corpus-wide count of that shape: 0 → 2.

Test

tests/stages/ghdec-subright.xml, two-pass over a real binary -> decompile path, on a
44-byte i386 bytechunk built from

void put_u32_be(u8 *p, u32 v) { p[0] = (v >> 24) & 0xff; ... }   /* the plain rewrite */
u32  mulhi_shift(u32 a, u32 b) { return (u32)(((u64)a * b) >> 32) >> 3; }  /* the lumping */

put_u32_be covers the plain rewrite and the c == 0 bail; mulhi_shift covers the
lone-descendant lumping — the mull high half is SUBPIECE(prod,4) read only by a constant
INT_RIGHT, folded into one shift by 32+3 == 0x23 — and uses a variable multiplier so
RuleDivOpt declines and the truncation actually reaches the printer. Pass 1 is the default
(the fix); pass 2 sets option togglerule subright off and pins the pre-fix rendering.

1 of 8 assertions passes pre-fix, 8/8 post-fix.

Two new rule-level unit tests pin the guards that must not be dropped
(sub_right_least_significant_bails, sub_right_addr_tied_marker_bails).

Benchmark

Both cluster cases that are in the mined pool, rescored against the current build:

case GED before after delta
O2-noinline-iproute2-ip-netns_add 8.0 8.0 0.0
O2-noinline-betaflight-betaflight_STM32F405-applyLedFixedLayers 25.0 25.0 0.0

GED-neutral by construction, and exactly as the triage predicted: the rewrite changes
expressions inside basic blocks and moves no block, so the graph-edit-distance metric cannot
see it. This case is ranked by correctness (undeclared identifier → valid C), not by GED.

Speed

Interleaved A/B on the two builds, medians (interleaved because this box runs sibling agents
and a decbench sweep, so a blocked measurement would fold load drift into the delta):

target before after delta
openssh ssh @0x4cd60 (the witness) 2,307.2 ms 2,165.0 ms -6.16% (9 pairs)
gzip -O0 decompile-all 3,387.2 ms 3,325.0 ms -1.84% (7 pairs)
bzip2 -O2 decompile-all 12,016.1 ms 11,511.8 ms -4.20% (7 pairs)
e2fsprogs e2fsck -O2 decompile-all 21,378.4 ms 21,430.2 ms +0.24% (5 pairs)

Worst case +0.24%, inside the +5% budget; three of four arms are faster (one op more in
the cleanup pool, but a normalized shift that the downstream pools fold instead of carrying).

Gates

All re-run on the rebased base (main @d89a4d95):

make test        675/675 assertions passed -- PARITY OK   (docs/baseline.json NOT re-pinned)
make test-stages 369/369 assertions passed -- PARITY OK   (baseline re-recorded: purely additive,
                                                           361 -> 369 keys, no existing assertion moved)
make rust-test   green -- 4424 passed; 0 failed; 37 ignored (cargo exit 0)
make check-spec  check-spec OK (lenient mode) / check-spec OK (strict mode)
kuna catalog --check   catalog OK: documents exactly the registered kuna options

Corpus file count in decompiler/crates/kuna-base/src/xml.rs: 186 -> 187 (base + #249's
ghdec-funcptralign + #250's ghdec-paramcopyhoist + this PR's ghdec-subright; 83 datatests

  • 104 stages).

No catalog surface is touched — the diff against main for phases.toml,
src/p0_knowledge/, decompiler/crates/kuna-decomp/tests/ and docs/options.md is empty, and
the settable-row count stays at #250's 85.

Interaction with #250

ActionParamCopyHoist is a default-OFF P6 pass; this is a P3 cleanup rule. Confirmed rather
than assumed — whole-binary decompile-all --mode reliable with --option paramcopyhoist on
vs default gives identical results on openssh ssh, gzip -O0 and bzip2 -O2: residual raw
operators 0/0 in each, subright output shapes 23→23, 12→12, 1→1, and the witness function at
0x4cd60 byte-identical either way. Both stage tests pass explicitly
(ghdec-paramcopyhoist 3/3, ghdec-subright 8/8).

Bundle: docs/features/subright/ (analysis.md, plan.md, record.json).
Spec prose: docs/spec/03-ssa-and-simplification.md.

🤖 Generated with Claude Code

…ion lowering

`RuleSubRight::apply_op` (`p3_dataflow/ruleaction_6.rs`, upstream
`ruleaction.cc:7271`) was a port stub: only the leading `doesSpecialPrinting` /
`isPieceStructured` half was transcribed and the body then returned 0 under a
`// Remainder transcribed for the next wave ... W6` comment, so upstream's
`sub(V,c) => sub(V>>c*8,0)` rewrite never ran.  Every SUBPIECE with a NONZERO
byte offset therefore reached the printer, which renders one as the raw p-code
operator.  `SUB41` / `SUB81` / `SUB84` are undeclared identifiers -- kuna emits
no header defining them -- so those function bodies were not compilable C:

    unsigned long sub_4cd60(unsigned long a0,unsigned long a1)  // openssh ssh
    {                                                           // sshbuf_put_u64
      ...
      *v2 = SUB81(a1,7);          ->   *v2 = (char)((uint8)a1 >> 0x38);
      v2[1] = SUB81(a1,6);        ->   v2[1] = (char)((uint8)a1 >> 0x30);
      ...
      v2[7] = (char)a1;                v2[7] = (char)a1;

Ghidra emits `*local_18 = (char)((ulong)param_2 >> 0x38);` and the source is a
plain shift (`((u_char *)(p))[0] = (__v >> 56) & 0xff;`).  The last line of
kuna's own pre-fix pane is the proof the printer was never at fault: the
offset-0 SUBPIECE already rendered `(char)a1`.

The ~45-line tail is now transcribed from `ruleaction.cc:7291-7340`
(GHIDRA_REV=cef869af) with every guard upstream applies, because each one
protects a rendering kuna already gets right: the `c == 0` bail; the
address-tied `overlap == c` bail that leaves ActionCopyMarker's storage markers
alone; and the already-ported `isPieceStructured` special-print branch.  Then
the rewrite proper, including the lone-`INT_RIGHT`/`INT_SRIGHT`-descendant
lumping (declining an `INT_RIGHT` whose combined amount would evaluate to zero,
clamping `INT_SRIGHT` to the sign bit).  Nothing needed wiring: the rule was
already registered in upstream's own schedule position
(`rrow!("subright", "cleanup", ...)`, `infra/universalaction.rs:552`).

One kuna-side deviation, marked `// (kuna)`: the type-factory availability check
is hoisted above the first mutation, so a hand-built Funcdata with no type
factory cannot leave a half-applied transform behind.

No option.  `SUBnn` is an undeclared identifier, so this is a strict correctness
fix, and it restores upstream Ghidra's own behavior from a port stub rather than
making a judgment call -- there is no honest `use_when` prose for a `subright`
option.  The switch already exists anyway: `subright` is a registered rule-group
name, so `option togglerule subright off` reproduces the pre-fix rendering for
bisection.  An independent decider subagent returned `ungated`; its verdict is
recorded verbatim in `docs/features/subright/record.json`.  Recorded in
docs/history.md under Convergences, not as a DIV row -- a port defect whose fix
moves kuna back onto upstream's default earns no DIV row.

Breadth (two release builds of this worktree, stubbed vs ported, 7 whole-binary
`decompile-all --mode reliable` runs over x86-64 -O0/-O2 and ARM Cortex-M;
totals over the 14,720 functions common to both panes, so the 120 s
per-function watchdog cannot move them on a loaded box): nonzero-offset raw
`SUBnn` operators 1,912 -> 95 (95.0%), functions carrying one 733 -> 20, blast
radius 728 functions (4.95%), emitted lines +0.011%.  Every one of the 95
residuals is a case upstream's own guards decline: 42 address-tied global-array
stores (round 1's separately-filed `rodata-phantom-store`), 47 address-tied
local partial-symbol writes (the P6 thread that renders `sym._2_2_` upstream),
6 piece-structured field extractions.  Measured cost: exactly two functions in
14,720 gain a dead partial-register shift statement
(`(undefined7)((uint8)a2 >> 8)` in bzip2 sub_da00 and one
`(undefined3)((uint4)v11 >> 8)` on ARM) -- the form upstream lowers the same
way; corpus-wide count of that shape 0 -> 2.

GED unchanged by construction on both mined cluster cases (netns_add 8.0 -> 8.0,
applyLedFixedLayers 25.0 -> 25.0): the rewrite changes expressions inside blocks
and moves no block.  Rank this by correctness, not by the metric.

Speed (interleaved medians, `decompile-all --mode reliable`): openssh ssh
@0x4cd60 2,307 -> 2,165 ms (-6.16%, 9 pairs), gzip -O0 3,387 -> 3,325 ms
(-1.84%, 7), bzip2 -O2 12,016 -> 11,512 ms (-4.20%, 7), e2fsck -O2 21,378 ->
21,430 ms (+0.24%, 5) -- worst case +0.24%, inside the +5% budget.

Gates (on main @d89a4d95): make test 675/675 PARITY OK (docs/baseline.json NOT
re-pinned); make test-stages 369/369 PARITY OK (baseline re-recorded, purely
additive 361 -> 369 keys, no existing assertion moved); make rust-test green;
make check-spec OK (lenient + strict); kuna catalog --check OK.  No catalog
surface is touched -- the diff vs main for phases.toml, src/p0_knowledge/,
kuna-decomp/tests/ and docs/options.md is empty, and the settable-row count
stays at #250's 85.  Corpus file count 186 -> 187.

#250's ActionParamCopyHoist is a default-OFF P6 pass and this is a P3 cleanup
rule; confirmed rather than assumed, `decompile-all --mode reliable` with
`--option paramcopyhoist on` vs default is identical on openssh ssh, gzip -O0
and bzip2 -O2 (residual raw operators 0/0 each, subright output shapes 23->23,
12->12, 1->1) and the witness at 0x4cd60 is byte-identical either way.  `tests/stages/ghdec-subright.xml` is two-pass
(1 of 8 assertions passes pre-fix, 8/8 post-fix) plus two new rule-level unit
tests pinning the guards that must not be dropped.

Provenance: decbench round-2 triage, case `novel-concat-subpiece-soup`, NOVEL
pool (the CONCAT half of that cluster is disproven as a kuna defect and is not
touched here).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
@mahaloz
mahaloz force-pushed the fix/decbench-subright branch from 279b922 to a8af59c Compare August 3, 2026 08:31
@mahaloz
mahaloz merged commit d1cf125 into main Aug 3, 2026
9 checks passed
@mahaloz
mahaloz deleted the fix/decbench-subright branch August 3, 2026 08:40
mahaloz added a commit that referenced this pull request Aug 3, 2026
…cost this round

Docs-only. No .rs, no phases.toml, no baselines, no tests.

Round 2 shipped, and the benchmark signal was refreshed on 2026-08-03 (all three
opt levels re-decompiled from pinned kuna 9623dc2). Several documented claims
were provably stale and several hard-won operational facts existed only in agent
transcripts. Both fixed, every number re-verified against the live tree.

docs/decbench-loop.md
- Standings replaced and widened: GED ida 36.06 / kuna 35.93 / angr 34.20,
  overall ida 38.01 / kuna 37.91 / angr 36.98, byte_match kuna 3.41 (first).
  Stated plainly that kuna's column is current while the rivals' are from their
  own last runs, so the tree is a MINING INSTRUMENT, not a leaderboard.
- Recall pool: 6,540 (7.3%) -> 1,420 vs angr / 1,552 vs ida, 0 whole-binary
  failures, now almost entirely embedded ARM Cortex-M. All three named causes
  corrected: "u-boot 100% / freertos 100%" was a decbench .text-filter artifact
  and never a kuna discovery failure (angr and ida score nothing there);
  "betaflight 22%" is 6.0%; the coreutils `main` empty-body/panic is fixed
  (comm/join/timeout/uniq all produce full bodies today).
- The `--mode auto` degrades-to-fast warning is moot for this corpus: the
  largest stripped binary is O0 bash at 1,513,904 B (1.44 MiB), so all 803
  binaries resolve 768 aggressive / 35 reliable / 0 fast. The aggressive-vs-
  reliable distinction is kept and sharpened; the stale 21-of-24 default-off
  count is now 20 of 25, with the five exclusions named.
- Two operational traps recorded for the first time:
  (a) byte_match RECOMPILES with an arch-matched toolchain and this box has
      neither arm-none-eabi-gcc nor MinGW, so deleting kuna's (never
      auto-invalidated) checkpoints destroys kuna's ARM/PE scores while every
      rival keeps theirs. The coverage guard caught 34 slices; O2 and
      O2-noinline are still damaged from an earlier DECBENCH_ALLOW_DROPS=1 run
      with no surviving copy. Rule: never pass DECBENCH_ALLOW_DROPS=1 without
      reading every [guard] line.
  (b) The pools store a PE address as an RVA where kuna uses the VA, so
      scripts.decbench.rescore fails on every PE case (119 across the three
      pools). Recorded with a fix direction.
- Pointed at the durable refresh recipe at ~/decbench-campaign-state/ and its
  two pinning rules, plus the non-obvious one: the GED baseline must drop kuna's
  published scores for EVERY re-decompiled opt level, not just the one being
  refreshed (an O0-only baseline died with "cannot reproduce published fallback
  58.0" on an O2 slice).

Method corrections (decbench-loop.md + improvement-pipeline.md standing rules)
- "Not a no-op" is not "correct". On paramcopyhoist a refuter proved the
  proposed hook reached the printer and it was still the wrong site: it deleted
  an assignment, lost an early return, and made another function return the
  wrong parameter. The refute brief now carries an explicit "would this produce
  WRONG output?" axis.
- Diff every changed function, not the witness. Those designs all passed on
  their witness. Round 2's PRs swept 3,031 / 12,241 / 14,720 / 15,386 functions;
  two caught real problems that way.
- The tally, honestly: round 1's filed mechanisms were 2-for-5, round 2's
  refuters overturned the filed diagnosis on 3 of 8, and the symptom stood in
  every case.

docs/decbench/features.md
- Round-1 menu replaced by round-2 outcomes, keeping the file's shape and its
  rank-by-correctness thesis: #248 cortexmvectors, #249 funcptralign,
  #250 paramcopyhoist, #251 subright, #252 returncopysplit, #253 itecondlist
  (merged) and #254 peimportcall (IN FLIGHT), each with its measured effect.
- Named the structural finding that outlives them: three separate ported passes
  were dead -- RuleSubRight (stub body), RuleFuncPtrEncoding (live body, stubbed
  input) and ActionDeindirect (live body, a gate bit set nowhere). Each was
  invisible to every test and each had large breadth, so "grep for
  registered-but-unreachable passes" is now a mining route of its own.
- Carried forward what did not ship: undefname-leak (283 functions, 221 with
  uninitialised reads) and catalog-upstream-options (38 upstream-inherited
  ArchOptions invisible to `kuna catalog`).

Re-mined pool tables regenerated against the refreshed tree (snapshot
2026-08-03): backlog.md, backlog-ida.md, novel.md, triage-queue*.json.

Gates: make check-spec OK (lenient and strict); make test 675/675 PARITY OK;
make test-stages 381/381 PARITY OK.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
mahaloz added a commit that referenced this pull request Aug 3, 2026
…cost this round

Docs-only. No .rs, no phases.toml, no baselines, no tests.
Rebased onto origin/main 4c2b59b (after #254, #255 and #257).

Round 2 shipped, and the benchmark signal was refreshed on 2026-08-03 (all three
opt levels re-decompiled from pinned kuna 9623dc2). Several documented claims
were provably stale and several hard-won operational facts existed only in agent
transcripts. Both fixed, every number re-verified against the live tree.

docs/decbench-loop.md
- Standings replaced and widened: GED ida 36.06 / kuna 35.93 / angr 34.20,
  overall ida 38.01 / kuna 37.91 / angr 36.98, byte_match kuna 3.41 (first).
  Stated plainly that kuna's column is current while the rivals' are from their
  own last runs, so the tree is a MINING INSTRUMENT, not a leaderboard.
- Recall pool: 6,540 (7.3%) -> 1,420 vs angr / 1,552 vs ida, 0 whole-binary
  failures, now almost entirely embedded ARM Cortex-M. All three named causes
  corrected: "u-boot 100% / freertos 100%" was a decbench .text-filter artifact
  and never a kuna discovery failure (angr and ida score nothing there);
  "betaflight 22%" is 6.0%; the coreutils `main` empty-body/panic is fixed
  (comm/join/timeout/uniq all produce full bodies today).
- The `--mode auto` degrades-to-fast warning is moot for this corpus: the
  largest stripped binary is O0 bash at 1,513,904 B (1.44 MiB), so all 803
  binaries resolve 768 aggressive / 35 reliable / 0 fast. The aggressive-vs-
  reliable distinction is kept and sharpened; the stale 21-of-24 default-off
  count is now 20 of 25, with the five exclusions named.
- Two operational traps recorded for the first time:
  (a) byte_match RECOMPILES with an arch-matched toolchain and this box has
      neither arm-none-eabi-gcc nor MinGW, so deleting kuna's (never
      auto-invalidated) checkpoints destroys kuna's ARM/PE scores while every
      rival keeps theirs. The coverage guard caught 34 slices; O2 and
      O2-noinline are still damaged from an earlier DECBENCH_ALLOW_DROPS=1 run
      with no surviving copy. Rule: never pass DECBENCH_ALLOW_DROPS=1 without
      reading every [guard] line.
  (b) The pools store a PE address as an RVA where kuna uses the VA, so
      scripts.decbench.rescore fails on every PE case (119 across the three
      pools). Recorded with a fix direction.
- Pointed at the durable refresh recipe at ~/decbench-campaign-state/ and its
  two pinning rules, plus the non-obvious one: the GED baseline must drop kuna's
  published scores for EVERY re-decompiled opt level, not just the one being
  refreshed (an O0-only baseline died with "cannot reproduce published fallback
  58.0" on an O2 slice).

Method corrections (decbench-loop.md + improvement-pipeline.md standing rules)
- "Not a no-op" is not "correct". On paramcopyhoist a refuter proved the
  proposed hook reached the printer and it was still the wrong site: it deleted
  an assignment, lost an early return, and made another function return the
  wrong parameter. The refute brief now carries an explicit "would this produce
  WRONG output?" axis.
- Diff every changed function, not the witness. Those designs all passed on
  their witness. Round 2's PRs swept 3,031 / 12,241 / 14,720 / 15,386 functions;
  two caught real problems that way.
- The tally, honestly: round 1's filed mechanisms were 2-for-5, round 2's
  refuters overturned the filed diagnosis on 3 of 8, and the symptom stood in
  every case.

Shared counters in a busy queue (decbench-loop.md + improvement-pipeline.md)
- Round 2 ran up to four output-changing PRs over the same hard-coded counters
  and produced three failure shapes, only one of which announced itself: a
  conflict (#257's DIV number raced 55 -> 56 -> 57 -> 58); a SILENT
  identical-edit auto-merge (catalog_bytecompat.rs kept 86 because both sides
  made the same 85 -> 86 edit); and a SILENT keep-both auto-merge (a stale
  baseline-stages.json data_footer, and five rounds of keep-both duplicating a
  row in tests/stages/README.md).
- Rules written down: derive every shared counter from a fresh capture and a
  green run on the rebased tree, never by arithmetic; diff every keep-both
  resolution against main asserting you removed nothing and added nothing twice;
  DIV numbers are claimed on merge; re-run the gates AFTER the rebase.
- New standing requirement 9: re-measure after every rebase, never carry a
  number forward. #257's placeholder count moved 2,143 -> 2,142 because #254
  landed underneath it, caught only by re-measuring.

docs/decbench/features.md
- Round-1 menu replaced by round-2 outcomes, keeping the file's shape and its
  rank-by-correctness thesis. NINE merged PRs: #248 cortexmvectors,
  #249 funcptralign, #250 paramcopyhoist, #251 subright, #252 returncopysplit,
  #253 itecondlist, #254 peimportcall (DIV-57), #255 ptrentry and #257 undefname
  (DIV-58) -- seven of the eight round-2 candidates plus steps 1 and 2 of the
  ARM entry-recall sequence (#239). Only three of the nine move GED on a mined
  case; four are correctness fixes the metric cannot see and two are recall.
- The dead-pass finding is now three DISTINCT shapes to grep for, not one
  anecdote: stub body (RuleSubRight), live body with a permanently-zero input
  (RuleFuncPtrEncoding's hard-coded funcptr_align() = 0), and live body with a
  gate bit that has no writer anywhere (ActionDeindirect / externref). The third
  had a second gap in the same chain -- GlobalEntry::func_no_return never copied
  the callee's no-return flag into the snapshot -- so one dead gate can hide
  another.
- The ARM sequence is cross-referenced to the live table on PR #239 rather than
  duplicated here, so it cannot go stale in-repo.
- Carried forward as the one still-open candidate: catalog-upstream-options
  (38 upstream-inherited ArchOptions invisible to `kuna catalog`).

Re-mined pool tables regenerated against the refreshed tree (snapshot
2026-08-03): backlog.md, backlog-ida.md, novel.md, triage-queue*.json.

Gates on the rebased base: make check-spec OK (lenient and strict);
make test 675/675 PARITY OK; make test-stages 394/394 PARITY OK.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL
mahaloz added a commit that referenced this pull request Aug 3, 2026
…cost this round (#256)

Docs-only. No .rs, no phases.toml, no baselines, no tests.
Rebased onto origin/main 4c2b59b (after #254, #255 and #257).

Round 2 shipped, and the benchmark signal was refreshed on 2026-08-03 (all three
opt levels re-decompiled from pinned kuna 9623dc2). Several documented claims
were provably stale and several hard-won operational facts existed only in agent
transcripts. Both fixed, every number re-verified against the live tree.

docs/decbench-loop.md
- Standings replaced and widened: GED ida 36.06 / kuna 35.93 / angr 34.20,
  overall ida 38.01 / kuna 37.91 / angr 36.98, byte_match kuna 3.41 (first).
  Stated plainly that kuna's column is current while the rivals' are from their
  own last runs, so the tree is a MINING INSTRUMENT, not a leaderboard.
- Recall pool: 6,540 (7.3%) -> 1,420 vs angr / 1,552 vs ida, 0 whole-binary
  failures, now almost entirely embedded ARM Cortex-M. All three named causes
  corrected: "u-boot 100% / freertos 100%" was a decbench .text-filter artifact
  and never a kuna discovery failure (angr and ida score nothing there);
  "betaflight 22%" is 6.0%; the coreutils `main` empty-body/panic is fixed
  (comm/join/timeout/uniq all produce full bodies today).
- The `--mode auto` degrades-to-fast warning is moot for this corpus: the
  largest stripped binary is O0 bash at 1,513,904 B (1.44 MiB), so all 803
  binaries resolve 768 aggressive / 35 reliable / 0 fast. The aggressive-vs-
  reliable distinction is kept and sharpened; the stale 21-of-24 default-off
  count is now 20 of 25, with the five exclusions named.
- Two operational traps recorded for the first time:
  (a) byte_match RECOMPILES with an arch-matched toolchain and this box has
      neither arm-none-eabi-gcc nor MinGW, so deleting kuna's (never
      auto-invalidated) checkpoints destroys kuna's ARM/PE scores while every
      rival keeps theirs. The coverage guard caught 34 slices; O2 and
      O2-noinline are still damaged from an earlier DECBENCH_ALLOW_DROPS=1 run
      with no surviving copy. Rule: never pass DECBENCH_ALLOW_DROPS=1 without
      reading every [guard] line.
  (b) The pools store a PE address as an RVA where kuna uses the VA, so
      scripts.decbench.rescore fails on every PE case (119 across the three
      pools). Recorded with a fix direction.
- Pointed at the durable refresh recipe at ~/decbench-campaign-state/ and its
  two pinning rules, plus the non-obvious one: the GED baseline must drop kuna's
  published scores for EVERY re-decompiled opt level, not just the one being
  refreshed (an O0-only baseline died with "cannot reproduce published fallback
  58.0" on an O2 slice).

Method corrections (decbench-loop.md + improvement-pipeline.md standing rules)
- "Not a no-op" is not "correct". On paramcopyhoist a refuter proved the
  proposed hook reached the printer and it was still the wrong site: it deleted
  an assignment, lost an early return, and made another function return the
  wrong parameter. The refute brief now carries an explicit "would this produce
  WRONG output?" axis.
- Diff every changed function, not the witness. Those designs all passed on
  their witness. Round 2's PRs swept 3,031 / 12,241 / 14,720 / 15,386 functions;
  two caught real problems that way.
- The tally, honestly: round 1's filed mechanisms were 2-for-5, round 2's
  refuters overturned the filed diagnosis on 3 of 8, and the symptom stood in
  every case.

Shared counters in a busy queue (decbench-loop.md + improvement-pipeline.md)
- Round 2 ran up to four output-changing PRs over the same hard-coded counters
  and produced three failure shapes, only one of which announced itself: a
  conflict (#257's DIV number raced 55 -> 56 -> 57 -> 58); a SILENT
  identical-edit auto-merge (catalog_bytecompat.rs kept 86 because both sides
  made the same 85 -> 86 edit); and a SILENT keep-both auto-merge (a stale
  baseline-stages.json data_footer, and five rounds of keep-both duplicating a
  row in tests/stages/README.md).
- Rules written down: derive every shared counter from a fresh capture and a
  green run on the rebased tree, never by arithmetic; diff every keep-both
  resolution against main asserting you removed nothing and added nothing twice;
  DIV numbers are claimed on merge; re-run the gates AFTER the rebase.
- New standing requirement 9: re-measure after every rebase, never carry a
  number forward. #257's placeholder count moved 2,143 -> 2,142 because #254
  landed underneath it, caught only by re-measuring.

docs/decbench/features.md
- Round-1 menu replaced by round-2 outcomes, keeping the file's shape and its
  rank-by-correctness thesis. NINE merged PRs: #248 cortexmvectors,
  #249 funcptralign, #250 paramcopyhoist, #251 subright, #252 returncopysplit,
  #253 itecondlist, #254 peimportcall (DIV-57), #255 ptrentry and #257 undefname
  (DIV-58) -- seven of the eight round-2 candidates plus steps 1 and 2 of the
  ARM entry-recall sequence (#239). Only three of the nine move GED on a mined
  case; four are correctness fixes the metric cannot see and two are recall.
- The dead-pass finding is now three DISTINCT shapes to grep for, not one
  anecdote: stub body (RuleSubRight), live body with a permanently-zero input
  (RuleFuncPtrEncoding's hard-coded funcptr_align() = 0), and live body with a
  gate bit that has no writer anywhere (ActionDeindirect / externref). The third
  had a second gap in the same chain -- GlobalEntry::func_no_return never copied
  the callee's no-return flag into the snapshot -- so one dead gate can hide
  another.
- The ARM sequence is cross-referenced to the live table on PR #239 rather than
  duplicated here, so it cannot go stale in-repo.
- Carried forward as the one still-open candidate: catalog-upstream-options
  (38 upstream-inherited ArchOptions invisible to `kuna catalog`).

Re-mined pool tables regenerated against the refreshed tree (snapshot
2026-08-03): backlog.md, backlog-ida.md, novel.md, triage-queue*.json.

Gates on the rebased base: make check-spec OK (lenient and strict);
make test 675/675 PARITY OK; make test-stages 394/394 PARITY OK.


Claude-Session: https://claude.ai/code/session_017dPFaKJanfLSf7mWGhkzkL

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant