Skip to content

Drop dead weight, stop one silent mis-score, and correct three stale claims - #74

Merged
kridaydave merged 1 commit into
mainfrom
cleanup/dead-code-drift-10-docs-deps
Oct 11, 2026
Merged

kridaydave merged 1 commit into
mainfrom
cleanup/dead-code-drift-10-docs-deps

Conversation

@kridaydave

Copy link
Copy Markdown
Contributor

Cleanup pass over the engine, the docs, and the lockfile.

Dead code

  • heuristic::evaluate was a five-argument wrapper around evaluate_with_policy with Policy::default() baked in. Production never called it; only its tests did, so the default-policy path existed in two places. The wrapper is gone and the 14 test callers now name evaluate_with_policy directly, so the default policy is pinned at its one real call site.
  • SimpleFile::size and SimpleFile::provenance in the PyPI /simple/ response model were #[serde(default)] members nothing read, the exact defect SimpleMeta's own doc comment refuses to carry for api-version. Both are gone, along with the struct's #[allow(dead_code)].

Bug

  • diff_single_file coerced invalid UTF-8 to "" on either side, so a file stamped text whose bytes do not decode diffed as everything-deleted or everything-added and scored accordingly. Both sides are refused now with an error naming the path and the side (drift entry 10). The path is unreachable through compute_delta because classify_bytes routes non-UTF-8 to Binary and the early return covers it, which is what made it safe to leave as long as it was: the only state that reaches it is the classification disagreeing with the bytes, and a coercion cannot answer that state correctly. Verified by restoring the coercion and watching the new test (a_text_classified_file_that_does_not_decode_is_refused_not_coerced) fail.

Doc claims corrected

  • CHANGELOG 0.3.1 said "all six managers are reviewed through one grammar." --help, ARCHITECTURE.md §5, and SHIM_MANAGERS all say eleven (npm npx pnpm yarn bun bunx pip pip3 cargo yay paru) and are right. The entry says eleven now (drift entry 6).
  • CHANGELOG 0.3.0 claimed crate-name -/_ canonicalization (serde_json → serde-json). Checked against the live registry instead of the code: the sparse index stores only the folded file (index.crates.io/se/rd/serde_json 200, se/rd/serde-json 404) and the download host 403s the hyphen path where rocket_db_pools is 200, so a hyphen-spelled review fails closed at the fetch today. The distinctness is deliberate anyway: a configured index or mirror may genuinely serve both spellings, and answering one spelling with the other's bytes is worse than refusing (the ci lane pins that invariant in lockfile_diff_keeps_pypi_alias_off_cargo_pins). The claim is removed; drift entry 4 records the evidence and the stance (drift entry 4).
  • CHANGELOG 0.3.0 said blueline install shipped "sandboxed extraction." It never did. The entry now says fail-closed script execution and points at drift entry 1, which stays High and unfixed because the fix is code.

One attempt was made and reverted inside this branch before the first commit: folding - to _ in canonical_crate_name to make the 0.3.0 claim true. lockfile_diff_keeps_pypi_alias_off_cargo_pins caught it, because the fold makes a hyphen-spelled request fetch the underscore spelling's bytes, which is precisely the invariant the test exists to hold. That is what settled the direction of entry 4 toward the doc correction.

Dependencies

  • clap 4.6.6 → 4.6.7, flate2 1.1.9 → 1.1.10 (miniz_oxide 0.8.9 → 0.9.1, adds zlib-rs 0.6.8), serde_json 1.0.151 → 1.0.152, thiserror 2.0.20 → 2.0.21. Caret-compatible, and each candidate's declared MSRV (1.85, 1.67, 1.71, 1.77; miniz_oxide and zlib-rs declare none) sits under the pinned 1.97.1 toolchain.
  • actionlint 1.7.7 → 1.7.12 in CI, after the 1.7.12 binary lints this repo's workflows clean.
  • Left alone deliberately: proptest (1.12 wants rand 0.10, a dev-only tree reshuffle for no security gain), and the major action bumps (actions/checkout v4 → v7, actions/setup-node v4 → v7). Those are real upgrades but not ones to take blind in a cleanup PR; say the word and they get their own branch.

