Fix red CI: lib-name collision, venv-less maturin, and an incomplete wheel - #1
Merged
Conversation
Three real bugs, all of which my local verification had masked.
1. `cargo test` failed with E0464 ("multiple candidates for rlib
dependency hnsw_engine"). The bindings crate declared
[lib] name = "hnsw_engine" — identical to the engine crate's lib name —
so rustdoc received two --extern hnsw_engine flags when running the
bindings doctests. Renamed the bindings lib to hnsw_engine_native
(internal only; maturin places the artifact per module-name).
I missed this locally by piping `cargo test` into `grep "test result"`,
which dropped the error lines *and* replaced the exit code with grep's.
2. The CI bindings job ran `maturin develop`, which refuses to run
without an active virtualenv. Switched to `pip install ./bindings`,
which builds through maturin's PEP 517 backend and needs no venv.
3. Found while fixing (2): the built wheel did not contain `hnsw_rag` at
all. maturin's mixed layout only packages the module named by
module-name, so `from hnsw_rag import ...` — which the README
documents — worked only under `maturin develop`'s editable install and
would have broken for anyone doing a real `pip install`. Shipped it
explicitly via [tool.maturin] include.
Also:
- CI now runs the service suite and the Next.js build, neither of which
was covered before, as parallel jobs.
- generation.py: the `cited` flag marked *every* retrieved chunk as
cited, making the UI badge meaningless in keyed mode. Now parses the
actual [n] markers back to chunk ids, ignoring out-of-range markers,
with 5 tests covering it.
- service/requirements-dev.txt so pytest+httpx are reproducible.
Verified with unmasked exit codes: cargo fmt/clippy -D warnings/test,
bindings pytest (16), service pytest (12), npm run build — plus a
clean-venv run of the exact new CI job commands.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012C4i9fFAaVGjWJtoRwxaVA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI has been red since Phase 3. This fixes it, plus two related defects found along the way.
CI is green on all four jobs for
4922d7d(run).mainis a strict ancestor of this branch, so it merges as a clean fast-forward.The three bugs
1.
cargo testfailed withE0464.bindings/Cargo.tomldeclared[lib] name = "hnsw_engine"— identical to the engine crate's lib name. With both in one workspace, rustdoc received two--extern hnsw_engineflags when running the bindings doctests and aborted with "multiple candidates for rlib dependency". Renamed the bindings lib tohnsw_engine_native(internal only; maturin places the artifact according tomodule-name).2. The CI bindings job could never have worked. It ran
maturin develop, which refuses to run without an active virtualenv — there isn't one on a GitHub runner. Switched topip install ./bindings, which builds through maturin's PEP 517 backend and needs no venv.3. The built wheel did not contain
hnsw_ragat all. Found while fixing #2. maturin's mixed layout only packages the module named bymodule-name, sofrom hnsw_rag import ...— which the README documents as part of the package — worked only undermaturin develop's editable install and would have broken for anyone doing a realpip install. Now shipped explicitly via[tool.maturin] include, and CI installs the real wheel so this can't silently regress.Why these slipped through
My local check was
cargo test 2>&1 | grep -E "test result". The pipe did two harmful things: it filtered out theerror[E0464]lines, and it replacedcargo test's exit code withgrep's. Bug #3 was masked by the same class of problem — an editable install papering over a broken wheel. Everything below was re-verified with unpiped exit codes and from a clean virtualenv.Also in this PR
citedbadge was meaningless.generation.pyreturned every retrieved chunk as cited, so the UI highlighted all of them regardless of what Claude actually referenced. It now parses the real[n]markers back to chunk ids, ignores out-of-range markers (a model inventing[9]for three sources), and dedupes in first-mention order. Covered by 5 new tests.service/requirements-dev.txtsopytest+httpxare reproducible rather than CI-only knowledge.Verification
cargo fmt --all --checkcargo clippy --all-targets -- -D warningscargo test(23)cargo build --releasepip install ./bindingshnsw_engineandhnsw_ragnpm run buildThe live run confirms the citation fix end to end: for "How does HNSW descend through layers during search?" the two
hnswchunks rank 1st and 2nd by cosine similarity, and only the chunk the answer actually referenced comes backcited=true.