Skip to content

ruff_r2il: slag_partition probe — two negatives, one against my own claim - #107

Merged
AdaWorldAPI merged 2 commits into
mainfrom
claude/c64-6502-falsifier-shztkk
Aug 25, 2026
Merged

AdaWorldAPI merged 2 commits into
mainfrom
claude/c64-6502-falsifier-shztkk

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

A probe, not a feature. It asks whether harvest_6502's 3,742 residual rows split into "opcode not yet classified" vs "data lifted as code" — and answers with a control group instead of a heuristic: Elite ships known-pure-data binaries (SHIPS/WORDS/LODATA/IANTOK/SPRITE) beside known-pure-code (LOCODE/HICODE), same build, identical treatment.

Negative 1 — the premise was false, and the probe is what showed it

I claimed the harvest had lifted Elite's ship blueprints and market tables as opcodes. It had not. Elite keeps data in a separate source file (elite-data.asm → SHIPS.bin et al); the harvest corpus gma4/5/6 = COMLOD/LOCODE/HICODE is code. Corroborated independently by the probe's own per-file numbers — both code files sit inside the CODE range on both metrics.

Some tables are embedded (QQ23, the market prices, lives in elite-source.asm), so contamination is non-zero. But it is not the bulk of the slag, and the reframing that said otherwise was wrong.

Negative 2 — content statistics do not partition

208 windows of 256 bytes (≥16 instructions each):

metric CODE p10/p50/p90 DATA p10/p50/p90 best balanced accuracy
decode error % 31.2 / 38.6 / 46.8 32.3 / 46.9 / 59.2 72.1% — no better than guessing
cf per 100 instr 5.3 / 10.6 / 17.5 6.5 / 26.6 / 45.9 77.0% — weak, not alone

Direction is counterintuitive and worth keeping: DATA shows higher control-flow density (p50 26.6 vs 10.6), because random bytes decode into branch opcodes.

A measurement correction inside the probe itself

The first version reported whole-file furnace stats and produced two exact duplicate pairs across unrelated files of different sizes (SPRITE==gma5, SHIPS==gma6). Cause: it handed every sweep block to one FunctionBehavior, and CFG::from_blocks keeps only the component reachable from blocks[0] — so those columns measured a tiny entry-reachable fragment, not the file. Removed rather than reported; the remaining metrics come straight off the sweep and need no SSA. Measurement moved to window granularity, which is also what the real use needs (mark regions within one image).

The untested hypothesis, named rather than implied

Reachability. Code is what a call graph reaches; data is what is only ever loaded from. That cannot be measured on standalone control files — they have no callers — and needs the mixed-image setting. It is the one hypothesis these results leave standing.

Gates: clippy --example slag_partition -- -D warnings clean, cargo fmt clean, probe runs end-to-end. Corpus read from a local sibling checkout, never redistributed; a missing file is a printed skip.


Generated by Claude Code

…my own claim

Built to test whether harvest_6502's 3742 residual rows split into
'opcode not yet classified' vs 'data lifted as code'. Uses a CONTROL
GROUP rather than a heuristic: Elite ships known-pure-data binaries
(SHIPS/WORDS/LODATA/IANTOK/SPRITE) beside known-pure-code (LOCODE/
HICODE), both from one build, both given identical treatment.

Negative 1 — the premise was false, and the probe is what showed it.
Elite keeps data in a SEPARATE source file (elite-data.asm -> SHIPS.bin
et al); the harvest corpus gma4/5/6 = COMLOD/LOCODE/HICODE is code. The
blueprints were never lifted as opcodes. Corroborated independently by
the probe's own per-file numbers: both code files sit inside the CODE
range on both metrics. Some tables ARE embedded (QQ23 market prices
lives in elite-source.asm), so contamination is non-zero, but it is not
the bulk of the slag. The reframing that claimed otherwise was wrong.

Negative 2 — content statistics do not partition. Over 208 windows of
256 bytes (>=16 instructions each): decode-error rate reaches 72.1%
balanced accuracy, control-flow density 77.0%. Neither is usable alone.
Direction is counterintuitive and worth keeping: DATA shows HIGHER
control-flow density (p50 26.6 vs 10.6) because random bytes decode into
branch opcodes.

Measured at WINDOW granularity after a correction. The first version
reported whole-file furnace stats and produced two exact duplicate pairs
across unrelated files of different sizes (SPRITE==gma5, SHIPS==gma6):
it handed every sweep block to ONE FunctionBehavior, and CFG::from_blocks
keeps only the component reachable from blocks[0], so those columns
measured a tiny entry-reachable fragment rather than the file. Removed
rather than reported. Remaining metrics come straight off the sweep and
need no SSA.