Gate

./scripts/verify.sh passes (fmt, clippy, test, references) on this branch. One environment note: the test stage ran with CARGO_PROFILE_DEV_DEBUG=0 CARGO_PROFILE_TEST_DEBUG=0 because this box holds ~6.8 of 7.7 GB in other agent sessions and the debuginfo-heavy link was OOM-killed twice. Same assertions, one environment flag away from CI's exact command.

Out of scope (open, tracked in references/drift.md)

…claims

Cleanup pass over the engine, the docs, and the lockfile.

Two dead items removed. `heuristic::evaluate` was a five-argument wrapper
around `evaluate_with_policy` with `Policy::default()` baked in: production
never called it, only its own tests did, so the default-policy path existed
in two places. The tests now call `evaluate_with_policy` directly. In the
PyPI `/simple/` model, `SimpleFile::size` and `SimpleFile::provenance` were
`#[serde(default)]` members nothing read, which is the exact defect
`SimpleMeta`'s own doc comment refuses to carry for `api-version`. Both are
gone, along with the struct's `#[allow(dead_code)]`.

One coercion to a wrong answer is now a refusal. `diff_single_file` ran
`from_utf8(...).unwrap_or("")` on both sides, so a file stamped text whose
bytes do not decode diffed as everything-deleted or everything-added and
scored accordingly. Unreachable through `compute_delta`, since `classify_bytes`
routes non-UTF-8 to `Binary` and the early return covers it, which is what
made it safe to leave: the only state that reaches it is the classification
disagreeing with the bytes, and a coercion cannot answer that state
correctly. Both sides are refused with an error naming the path and side.
Verified by restoring the coercion and watching the new test fail.

Three doc claims corrected, each against the thing they describe:

- CHANGELOG 0.3.1 said "all six managers are reviewed through one grammar".
  `--help`, `ARCHITECTURE.md`, and `SHIM_MANAGERS` all say eleven and are
  right; the entry says eleven now.
- CHANGELOG 0.3.0 claimed crate-name `-`/`_` canonicalization. Checked against
  the live registry: the index stores only the folded file (`se/rd/serde_json`
  200, `se/rd/serde-json` 404; `static.crates.io/crates/rocket_db_pools/`
  200, the hyphen 403), so a hyphen spelling fails closed at the fetch. The
  distinctness is deliberate anyway — a configured index or mirror may serve
  both spellings, and answering one with the other's bytes is worse than
  refusing — and the ci lane pins that invariant. The claim is removed; drift
  entry 4 records the evidence and the stance. A first attempt to fold the
  names was reverted after `lockfile_diff_keeps_pypi_alias_off_cargo_pins`
  caught it.
- CHANGELOG 0.3.0 said `blueline install` shipped "sandboxed extraction". It
  never did; the entry now says what shipped and points at drift entry 1,
  which stays High and unfixed because the fix is code.

Dependencies: clap 4.6.7, flate2 1.1.10 (miniz_oxide 0.9.1, zlib-rs 0.6.8),
serde_json 1.0.152, thiserror 2.0.21. All four are caret-compatible bumps
whose declared MSRVs (1.85/1.67/1.71/1.77, miniz_oxide and zlib-rs declare
none) sit under the pinned 1.97.1 toolchain. actionlint 1.7.7 to 1.7.12 in
CI; the new binary lints this repo's workflows clean before the bump.
proptest stays at 1.11.0 on purpose: 1.12 wants rand 0.10, which reshuffles
a dev-only dependency tree for no security-relevant gain.

Gate: ./scripts/verify.sh passes (fmt, clippy, test, references). The test
stage ran with CARGO_PROFILE_{DEV,TEST}_DEBUG=0 because this box was holding
~6.8 of 7.7 GB in other sessions and the debuginfo-heavy link got OOM-killed
twice; the assertions are unchanged, but that run is one environment flag
away from CI's exact command.

Commit made by Step 5 Preview Free in OpenCode on behalf of Kriday.
@kridaydave
kridaydave merged commit e9e4e9b into main Oct 11, 2026
42 checks passed
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