Skip to content

Fix red CI: lib-name collision, venv-less maturin, and an incomplete wheel - #1

Merged
1816x merged 1 commit into
mainfrom
claude/project-start-is5vju
Jul 29, 2026
Merged

Fix red CI: lib-name collision, venv-less maturin, and an incomplete wheel#1
1816x merged 1 commit into
mainfrom
claude/project-start-is5vju

Conversation

@1816x

@1816x 1816x commented Jul 29, 2026

Copy link
Copy Markdown
Owner

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). main is a strict ancestor of this branch, so it merges as a clean fast-forward.

The three bugs

1. cargo test failed with E0464. bindings/Cargo.toml declared [lib] name = "hnsw_engine" — identical to the engine crate's lib name. With both in one workspace, rustdoc received two --extern hnsw_engine flags when running the bindings doctests and aborted with "multiple candidates for rlib dependency". Renamed the bindings lib to hnsw_engine_native (internal only; maturin places the artifact according to module-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 to pip install ./bindings, which builds through maturin's PEP 517 backend and needs no venv.

3. The built wheel did not contain hnsw_rag at all. Found while fixing #2. maturin's mixed layout only packages the module named by module-name, so from hnsw_rag import ... — which the README documents as part of the package — worked only under maturin develop's editable install and would have broken for anyone doing a real pip 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 the error[E0464] lines, and it replaced cargo test's exit code with grep'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

  • CI coverage gaps closed. The service suite and the Next.js build were not in CI at all. Both now run as parallel jobs, alongside the engine and bindings jobs.
  • The cited badge was meaningless. generation.py returned 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.txt so pytest + httpx are reproducible rather than CI-only knowledge.

Verification

Check Result
cargo fmt --all --check pass
cargo clippy --all-targets -- -D warnings pass
cargo test (23) pass
cargo build --release pass
Clean-venv pip install ./bindings pass
Wheel ships hnsw_engine and hnsw_rag pass
bindings pytest (16) pass
service pytest (12) pass
npm run build pass
Live service: seed sample corpus + query pass

The live run confirms the citation fix end to end: for "How does HNSW descend through layers during search?" the two hnsw chunks rank 1st and 2nd by cosine similarity, and only the chunk the answer actually referenced comes back cited=true.

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
@1816x
1816x merged commit f9dae95 into main Jul 29, 2026
8 checks passed
@1816x
1816x deleted the claude/project-start-is5vju branch July 29, 2026 22:21
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.

2 participants