The untested hypothesis, named rather than implied: reachability. Code is
what a call graph reaches; data is what is only ever loaded FROM. That
cannot be measured on standalone control files (no callers) and needs the
mixed-image setting.
@coderabbitai

coderabbitai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 061325e3-43ae-485c-91ad-33a8a866a1de


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Aug 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_fa9ee2bc-85e0-4781-8849-74b438be9114)

Copy link
Copy Markdown
Owner Author

cargo test (windows-latest) is red, and it is not this PR's. Stating it once rather than leaving it silent.

What failed: the runner could not download the Swatinem/rust-cache action —

Failed to download action 'https://internal-api.service.iad.github.net/repos/Swatinem/rust-cache/zipball/6323deb1…'
Error: No such host is known. (internal-api.service.iad.github.net:443)
…back off 14.5s… back off 29.0s…
##[error]Failed to download archive … after 3 attempts.

That is a GitHub Actions DNS/infrastructure failure during action setup — it died before checkout finished and before any test body ran. No Rust code was compiled, so nothing in this diff could have influenced it.

Why it cannot be this PR's, independently of the log: the only code here is a new example in ruff_r2il, which is workspace-excluded (root Cargo.toml exclude = ["crates/ruff_r2il"]). cargo test over the ruff workspace never reaches it. The rest of the diff is harvest artifacts under .claude/.

Isolated: every other completed check on this head is green — 6 success, 12 still running, this one failure.

No fix ported, and none exists to port. The failure is in a workflow file this PR does not touch, and the only "fix" would be re-pinning or vendoring a third-party action in ruff's CI — out of scope, and it would widen a probe-only PR into a CI change.

I lack the means to re-run it: POST /actions/runs/32902939398/rerun-failed-jobs returns 403. So the one permitted re-run is unavailable to me rather than spent. Anyone with write access can re-run the failed job and it should pass, since nothing about the failure is deterministic.

Keeping this PR watched until it is green, merged, or closed.


Generated by Claude Code

The prek check failed because a hook MODIFIED a file: the typos
spell-checker read the loop variable `thr` as a misspelling of `the`
and rewrote all four uses, which fails prek by definition (hooks that
change files fail the run).

`threshold` is the clearer name regardless, so this takes the
spell-checker's side rather than adding an ignore entry.

Mine, and avoidable: AGENTS.md says to run
`uv run --only-group dev --locked prek` after changing files in this
repo, and I did not. Verified now — typos and rustfmt both Passed on
this file; the harvest artifacts under .claude/ are excluded from every
hook. `--locked` cannot run in this container (pyproject.toml's
`exclude-newer = "P7D"` fails to parse, so uv wants to re-lock), so the
run was unlocked and the uv.lock it touched was restored.

Probe output unchanged: 72.1% and 77.0% balanced accuracy.
@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review August 25, 2026 22:52
@AdaWorldAPI
AdaWorldAPI merged commit 1428540 into main Aug 25, 2026
33 of 34 checks passed
@cursor

cursor Bot commented Aug 25, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_698bf65a-547d-4130-b221-a2e5fe176e20)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e7bee5ac8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +34 to +37
//! `IANTOK.bin`), and the harvest corpus was `gma4/5/6` = COMLOD / LOCODE / HICODE, all code.
//! The per-file numbers below corroborate it independently: both code files sit inside the CODE
//! range on both metrics. Some tables ARE embedded in the code image (`QQ23`, the market prices,
//! is in `elite-source.asm`), so contamination is non-zero — but it is not the bulk of the slag,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 1. Do not call the unmeasured image all code

The probe measures only gma5 and gma6, but this conclusion covers the full gma4/5/6 harvest and even acknowledges immediately afterward that an embedded market table was harvested as code. Without measuring or region-labeling gma4, the results cannot establish either that all three images are code or that embedded data is not a substantial source of the 3,742 residual rows; narrow the conclusion to the measured files or include the omitted image.

Useful? React with 👍 / 👎.

Comment on lines +361 to +362
let c = pool(Truth::Code, f);
let d = pool(Truth::Data, f);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 2. Reject runs that lack either control group

When C64_CORPUS contains readable files from only one truth class—a supported scenario because every missing subject is merely skipped—one of these pools is empty. The percentile output then contains NaN, while the .max(1) denominators below still produce and label a seemingly meaningful balanced accuracy. Check that both pools contain scorable windows and skip the comparison otherwise.

Useful? React with 👍 / 👎.

