check: no library source file is unreachable from its crate root #142
Loading…
Reference in a new issue
No description provided.
Delete branch "sandbox/meter-delta-read"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Going after the meters turned up a worse instance of a family this repo keeps finding.
jouleclaw-omni/src/runtime/energy.rsdocuments itself as measuring "actual GPU, CPU, ANE and DRAM energy consumption in joules using Apple's IOReport framework." It does not call IOReport. The macOS path multipliesgetrusageCPU seconds by a fixed 15 W; the other path multiplies wall-clock by 45 W; each then splits the result 60/20/20 across subsystems by constant fractions. Zero tests. Andruntime/mod.rsdoes not declare it — so it has never been compiled, by anything, ever.Why an orphan is the strongest member of the family
A feature-gated test with no
--featuresreports zero tests. A platform-gated meter on a single-platform runner compiles out. A conformance suite inmain()gets built and never run. An orphan source file does not even type-check — invisible to cargo check, cargo test, clippy and every conformance suite simultaneously, and it cannot fail because nothing asks it anything.The hazard is the next reader, not the dead code. A real meter with a per-rail liveness gate already lives in the same workspace (
jouleclaw-energy). Someone who trusts this file's header and wires it in instead gets CPU-seconds × a guess, apportioned by invented fractions — energy derived from a performance proxy, which is precisely what the metering ladder exists to grade against.Worth naming separately: the per-subsystem split. Four fields reading as four independent observations when all four are fractions of one number is precision standing in for measurement, and it invites per-subsystem conclusions nothing here could support.
Measured, not estimated
1659 library sources checked. 25 orphans, all in
jouleclaw-omni, 19,964 lines never compiled. Every other crate is clean.My first pass said 77 — it counted
src/bin/*.rs, which cargo auto-discovers, so the exclusions are part of the check rather than a convenience. The baseline was then generated by the detector instead of retyped, because hand-copying it pinned 15 of 25 and the check caught the other ten.Falsified in both directions
A planted orphan must fail the check; removing it must pass. The CI step repeats that self-test on every run, so the guard cannot quietly stop gating. Exit codes were verified without a pipe —
$?after| headis head's status, which is exactly how a gate stops gating unnoticed.The baseline pins today's 25 so this does not go red on a pre-existing condition, and names what the file falsely claims. Removing an entry is the point; adding one is a regression to argue for in a commit message.
What I deliberately did not do
energy.rsgets a corrected header and nothing else. I had added a declaredEnergyBasisto it and reverted that — the field made the orphan stop compiling, and a broken orphan is worse than an honest one.Whether those 25 files get wired up or deleted is not mine to decide. 20k lines is someone's work, and the guard stops the problem growing either way.
🤖 Generated with Claude Code
7a82d534690c0b66f001