Skip to content

fix(visaged): unbreak CI — clippy 1.98 lint, without raising MSRV - #87

Merged
ccross2 merged 1 commit into
mainfrom
fix/clippy-chunks-exact-msrv-safe
Aug 24, 2026
Merged

ccross2 merged 1 commit into
mainfrom
fix/clippy-chunks-exact-msrv-safe

Conversation

@ccross2

@ccross2 ccross2 commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

main is red, and no commit caused it

Run history for the identical SHA 63c9fbc:

when result
2026-08-18 17:12 success
2026-08-24 06:51 failure

The code did not change; the toolchain did. CI resolves dtolnay/rust-toolchain@stable, which floated onto a Rust whose clippy adds chunks_exact_to_as_chunks. With -D warnings, a new lint is an immediate failure on untouched code — and it blocks every merge in the repo, not just this one.

error: using `chunks_exact` with a constant chunk size
   --> crates/visaged/src/store.rs:336:24

Why neither obvious fix works

  • clippy's own suggestion, as_chunks::<4>() — stabilized in Rust 1.88.0 (rust-lang/rust#139656), against this crate's declared rust-version = "1.75". Taking the suggestion would raise MSRV by thirteen minor versions, which versioning-discipline classes as a breaking change for consumers.
  • #[allow(clippy::chunks_exact_to_as_chunks)] — names a lint that does not exist before clippy 1.98, so it trips unknown_lints on any older toolchain. That trades one failure for another.

So the loop indexes explicitly. It is correct on every toolchain from 1.75 upward and couples to no lint name. The slice bounds cannot panic: bytes.len() == EMBEDDING_BYTE_LEN is checked immediately above, and EMBEDDING_BYTE_LEN == EMBEDDING_DIM * 4.

Verification

  • fmt clean, clippy clean, 81 tests pass across 9 suites.
  • Coverage of the rewritten line proven by injecting a one-character defect (let start = i * 4 + 1), which fails 5 tests — test_embedding_byte_fidelity, test_strict_rejects_nan, test_strict_rejects_infinity, test_roundtrip, test_encryption_roundtrip — then restoring from a snapshot and re-confirming green.

Stated limitation: the local toolchain is 1.95 and does not carry this lint, so I could not reproduce-then-confirm against the real lint locally. CI on this PR is the check that matters.

Not addressed here

CI is nondeterministic by construction: a floating stable toolchain plus -D warnings means the build can go red with no commit, which is exactly what happened. Pinning the toolchain is a maintainer policy call and deserves its own decision rather than riding along in a fix.

🤖 Generated with Claude Code

…nks without raising MSRV

main is red, and no commit caused it. Run history for the identical SHA 63c9fbc:

  2026-08-18 17:12  success
  2026-08-24 06:51  failure

The code did not change; the toolchain did. CI resolves
`dtolnay/rust-toolchain@stable`, which floated onto a Rust whose clippy adds
`chunks_exact_to_as_chunks`. Combined with `-D warnings`, a new lint is an
immediate failure on untouched code, and it blocks every merge.

Neither obvious fix is available here:

- clippy suggests `as_chunks::<4>()`. That API is far newer than this crate's
  declared `rust-version = "1.75"`, so taking the suggestion would silently
  raise MSRV — a breaking change for consumers.
- `#[allow(clippy::chunks_exact_to_as_chunks)]` names a lint that does not
  exist before clippy 1.98, so it would trip `unknown_lints` on any older
  toolchain, trading one failure for another.

So the loop indexes explicitly instead. It is correct on every toolchain from
1.75 upward and couples to no lint name. The slice bounds cannot panic:
`bytes.len() == EMBEDDING_BYTE_LEN` is checked immediately above, and
`EMBEDDING_BYTE_LEN == EMBEDDING_DIM * 4`.

Verified: fmt clean; clippy clean; 81 tests pass across 9 suites. The local
toolchain is 1.95 and does NOT carry this lint, so the fix could not be
reproduced-then-confirmed against the real lint locally — CI on this PR is the
check that matters. Coverage of the rewritten line was proven by injecting a
one-character defect (`i * 4 + 1`), which fails 5 tests including
test_embedding_byte_fidelity and test_strict_rejects_nan.

Not addressed here: CI is nondeterministic by construction. A floating stable
toolchain plus `-D warnings` means the build can go red with no commit, which
is what happened. Pinning the toolchain is a maintainer policy call and is left
for a separate decision.

Signed-off-by: ccross <cescross2@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ccross2
ccross2 merged commit fe2beb7 into main Aug 24, 2026
3 checks passed
@ccross2
ccross2 deleted the fix/clippy-chunks-exact-msrv-safe branch September 15, 2026 21:16
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