r2il: PR 2 first slice — §12 corpus profile (resolves O1) + RefinedTruthSink - #101
Conversation
Task #2 was marked complete without a recorded artifact — TRIAGE-RESULT.md only carries PR 1's pass-1 harvest triage (B1-B3), not the §12 layout profile the plan's O1 open item asks for. Ran it for real: cargo run --example r2il_corpus_profile --features lift --release Across all 4 corpus binaries (stress_test, stress_test_opt, /bin/ls, /usr/bin/env; 130193 sampled ops total): 100.00% fit the dst+src0+src1 inline shape, 0.00% need Vec routing, on every single binary. This resolves O1 and settles §11's layout question for PR 2: inline, not descriptor/hybrid, for this corpus family — with the caveats spelled out in the file (CallOther arity unmeasured — no samples in this corpus; O3's facet-overflow question stays open, absence of overflow here is not proof of absence in general). Full breakdown (per-binary op/CFG stats, facet projection, furnace conservation cross-check) in CORPUS-PROFILE-RESULT.md.
Scoped increment of PR 2 ("route -> V3 projection + DTO hooks", plan
r2il-behavioral-ir-v1.md). The plan's SUBSTRATE RULING calls for a sink
trait behind which offline / lance-graph SoA / S3 are implementations,
chosen at the call site, never baked into the furnace — furnace/ore/slag
already carry no persistence assumption (verified: neither module touches
a file, the network, or an env var).
Ships:
- `RefinedTruthSink` trait — the seam. `ruff_r2il` takes NO lance-graph
dependency to define it; a lance-graph-side crate implements it against
its own SoA (facet.rs's own PR-3 deferral: the real classid mint lives
there, not here).
- `OfflineSink` — backend 1, real and tested. Writes facts/residuals/report
as `#version`/`#schema`-headed TSV per STAGED-CODEGEN-GUIDE.md §4's own
additive-export rule; `read_report` round-trips.
- `S3Config::from_lookup`/`from_env` — backend 3's credential plumbing only
(`AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`/`AWS_ENDPOINT_URL_S3`/
`AWS_REGION`, all-or-nothing, empty treated as unset). The actual signed
PUT is explicitly NOT implemented — real scope for its own pass, not
faked here. `from_lookup` exists so the refuse-on-partial-credentials
test never mutates real env state (this crate forbids unsafe_code, and
`std::env::set_var`/`remove_var` require it).
- Backend 2 (lance-graph zero-copy SoA): intentionally absent from this
crate, per the trait's own design — see above.
Also: recorded the §12 corpus profile (O1) — 100.00% of 130193 sampled
ops across 4 binaries fit the dst+src0+src1 inline shape, 0.00% needed
Vec routing. Updated STAGED-CODEGEN-GUIDE.md's stale "NOT stable" flag on
FlatFact's a/b payload slots with that evidence: the existing shape needs
no re-carving for PR 2's layout choice (only the PER-KIND MEANING and
persistence encoding remain open).
Incidental finding, fixed: ruff/clippy.toml's disallowed-methods list is
directory-scoped, not Cargo-workspace-scoped, so it reaches this
workspace-EXCLUDED crate despite its reasons saying "in ty crates" —
ruff_r2il has no ty::System trait to route through. #[expect]'d at the
two call sites with that reasoning.
Not in this slice (real remaining PR 2 scope, not attempted): DTO/
codebook wiring beyond what facet.rs already has, the round-trip
reconstruction oracle, optional SPO projection of semantic facts, a
facts/residuals reader (only read_report exists).
Gates: 46/46 tests pass (34 unit + 12 lossless-fixture), clippy -D
warnings clean, fmt clean, cargo doc introduces zero new warnings (the
4 existing warnings are pre-existing, in furnace.rs/ore.rs, untouched
by this change).
Bugbot couldn't run - usage limit reachedBugbot 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_09fc4d52-57eb-4319-822f-6ea5fbc8c042) |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Bugbot couldn't run - usage limit reachedBugbot 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_5aa3c587-61e1-4ad2-994c-c7c9974cf720) |
Summary
A scoped first increment of PR 2 from
.claude/plans/r2il-behavioral-ir-v1.md("route → V3 projection + DTO hooks, gated on PR 1 numbers"). PR 2 has no type-level implementation spec the way PR 1 did (that plan's impl-spec doc is entirely PR-1-scoped) — writing that full spec, and then the round-trip reconstruction oracle + DTO/codebook wiring + optional SPO projection it calls for, is real remaining work sized similarly to PR 1 (which needed a 10-worker Sonnet fleet). This PR ships what's genuinely well-scoped and measurement-gated today, and is explicit about what it doesn't attempt.1. §12 corpus profile — resolves O1
Task tracking had "run corpus profile + record §12 numbers" marked done with no artifact anywhere in the repo. Actually ran it:
Across all 4 corpus binaries (130193 sampled ops total): 100.00% fit the
dst+src0+src1inline shape, 0.00% neededVecrouting — on every single binary, no exceptions. Full breakdown (per-binary op/CFG stats, facet-overflow check, furnace conservation cross-check, and the honest caveats —CallOtherarity unmeasured, phi/Multiequalfan-in reaching 7 at the CFG level though never sampled as anOprow here) in.claude/harvest/r2il/CORPUS-PROFILE-RESULT.md.This also let me correct a stale flag in
STAGED-CODEGEN-GUIDE.md:FlatFact's existinga/b: u64payload slots (already shipped in PR 1, 88 bytes,Copy, noVec) were flagged "NOT stable, may be re-carved in PR 2." The measurement says otherwise — the shape needs no re-carving. What's still open is the per-kind meaning of those slots and the persistence byte encoding, both real PR 2 scope.2.
RefinedTruthSink— the sink traitThe plan's SUBSTRATE RULING calls for a trait behind which offline / lance-graph SoA / S3 are implementations, chosen at the call site.
furnace/ore/slagalready carry zero persistence assumption (verified — no file/network/env touch in any of the three modules), so this is additive.OfflineSink— real, tested. Writes facts/residuals/report as#version/#schema-headed TSV (same additive-export convention every other R2IL artifact already uses);read_reportround-trips.S3Config::from_lookup/from_env— credential plumbing only (AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_ENDPOINT_URL_S3/AWS_REGION, all-or-nothing, empty treated as unset). The actual signed PUT is not implemented — flagged explicitly in the module docs rather than faked.ruff_r2iltakes no lance-graph dependency to define the trait; a lance-graph-side crate implements it against its own SoA (matchesfacet.rs's own PR-3 deferral — the real classid mint lives there).Incidental finding, fixed
ruff/clippy.toml'sdisallowed-methodslist is directory-scoped, not Cargo-workspace-scoped — it reaches this workspace-excluded crate despite every reason string saying "in ty crates" (ruff_r2ilhas noty::Systemtrait to route through).#[expect]'d at the two call sites (std::fs::create_dir_all,std::env::var) with that reasoning, per this repo's own AGENTS.md preference for#[expect]over#[allow].Not in this slice (explicit, not silently dropped)
facet.rsalready has.R2IL → routes → semantic-equivalent R2IL).read_reportexists; reconstructingFlatFact/ResidualLedgerrows (incl.VarnodeFacetfrom its 3 columns) is real remaining scope.Test plan
cargo testinruff_r2il— 46/46 pass (34 unit + 12 lossless-fixture), including 3 newsink::tests(disable-run-verified: the credential-refusal test drops exactly one env key at a time and confirms the whole config is refused, not just checks the all-present case)cargo clippy --all-targets -- -D warnings— cleancargo fmt --check— cleancargo doc --no-deps— zero new warnings (4 pre-existing warnings infurnace.rs/ore.rs, untouched by this change)uvx prek run --from-ref origin/main --to-ref HEAD— cleanDraft: this is a genuine first slice, not the full PR 2. Marking ready once the maintainer confirms scope, or folding in the remaining pieces as follow-up commits on this branch.
Generated by Claude Code