Comment on lines +421 to +424
} else if best.1 >= 0.75 {
"weak — not alone"
} else {
"no better than guessing"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 3. Stop describing 72% accuracy as guessing

Every balanced accuracy below 75% is labeled "no better than guessing", even though chance is 50%; this mischaracterizes the probe's reported 72.1% result and any similar run. If 75% is intended as a usefulness gate, describe the result as weak or below that gate rather than asserting statistical equivalence to guessing.

Useful? React with 👍 / 👎.

Comment on lines +167 to +170
fn pad_window(bytes: &[u8], want: usize) -> Vec<u8> {
let mut w = bytes.to_vec();
if w.len() < want {
w.resize(want, 0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 4. Avoid copying the remaining image for every instruction

pad_window clones the entire supplied slice, and sweep supplies &code[offset..] on every decode attempt, so processing an image copies a quadratic number of bytes even though one lift needs only the minimum instruction window. This can make larger custom corpora disproportionately slow and memory-bandwidth intensive; borrow the remaining slice when it is long enough and allocate only the short padded tail.

Useful? React with 👍 / 👎.

Comment on lines +380 to +382
let mut best = (0.0f64, 0.0f64, false);
let mut cands: Vec<f64> = c.iter().chain(d.iter()).cloned().collect();
cands.sort_by(|a, b| a.partial_cmp(b).unwrap());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 5. Add focused tests for the scoring logic

The percentile and threshold-selection code has no automated coverage, while the example exits successfully without exercising it whenever the external sibling spec or corpus is absent. Extracting the scorer and testing both threshold directions, ties, boundary values, and empty/one-class inputs would prevent incorrect experimental conclusions from silently passing normal checks.

AGENTS.md reference: AGENTS.md:L169-L171

Useful? React with 👍 / 👎.

AdaWorldAPI added a commit that referenced this pull request Oct 14, 2026
…laim (#107)

* ruff_r2il: slag_partition probe — two negatives, one of them against my own claim

Built to test whether harvest_6502's 3742 residual rows split into
'opcode not yet classified' vs 'data lifted as code'. Uses a CONTROL
GROUP rather than a heuristic: Elite ships known-pure-data binaries
(SHIPS/WORDS/LODATA/IANTOK/SPRITE) beside known-pure-code (LOCODE/
HICODE), both from one build, both given identical treatment.

Negative 1 — the premise was false, and the probe is what showed it.
Elite keeps data in a SEPARATE source file (elite-data.asm -> SHIPS.bin
et al); the harvest corpus gma4/5/6 = COMLOD/LOCODE/HICODE is code. The
blueprints were never lifted as opcodes. Corroborated independently by
the probe's own per-file numbers: both code files sit inside the CODE
range on both metrics. Some tables ARE embedded (QQ23 market prices
lives in elite-source.asm), so contamination is non-zero, but it is not
the bulk of the slag. The reframing that claimed otherwise was wrong.

Negative 2 — content statistics do not partition. Over 208 windows of
256 bytes (>=16 instructions each): decode-error rate reaches 72.1%
balanced accuracy, control-flow density 77.0%. Neither is usable alone.
Direction is counterintuitive and worth keeping: DATA shows HIGHER
control-flow density (p50 26.6 vs 10.6) because random bytes decode into
branch opcodes.

Measured at WINDOW granularity after a correction. The first version
reported whole-file furnace stats and produced two exact duplicate pairs
across unrelated files of different sizes (SPRITE==gma5, SHIPS==gma6):
it handed every sweep block to ONE FunctionBehavior, and CFG::from_blocks
keeps only the component reachable from blocks[0], so those columns
measured a tiny entry-reachable fragment rather than the file. Removed
rather than reported. Remaining metrics come straight off the sweep and
need no SSA.

The untested hypothesis, named rather than implied: reachability. Code is
what a call graph reaches; data is what is only ever loaded FROM. That
cannot be measured on standalone control files (no callers) and needs the
mixed-image setting.

* fix(prek): rename thr -> threshold; the typos hook rewrote it to 'the'

The prek check failed because a hook MODIFIED a file: the typos
spell-checker read the loop variable `thr` as a misspelling of `the`
and rewrote all four uses, which fails prek by definition (hooks that
change files fail the run).

`threshold` is the clearer name regardless, so this takes the
spell-checker's side rather than adding an ignore entry.

Mine, and avoidable: AGENTS.md says to run
`uv run --only-group dev --locked prek` after changing files in this
repo, and I did not. Verified now — typos and rustfmt both Passed on
this file; the harvest artifacts under .claude/ are excluded from every
hook. `--locked` cannot run in this container (pyproject.toml's
`exclude-newer = "P7D"` fails to parse, so uv wants to re-lock), so the
run was unlocked and the uv.lock it touched was restored.

Probe output unchanged: 72.1% and 77.0% balanced accuracy.

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants