Skip to content

Main rust flow - #380

Merged
HananKavitzAmat merged 302 commits into
chunkhound:mainfrom
HananKavitzAmat:main_rust_flow
Sep 8, 2026
Merged

HananKavitzAmat merged 302 commits into
chunkhound:mainfrom
HananKavitzAmat:main_rust_flow

Conversation

@HananKavitzAmat

Copy link
Copy Markdown
Collaborator

No description provided.

Hanan Kavitz and others added 30 commits July 21, 2026 13:18
- HNSW compaction crash: import_conn in run_export_import_compaction
  was opened without loading the VSS extension.  Subsequent HNSW index
  rebuild failed with 'unknown index type HNSW'.  Load VSS on the
  temporary compaction connection before IMPORT DATABASE.

- Progress bar fix 1: embedding completion showed total_files (930)
  instead of total_embeds (39001) because the final embed phase
  progress emission used the wrong count.  Move total_embeds
  declaration outside the parsed block so the correct count reaches
  the emit_progress call.

- Progress bar fix 2: the write-phase progress bar stayed at 0/930
  because the handler only set info text, never updated completed.
  Since the DB write is a single atomic operation, fill the bar
  immediately when the phase starts.
Rust compaction: replace EXPORT/IMPORT Parquet round-trip with in-process
ATTACH + INSERT SELECT (matching Python approach).  Drops ~2× throughput
penalty from Parquet serialization/deserialization.

Compaction thresholds: align Rust pipeline with Python defaults
(threshold 0.30, batch 50, min 50MB) to trigger at same cadence.

Progress bars: split write phase into sub-phases (prepare, data, index,
compact) with individual bars and wall clocks.  Embed bar now shows
embeddings/s rate matching standalone Python path.

Fix DuckDB lock conflict during compaction: close Python-side connection
in write-compact callback before Rust renames the DB file.  Must happen
after parse workers exit — early close crashes forked ProcessPoolExecutor
children.

Remove duplicate HNSW rebuild: finish_write() already rebuilds; skip
explicit recreation in compaction.  reopen() safety net catches loss.
MCP startup tests that spawn real subprocesses are inherently slower
and more environment-sensitive than import/CLI-help checks.  Move
them to tests/mcp/test_smoke.py so tests/test_smoke.py remains a
fast, reliable guardrail::

    uv run pytest tests/test_smoke.py -v   # fast, reliable
    uv run pytest tests/mcp/ -v            # when MCP code changes
Adds embed_batch_callback for concurrent embedding requests across
rayon threads (thread-local providers avoid shared httpx client hangs
across event loops), configurable via embed_thread_pool_size/batch_size.
Surfaces embeddings_generated through coordinator stats, and cleans up
progress-bar sub-phase handling (store_task removed in favor of Rust
write sub-phase bars, DuckDB connection closed at write-prepare).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
The Rust pipeline could not survive a process restart: reindexing an
already-indexed directory crashed with `SerializationException: Failed to
deserialize: field id mismatch` on the very next `chunkhound index`
invocation. Root cause: indexing_coordinator.py's "write-prepare" progress
callback only closed DuckDBConnectionManager's connection, leaving
SerialExecutor's own thread-local connection (used for schema/discovery
queries) alive in the background. Rust then opened a third connection to
the same file while that second Python connection was still live in-process,
corrupting the DB. Fixed by calling the provider's full disconnect(), which
tears down both connections and shuts down the executor thread.

Also fixes a crash hit while diagnosing the above: the headless progress
_Shim (rich_output.py) didn't implement remove_task/reset, which the Rust
pipeline's progress wiring calls — any non-interactive CHUNKHOUND_USE_RUST=1
run crashed immediately.

Adds:
- tests/contracts/test_reopen_after_close.py — regression test reproducing
  the reopen crash via two real CLI invocations in separate processes.
- scripts/bench_pipeline.py — Rust vs Python indexing benchmark harness
  (cold/warm/incremental scenarios), per docs/rust-pipeline-architecture.html §13.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…at write-prepare

The Rust pipeline's compute_diff_blocking() opens its own independent
DuckDB connection as the very first step of run() -- before parsing
even begins -- but the coordinator wasn't disconnecting the Python-side
connection until the much later "write-prepare" progress callback.
That left two live, non-read-only connections to the same DB file
during the entire discovery/diff/parse/embed phase, causing lock
conflicts and silent on-disk corruption that only surfaced later as
"Serialization Error: Failed to deserialize: field id mismatch" when a
fresh process reopened the DB. Root-caused via bisection back to
7eb55df (Phase 6, when the Rust pipeline was first wired into
IndexingCoordinator) -- reproduces deterministically indexing a real
multi-file repo, not just the tiny test fixtures.

Move the disconnect to fire immediately before run_rust_pipeline() is
called instead. This is safe because parse_batch_callback's
ProcessPoolExecutor (whose fork'd children inherit whatever DuckDB
state is live at fork time) isn't created until Rust's parse phase,
well after this point -- so no forked child ever inherits a live
connection. Drop the now-redundant disconnect at write-prepare.

Verified: indexing the chunkhound package itself (370 files) and
reopening the DB in a fresh connection now succeeds 4/4 runs (was
failing 4/4 before). tests/contracts/ + test_smoke.py (28/28),
test_rust_db_writer.py + test_duckdb_compaction.py +
test_parallel_discovery.py (155/155) all pass.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
… fix progress bars

Wires pipeline_parallel: true into pipeline_bridge.py's config dict, activating
the streaming pipeline (pipeline_parse_embed_store) that was previously
implemented but unreachable in production. This closes the "no true 3-stage
pipeline" gap against the design doc: parse, embed, and store now genuinely
overlap across batches instead of running store as a single blocking phase
after all parsing/embedding completes. Verified ~13% wall-clock speedup on a
370-file repo (2 batches), with logged evidence of real thread overlap.

Adds per-batch [parse]/[embed]/[store] debug-level timing instrumentation to
pipeline.rs (visible via --verbose) so overlap can be directly observed in
logs, not just inferred.

Fixes three progress-bar regressions the above change exposed/introduced:

1. "Parsing files" bar was frozen for the entire run (only updated at 0% and
   100%) while "Writing data" ran concurrently -- now reports real per-batch
   file counts throughout.
2. "Embedding" bar was structurally broken (embed_batch_parallel was passed
   `None` for its progress callback) -- now reports per-batch progress against
   a live-refining estimated chunk total (exact chunk count isn't known
   upfront in a pipelined design; the estimate converges to the exact count on
   the final batch).
3. "Writing data" bar showed a stale count (e.g. "1/5") at completion --
   caused by `_pr.tasks[task_id]`, which is a list indexed by *position*, not
   a mapping keyed by TaskID; removing store_task earlier shifts list
   positions out of sync with TaskIDs. Replaced with tracked nonlocal totals
   instead of querying `_pr.tasks[...]`. A pre-existing instance of the same
   bug in the "done" handler (corrupting the embed bar's final re-sync) was
   also removed as redundant, since both "parse" and "embed" already receive
   an exact final (total, total) call in both pipeline paths.
4. First-batch embed speed showed a nonsensical figure (orders of magnitude
   too high) -- the streaming path had no early "embed" (0, 0) call to anchor
   the speed-tracking clock before batch 0's embedding began, so the first
   real reading divided a full batch's chunk count by a near-zero elapsed
   time. Added the missing early call (mirroring "parse"'s existing pattern)
   and a defensive 0.05s minimum-elapsed floor on the Python side.

All fixes verified via make rust-check, make rust-test, the full contract
test suite (test_pipeline_parallel, test_identical_chunks,
test_incremental_updates, test_parallel_embed, test_parallel_parse,
test_identical_embeddings), test_smoke.py, and live end-to-end runs through
the real indexing_coordinator progress callback (mocked embeddings, real
Rich Progress instance) confirming correct bar behavior and speed values.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…contention

ensure_all_hnsw_indexes() left the connection at `SET threads = 8` for its
entire remaining lifetime — set during open()'s crash-recovery check and
never reset. Once the streaming pipeline made the store and embed threads
run concurrently, DuckDB's 8-thread writes/checkpoints competed with the
embed thread's rayon pool for cores on this 12-core machine, exactly
saturating it (8 + 4) and causing a real ~25-33% throughput regression.

Resetting to `threads = 1` after any index build (the connection may still
be mid-run with a concurrent embed thread active) recovered real-world
throughput from ~300 to ~380 chunks/s on a full-repo run against a real
embedding server, close to the ~400 chunks/s pre-regression baseline.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
… contract tests

Removes the now-dead single-item parse/embed callback API and the
`pipeline_parallel` config flag now that parse ∥ embed ∥ store streaming is
always on, fixes thread-local event-loop reuse in the embed rayon pool
(prevents hangs when max_concurrent_batches >= 4), auto-detects embed
concurrency from the provider, and fixes progress-bar phase handling for the
compaction/HNSW-rebuild mutual exclusion. Supersedes test_parallel_embed.py
and test_parallel_parse.py with test_pipeline_parallel.py, and adds
test_compaction_before_index.py as a regression test for the HNSW
double-build bug that motivated the progress-bar fix.

Also fixes IndexingPipeline::run() returning early on an empty file list
without touching the DB — re-indexing a directory that's gone from "has
files" to empty never deleted the now-orphaned rows. An empty file list now
flows through the incremental diff + streaming pipeline, and the embed
thread flushes any delete_paths that no batch ever carried.

Adds three of the design doc's missing failure-mode contract tests:
test_empty_directory, test_embed_api_failure (already-correct behavior,
just untested), and test_db_write_failure (fail-fast case; per-batch
rollback already exists in duckdb_backend.rs).

Ignore .pi/ (local task-tracking tool metadata, not project source).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Previously, an exception from parser.parse_file() for a single file
propagated through ProcessPoolExecutor.map() and aborted the entire batch
call; in the Rust pipeline that surfaced as a fatal error on the shared
error mutex, killing the whole run over one bad file.

_parse_one_file() now catches per-file exceptions and returns a 3-tuple
(language, chunks, error) instead of raising. parse_one_batch() in
pipeline.rs reads the new optional error element (backward compatible with
2-tuple-returning callbacks) and records it on ParsedFile.error. Per-file
errors are collected across the run and now populate
PipelineReport.errors, which was previously hardcoded to always be empty.

Closes gap chunkhound#27 (test_parse_error_per_file) from the rust-pipeline-architecture
design doc gap analysis.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Touching a file's mtime without changing its bytes (git checkout, CI
artifact restore, container rebuild) previously forced a full re-embed
and chunk rewrite in the Rust indexing pipeline, since compute_diff()
only compared mtimes. Add a content-hash check during the existing
upfront DB-snapshot diff phase: touch-only files are now confirmed
unchanged and skipped before ever reaching parse/embed/store, while
genuinely changed/new files pay one extra Rust-side hash read (bounded,
justified) instead of the double-read a Python-side hash would cause.

Hash computed via xxhash-rust (xxh3), verified byte-identical to
Python's xxhash.xxh3_64().hexdigest() via a golden cross-language test.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
parse_batch_callback() previously spun up and tore down a fresh
ProcessPoolExecutor on every Rust parse batch (~50 times over a
10K-file index at 200 files/batch), paying process-spawn cost far more
often than necessary. The pool is now a lazy, process-wide singleton
(_get_parse_pool()), created once and reused across every batch and
every pipeline run in the process, with atexit-registered shutdown.

Also adds a regression test pinning down the batch-shaped callback
contract: output must be identical regardless of how a run is chopped
into parse_batch_callback() calls, protecting the shared pool against
silently leaking state across batches.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
_get_parse_pool() sized the persistent pool to min(os.cpu_count(), 16),
silently shrinking parallelism on any machine with fewer than 16 cores
compared to the old per-batch min(files_in_batch, 16) sizing (a flat 16
for the production parse_batch_size of 200). Rust's config dict already
computed and shipped a "parse_thread_pool_size" value for this exact
purpose, but nothing ever read it back on the Python side.

configure_parse_pool() lets run_rust_pipeline() set the pool size before
the pipeline starts, so that previously-dead config value now actually
controls the pool _get_parse_pool() creates.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
parse_batch_callback() used to receive only detect_embedded_sql as a bare
positional bool. PipelineConfig (src/pipeline/config.rs) has carried
per_file_timeout_secs, per_file_timeout_min_size_kb, and
config_file_size_threshold_kb since early in the Rust-pipeline work,
labeled "Pass-through (parse callback)" — but nothing ever read them back
on the Rust side, and Python's parse_file_callback() hardcoded a 20 KB
config threshold and never enforced a timeout at all, despite its own
docstring once claiming one was "applied by the caller via
multiprocessing." A pathological/hanging file could stall a whole parse
batch, and every batch queued behind it, indefinitely.

Adds ParseCallConfig, a Rust #[pyclass] (src/pipeline/parse_call_config.rs)
bundling detect_embedded_sql, per_file_timeout_secs,
per_file_timeout_min_size_kb, config_file_size_threshold_kb, and
parse_thread_pool_size into one object Rust constructs once per
IndexingPipeline.run() and hands to every parse_batch_callback() call —
replacing both the single bool argument and the configure_parse_pool()
module-global workaround from the previous commit, and giving future
per-call config values a home that doesn't require another call-arity
change.

chunkhound/pipeline_bridge.py now honors all of these:
- config_file_size_threshold_kb replaces the hardcoded 20.
- per_file_timeout_secs is actually enforced via _parse_with_timeout(), a
  dedicated killable child process for files at/above
  per_file_timeout_min_size_kb — mirroring
  chunkhound.services.batch_processor's existing per-file-timeout pattern,
  so a hung parse is terminated instead of stalling the pool worker (and
  everything queued behind it).
- parse_thread_pool_size sizes the persistent pool directly from Rust's
  config, closing the gap left by 92de44e's module-global stopgap.

Since ProcessPoolExecutor.map() pickles every argument to send it to a
worker process and the Rust pyclass has no pickle support,
parse_batch_callback() copies the fields it needs into a plain picklable
dataclass (_ParsePoolConfig) before dispatch.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
CHUNKHOUND_USE_RUST resolved to two different defaults for two
different subsystems, even though the design intended one toggle: Rust
file discovery defaulted on whenever chunkhound_native was importable,
while the parse->embed->write pipeline defaulted off unconditionally.
The availability probe existed because chunkhound-native was an
optional dependency; make it required instead, since its "optional"
status was only ever a packaging bootstrap artifact from before the
package existed on PyPI, not an intentional design choice.

With the dependency guaranteed, the _RUST_AVAILABLE try/except probes
in file_patterns.py and pipeline_bridge.py no longer guard a reachable
failure mode, so they're deleted rather than hardcoded to True.

The pipeline's default stays off (opt-in): an A/B test-suite run
showed defaulting it on breaks 41 tests, including a confirmed bug
where the Rust-path branch in IndexingCoordinator.process_directory()
disconnects the DB provider before honoring its own DuckDB-only
fallback check, permanently killing non-DuckDB providers' executors
(LanceDB), plus divergent behavior in disk-usage limits, orphan
cleanup, search pagination, and compaction ordering versus the Python
path. Discovery's default is unaffected by any of that and stays on.

Also adds one INFO log line reporting which backend (rust/python) is
active for discovery and the pipeline, so the now-intentional split is
visible instead of silent.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Adds visible progress feedback for file discovery, HNSW drop/rebuild, and
Rust-pipeline diffing so the UI no longer sits idle during long DB ops, and
quiets httpx/httpcore + duplicate Qwen-detection log noise now that the
progress sink runs at INFO.

Also fixes a real resource leak: threading.local() doesn't persist across
separate Python::with_gil() calls from the same rayon thread, so the embed
path was creating a new provider + event loop per batch instead of per
thread (confirmed empirically: ~795 creations across 4 real OS threads),
which was the source of "Too many open files" during large embedding runs.
Switched to dicts keyed by threading.get_ident(), and bounded the httpx
connection pool explicitly as defense in depth.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…bars

Mirrors the existing chunks/s rate shown for embeddings, for both the
parse and DB-write progress bars, on both the default Python pipeline
and the opt-in Rust pipeline. Fixes a latent bug along the way where
reading a task via the position-indexed progress.tasks list (instead of
the TaskID-keyed progress._tasks dict) silently targeted the wrong task
once store_task is removed on the Rust pipeline path.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ovider

CHUNKHOUND_USE_RUST=1 gated Rust-specific behavior (cleanup skip,
change-detection bypass, provider disconnect) on the env var alone, with no
check that the configured database provider was actually DuckDB. Pointed at
a LanceDB-backed project, this disconnected the live LanceDB connection and
then handed the DuckDB-only Rust IndexingPipeline a db_path it can't use,
silently dropping the indexing run. Now checks isinstance(self._db,
DuckDBProvider) up front and falls back to Python otherwise.

Also adds the design doc's missing test_progress_callback contract test,
pinned to the pipeline's actual 3-arg (phase, current, total) callback
contract (no abort-on-False, as originally spec'd, was ever implemented).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ctive

_cleanup_orphaned_files() was skipped outright whenever CHUNKHOUND_USE_RUST=1,
based on a stale assumption that Python couldn't safely touch the DB around a
Rust-driven run. It executes before Rust's own connection handoff, so self._db
is always live at that point regardless of pipeline. The gap this caused: a
force_reindex=True run under Rust skipped both Rust's own diff (which never
runs on a forced full reindex) and Python's cleanup, so deleted files' rows
persisted forever with no cleanup path at all.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
- rich_output.py: the no-Rich _Shim progress fallback only exposed a
  public `tasks` dict, but _update_speed_field() (added for the
  files/min and writes/min bars) reads Rich's private `_tasks` mapping
  directly. Alias `_tasks` to the same dict so both names work.

- duckdb_provider.py: CREATE UNIQUE INDEX still counts a row deleted
  earlier in the same open transaction as a live duplicate, so
  _executor_ensure_embedding_upsert_contract's dedupe-then-index-create
  sequence hit "Data contains duplicates" even though the delete had
  already run. Split the dedupe delete into its own committed guarded
  mutation before the index-creation mutation begins.

- openai_provider.py: the connection-pool-bounding fix unconditionally
  applied `verify=self._ssl_verify` to the httpx client even when no
  custom base_url was set, letting ssl_verify=False silently disable
  TLS verification against the official OpenAI endpoint. ssl_verify is
  only meant for custom/self-hosted endpoints; force verify=True
  whenever base_url is unset while keeping the connection-pool bound
  for all cases.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Newer DuckDB versions raise "Could not set lock on file ... Conflicting
lock is held" instead of "Unique file handle conflict" when a database
file is already open by another connection. WAL validation was only
matching the older message, so it treated a healthy already-open
database as needing WAL cleanup.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
The Compacting bar previously just said "done" when finished. It now
snapshots the DB file size before and after compaction (via the
write-compact/write-done phase callbacks from the Rust pipeline) and
displays e.g. "17.0MB -> 11.3MB (34% smaller)".

Also includes an idempotency guard on DuckDbHnswBackend::open() to avoid
erroring on re-open under Windows' exclusive file lock.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
The watchman job ran uv sync --locked but never built the Rust extension,
so chunkhound_native.chunkhound_native (the compiled .so) was absent and
pytest collection crashed on any module that transitively imports it.

Add the same Rust toolchain install, cargo/DuckDB caches, and maturin
develop steps that the main tests job already uses.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
The Test collection check step imported chunkhound_native, which
links against libduckdb.dylib via @rpath, but the .so has no
LC_RPATH entries. DYLD_LIBRARY_PATH was only set on the Run tests
step, so pytest --collect-only failed with "Library not loaded:
@rpath/libduckdb.dylib / Reason: no LC_RPATH's found" on macOS.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… resolution

The watchman-runtime-validation job already copies duckdb.dll into
chunkhound_native/ via the maturin develop step, but never makes that
directory findable for the Windows DLL loader when loading from a fresh
venv.  In a fresh venv (e.g. the installed-wheel e2e test), the .pyd
lives in site-packages/chunkhound_native/ with no co-located duckdb.dll,
so the MCP server crashes on import and the initialize request times out.

Add chunkhound_native/ to $GITHUB_PATH on Windows — the direct analogue
of DYLD_LIBRARY_PATH on macOS.  _clean_room_env() passes PATH through, so
the MCP server subprocess inherits the directory and Windows finds duckdb.dll.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
**Bug fixed (Bug 1):** The `hasattr(self._db, "db_path")` guard was placed
*after* the cleanup gate, creating a window where `_use_rust=True` caused
Python to skip `_cleanup_orphaned_files()`, but Rust was then also disabled —
leaving orphaned DB rows permanently. The check is now moved to the early
`_use_rust` gate block alongside the `DuckDBProvider` isinstance check, so
both disqualifying conditions are evaluated before any cleanup decision is made.

**Option D changes:**
- `src/pipeline/pipeline.rs`: force_reindex branch now calls
  `compute_diff_blocking()` to harvest `diff.removed` for orphan deletion
  instead of setting `delete_paths = Vec::new()`. This closes the gap where
  force-reindexing silently kept stale DB rows for deleted files.
- `chunkhound/services/indexing_coordinator.py`: cleanup gate is gated on
  `not _use_rust`; when Rust owns the pipeline, Python's
  `_cleanup_orphaned_files()` is skipped. The redundant late `hasattr` check
  is removed (responsibility moved to the early gate).
- `chunkhound/pipeline_bridge.py`: removed `skip_cleanup: True` from the
  config dict — the flag was never honored by Rust and is now meaningless.
- `src/pipeline/config.rs`: removed the dead `skip_cleanup` field entirely.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ewer

**Fix 1 — _diff_task progress bar leak on empty directory:**
When `_use_rust=True` and `self.progress` is set, `_diff_task` was added to
the Rich display before the `if not files: return` early-exit. The task was
never removed, leaving a stuck "Checking for changes" bar at 0%. Added
`self.progress.remove_task(_diff_task)` before the early return.

**Fix 2 — config.indexing.cleanup=False silently ignored by Rust pipeline:**
`cleanup=False` suppressed Python's `_cleanup_orphaned_files()`, but Rust
always called `compute_diff_blocking()` and deleted orphans regardless.
Threaded `do_cleanup` from the coordinator through `run_rust_pipeline()` →
`PipelineConfig` → `pipeline.rs`. Rust now gates orphan deletion on
`self.config.do_cleanup`: in incremental mode, `diff.removed` is discarded
when false; in force_reindex mode, `compute_diff_blocking()` is skipped
entirely (avoiding the unnecessary DB query).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…paction

Rust's compaction_threshold was hardcoded to 0.30, ignoring the user-facing
--fragmentation-threshold-pct setting that the Python indexing path already
respects (duckdb_provider.py). Now sourced from config.database and
converted from percentage to ratio.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…uild

recreate_hnsw_indexes rebuilt dropped HNSW indexes from duckdb_indexes().sql,
but DuckDB strips the WITH (metric = ...) clause from that DDL text, so any
non-cosine index silently reverted to cosine after a drop/recreate cycle.
Capture the live metric via pragma_hnsw_index_info() instead, mirroring the
existing Python-side _extract_hnsw_metric fix.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Test and others added 22 commits September 3, 2026 14:20
@HananKavitzAmat
HananKavitzAmat added this pull request to the merge queue Sep 8, 2026
Merged via the queue into chunkhound:main with commit 5f9ddfd Sep 8, 2026
23 checks passed
HananKavitzAmat pushed a commit to HananKavitzAmat/chunkhound that referenced this pull request Sep 8, 2026
Merging upstream's _install_native_wheel refactor (chunkhound#380) into
feat/native-embed-providers replaced _patch_locally_built_native_extension
in scripts/verify_watchman_live_indexing_e2e.py, but three tests still
monkeypatched the removed function, causing a consistent AttributeError
on both CI attempts that tripped the flaky-annotation gate.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@ofriw ofriw mentioned this pull request Sep 8, 2026
7 tasks done
HananKavitzAmat added a commit to HananKavitzAmat/chunkhound that referenced this pull request Sep 15, 2026
* fix(ci): add shell: bash to Rust build step for Windows compatibility

Windows runners default to PowerShell, which does not support
bash [[ ]] conditionals.  Explicitly set shell: bash since the
step uses find/cp and platform-detection via $RUNNER_OS.

* feat: Phase 8 — pipeline-parallel parse↔embed overlap via channels

GREEN: implement 3-stage pipeline with per-batch transactions.

Config:
- pipeline_parallel: bool (default false) in PipelineConfig

DbBackend trait (src/db/mod.rs):
- prepare_write(batch)  — delete_paths, pre_delete, embed tables, drop HNSW
- write_batch_incremental(batch) — BEGIN → write_inner → embeddings → COMMIT
- finish_write() — recreate HNSW indexes + CHECKPOINT
- write_batch refactored on top of these primitives

DuckDbHnswBackend (src/db/duckdb_backend.rs):
- pending_hnsw_indexes + pending_new_dims carry state between pipeline phases
- write_batch() = prepare_write → write_batch_incremental → finish_write

Pipeline (src/pipeline/pipeline.rs):
- pipeline_parse_and_embed() — parse thread produces parsed batches via
  channel; main thread receives and embeds them while parse works on next
- parse↔embed overlap when pipeline_parallel && parse_thread_pool_size > 1
- GIL: caller releases via py.allow_threads(); threads re-acquire via
  Python::with_gil()

RED tests (tests/contracts/test_pipeline_parallel.py):
- test_pipeline_parallel_identical_output
- test_pipeline_parallel_incremental

All 39 tests pass (13 contract + 26 DB writer).

* fix: pass provider+model to embed_callback + add pipeline phase timing logs

- Sequential embed fallback now passes (texts, provider, model) to match
  production embed_callback signature (was: just (texts,)).
- Mock embed_texts() updated to accept optional provider/model params.
- Added log::info! timing for parse, embed, parse+embed, write, and total.
  Emits via pyo3-log → Python logging at INFO level.

Profiling results (200 files, 1400 chunks):
  Sequential: parse 1.97s, embed 3.08s, write 8.15s → 13.23s
  Parallel:   parse+embed 3.75s, write 6.51s → 10.27s (22% faster)
  Write still dominates at ~63% in both modes.

* feat: stream pipeline progress via callback (parse → embed → write phases)

Rust pipeline now calls progress_callback(phase, current, total) at each
phase boundary.  Coordinator wires Rich Progress bars so the Rust path
shows live progress bars instead of a frozen 0/33 counter.

Phases emitted: parse, embed, write, done.
Coordinator maps them to Rich Progress tasks:
  parse     → [Parsing files]
  embed     → [Embedding] (created on first embed event)
  write     → [Handling files] (info text update)
  done      → complete all three bars

* fix: skip Python-side HNSW ops when Rust pipeline is active

When CHUNKHOUND_USE_RUST=1, the Rust pipeline handles all HNSW index
lifecycle (drop → write → rebuild) internally via its own DuckDB
connection.  The Python service layer's corresponding steps were:

  _drop_hnsw_indexes()    → ran on Python connection concurrently with
                             Rust pipeline (could conflict)
  _ensure_hnsw_indexes()  → serial_executor timeout on large tables
                             (38K+ vectors)

Both are now gated on _rust_pipeline_active().

Also added SET threads=8 before HNSW build to speed up index creation.

* fix: bridge Rust pipeline logs (pyo3-log) into loguru for progress visibility

Rust log::info! goes through pyo3-log → Python stdlib logging.
ChunkHound uses loguru, so those messages were silently discarded.
Now setup_logging() installs an intercept handler forwarding stdlib
logging records into loguru.  Rust pipeline messages
(chunkhound_native.*) are forwarded at WARNING level so they appear
without --verbose.

Also: skip Python HNSW ops when Rust pipeline is active — Rust
pipeline handles all HNSW lifecycle on its own DuckDB connection.

* fix: upgrade Python DuckDB 1.4.4→1.5.4 to match Rust duckdb-rs v1.10504

Rust duckdb-rs v1.10504.0 = DuckDB 1.5.4 (format: 1.MAJOR.MINOR.PATCH.x)
Python was still on 1.4.4, causing binary storage format incompatibility.
Both now link against DuckDB 1.5.4 (source ID 08e34c447b).

Also: bridge Rust pipeline logs (pyo3-log → loguru) for progress
visibility, and skip Python-side HNSW ops when Rust pipeline is active.

* fix: load VSS on compaction connection + fix progress display

- HNSW compaction crash: import_conn in run_export_import_compaction
  was opened without loading the VSS extension.  Subsequent HNSW index
  rebuild failed with 'unknown index type HNSW'.  Load VSS on the
  temporary compaction connection before IMPORT DATABASE.

- Progress bar fix 1: embedding completion showed total_files (930)
  instead of total_embeds (39001) because the final embed phase
  progress emission used the wrong count.  Move total_embeds
  declaration outside the parsed block so the correct count reaches
  the emit_progress call.

- Progress bar fix 2: the write-phase progress bar stayed at 0/930
  because the handler only set info text, never updated completed.
  Since the DB write is a single atomic operation, fill the bar
  immediately when the phase starts.

* perf: ATTACH+INSERT SELECT compaction, embed speed, progress sub-phases

Rust compaction: replace EXPORT/IMPORT Parquet round-trip with in-process
ATTACH + INSERT SELECT (matching Python approach).  Drops ~2× throughput
penalty from Parquet serialization/deserialization.

Compaction thresholds: align Rust pipeline with Python defaults
(threshold 0.30, batch 50, min 50MB) to trigger at same cadence.

Progress bars: split write phase into sub-phases (prepare, data, index,
compact) with individual bars and wall clocks.  Embed bar now shows
embeddings/s rate matching standalone Python path.

Fix DuckDB lock conflict during compaction: close Python-side connection
in write-compact callback before Rust renames the DB file.  Must happen
after parse workers exit — early close crashes forked ProcessPoolExecutor
children.

Remove duplicate HNSW rebuild: finish_write() already rebuilds; skip
explicit recreation in compaction.  reopen() safety net catches loss.

* refactor: move MCP subprocess smoke tests to tests/mcp/

MCP startup tests that spawn real subprocesses are inherently slower
and more environment-sensitive than import/CLI-help checks.  Move
them to tests/mcp/test_smoke.py so tests/test_smoke.py remains a
fast, reliable guardrail::

    uv run pytest tests/test_smoke.py -v   # fast, reliable
    uv run pytest tests/mcp/ -v            # when MCP code changes

* perf: parallel batch embedding via rayon thread pool

Adds embed_batch_callback for concurrent embedding requests across
rayon threads (thread-local providers avoid shared httpx client hangs
across event loops), configurable via embed_thread_pool_size/batch_size.
Surfaces embeddings_generated through coordinator stats, and cleans up
progress-bar sub-phase handling (store_task removed in favor of Rust
write sub-phase bars, DuckDB connection closed at write-prepare).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: Rust pipeline DB corruption on reopen + no-progress-shim crash

The Rust pipeline could not survive a process restart: reindexing an
already-indexed directory crashed with `SerializationException: Failed to
deserialize: field id mismatch` on the very next `chunkhound index`
invocation. Root cause: indexing_coordinator.py's "write-prepare" progress
callback only closed DuckDBConnectionManager's connection, leaving
SerialExecutor's own thread-local connection (used for schema/discovery
queries) alive in the background. Rust then opened a third connection to
the same file while that second Python connection was still live in-process,
corrupting the DB. Fixed by calling the provider's full disconnect(), which
tears down both connections and shuts down the executor thread.

Also fixes a crash hit while diagnosing the above: the headless progress
_Shim (rich_output.py) didn't implement remove_task/reset, which the Rust
pipeline's progress wiring calls — any non-interactive CHUNKHOUND_USE_RUST=1
run crashed immediately.

Adds:
- tests/contracts/test_reopen_after_close.py — regression test reproducing
  the reopen crash via two real CLI invocations in separate processes.
- scripts/bench_pipeline.py — Rust vs Python indexing benchmark harness
  (cold/warm/incremental scenarios), per docs/rust-pipeline-architecture.html §13.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: close Python DuckDB connection before Rust pipeline starts, not at write-prepare

The Rust pipeline's compute_diff_blocking() opens its own independent
DuckDB connection as the very first step of run() -- before parsing
even begins -- but the coordinator wasn't disconnecting the Python-side
connection until the much later "write-prepare" progress callback.
That left two live, non-read-only connections to the same DB file
during the entire discovery/diff/parse/embed phase, causing lock
conflicts and silent on-disk corruption that only surfaced later as
"Serialization Error: Failed to deserialize: field id mismatch" when a
fresh process reopened the DB. Root-caused via bisection back to
7eb55df9 (Phase 6, when the Rust pipeline was first wired into
IndexingCoordinator) -- reproduces deterministically indexing a real
multi-file repo, not just the tiny test fixtures.

Move the disconnect to fire immediately before run_rust_pipeline() is
called instead. This is safe because parse_batch_callback's
ProcessPoolExecutor (whose fork'd children inherit whatever DuckDB
state is live at fork time) isn't created until Rust's parse phase,
well after this point -- so no forked child ever inherits a live
connection. Drop the now-redundant disconnect at write-prepare.

Verified: indexing the chunkhound package itself (370 files) and
reopening the DB in a fresh connection now succeeds 4/4 runs (was
failing 4/4 before). tests/contracts/ + test_smoke.py (28/28),
test_rust_db_writer.py + test_duckdb_compaction.py +
test_parallel_discovery.py (155/155) all pass.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* feat: enable true 3-stage streaming pipeline (parse ∥ embed ∥ store), fix progress bars

Wires pipeline_parallel: true into pipeline_bridge.py's config dict, activating
the streaming pipeline (pipeline_parse_embed_store) that was previously
implemented but unreachable in production. This closes the "no true 3-stage
pipeline" gap against the design doc: parse, embed, and store now genuinely
overlap across batches instead of running store as a single blocking phase
after all parsing/embedding completes. Verified ~13% wall-clock speedup on a
370-file repo (2 batches), with logged evidence of real thread overlap.

Adds per-batch [parse]/[embed]/[store] debug-level timing instrumentation to
pipeline.rs (visible via --verbose) so overlap can be directly observed in
logs, not just inferred.

Fixes three progress-bar regressions the above change exposed/introduced:

1. "Parsing files" bar was frozen for the entire run (only updated at 0% and
   100%) while "Writing data" ran concurrently -- now reports real per-batch
   file counts throughout.
2. "Embedding" bar was structurally broken (embed_batch_parallel was passed
   `None` for its progress callback) -- now reports per-batch progress against
   a live-refining estimated chunk total (exact chunk count isn't known
   upfront in a pipelined design; the estimate converges to the exact count on
   the final batch).
3. "Writing data" bar showed a stale count (e.g. "1/5") at completion --
   caused by `_pr.tasks[task_id]`, which is a list indexed by *position*, not
   a mapping keyed by TaskID; removing store_task earlier shifts list
   positions out of sync with TaskIDs. Replaced with tracked nonlocal totals
   instead of querying `_pr.tasks[...]`. A pre-existing instance of the same
   bug in the "done" handler (corrupting the embed bar's final re-sync) was
   also removed as redundant, since both "parse" and "embed" already receive
   an exact final (total, total) call in both pipeline paths.
4. First-batch embed speed showed a nonsensical figure (orders of magnitude
   too high) -- the streaming path had no early "embed" (0, 0) call to anchor
   the speed-tracking clock before batch 0's embedding began, so the first
   real reading divided a full batch's chunk count by a near-zero elapsed
   time. Added the missing early call (mirroring "parse"'s existing pattern)
   and a defensive 0.05s minimum-elapsed floor on the Python side.

All fixes verified via make rust-check, make rust-test, the full contract
test suite (test_pipeline_parallel, test_identical_chunks,
test_incremental_updates, test_parallel_embed, test_parallel_parse,
test_identical_embeddings), test_smoke.py, and live end-to-end runs through
the real indexing_coordinator progress callback (mocked embeddings, real
Rich Progress instance) confirming correct bar behavior and speed values.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: reset DuckDB thread count after HNSW index build to avoid embed contention

ensure_all_hnsw_indexes() left the connection at `SET threads = 8` for its
entire remaining lifetime — set during open()'s crash-recovery check and
never reset. Once the streaming pipeline made the store and embed threads
run concurrently, DuckDB's 8-thread writes/checkpoints competed with the
embed thread's rayon pool for cores on this 12-core machine, exactly
saturating it (8 + 4) and causing a real ~25-33% throughput regression.

Resetting to `threads = 1` after any index build (the connection may still
be mid-run with a concurrent embed thread active) recovered real-world
throughput from ~300 to ~380 chunks/s on a full-repo run against a real
embedding server, close to the ~400 chunks/s pre-regression baseline.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* feat: finalize always-on 3-stage streaming pipeline, add failure-mode contract tests

Removes the now-dead single-item parse/embed callback API and the
`pipeline_parallel` config flag now that parse ∥ embed ∥ store streaming is
always on, fixes thread-local event-loop reuse in the embed rayon pool
(prevents hangs when max_concurrent_batches >= 4), auto-detects embed
concurrency from the provider, and fixes progress-bar phase handling for the
compaction/HNSW-rebuild mutual exclusion. Supersedes test_parallel_embed.py
and test_parallel_parse.py with test_pipeline_parallel.py, and adds
test_compaction_before_index.py as a regression test for the HNSW
double-build bug that motivated the progress-bar fix.

Also fixes IndexingPipeline::run() returning early on an empty file list
without touching the DB — re-indexing a directory that's gone from "has
files" to empty never deleted the now-orphaned rows. An empty file list now
flows through the incremental diff + streaming pipeline, and the embed
thread flushes any delete_paths that no batch ever carried.

Adds three of the design doc's missing failure-mode contract tests:
test_empty_directory, test_embed_api_failure (already-correct behavior,
just untested), and test_db_write_failure (fail-fast case; per-batch
rollback already exists in duckdb_backend.rs).

Ignore .pi/ (local task-tracking tool metadata, not project source).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: don't abort the whole indexing run when one file fails to parse

Previously, an exception from parser.parse_file() for a single file
propagated through ProcessPoolExecutor.map() and aborted the entire batch
call; in the Rust pipeline that surfaced as a fatal error on the shared
error mutex, killing the whole run over one bad file.

_parse_one_file() now catches per-file exceptions and returns a 3-tuple
(language, chunks, error) instead of raising. parse_one_batch() in
pipeline.rs reads the new optional error element (backward compatible with
2-tuple-returning callbacks) and records it on ParsedFile.error. Per-file
errors are collected across the run and now populate
PipelineReport.errors, which was previously hardcoded to always be empty.

Closes gap #27 (test_parse_error_per_file) from the rust-pipeline-architecture
design doc gap analysis.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: content-hash fallback for mtime-only diffing in Rust pipeline

Touching a file's mtime without changing its bytes (git checkout, CI
artifact restore, container rebuild) previously forced a full re-embed
and chunk rewrite in the Rust indexing pipeline, since compute_diff()
only compared mtimes. Add a content-hash check during the existing
upfront DB-snapshot diff phase: touch-only files are now confirmed
unchanged and skipped before ever reaching parse/embed/store, while
genuinely changed/new files pay one extra Rust-side hash read (bounded,
justified) instead of the double-read a Python-side hash would cause.

Hash computed via xxhash-rust (xxh3), verified byte-identical to
Python's xxhash.xxh3_64().hexdigest() via a golden cross-language test.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: reuse a persistent parse worker pool instead of one per batch

parse_batch_callback() previously spun up and tore down a fresh
ProcessPoolExecutor on every Rust parse batch (~50 times over a
10K-file index at 200 files/batch), paying process-spawn cost far more
often than necessary. The pool is now a lazy, process-wide singleton
(_get_parse_pool()), created once and reused across every batch and
every pipeline run in the process, with atexit-registered shutdown.

Also adds a regression test pinning down the batch-shaped callback
contract: output must be identical regardless of how a run is chopped
into parse_batch_callback() calls, protecting the shared pool against
silently leaking state across batches.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: restore parse worker pool count after persistent-pool refactor

_get_parse_pool() sized the persistent pool to min(os.cpu_count(), 16),
silently shrinking parallelism on any machine with fewer than 16 cores
compared to the old per-batch min(files_in_batch, 16) sizing (a flat 16
for the production parse_batch_size of 200). Rust's config dict already
computed and shipped a "parse_thread_pool_size" value for this exact
purpose, but nothing ever read it back on the Python side.

configure_parse_pool() lets run_rust_pipeline() set the pool size before
the pipeline starts, so that previously-dead config value now actually
controls the pool _get_parse_pool() creates.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* feat: pass parse-callback config through Rust as a typed object

parse_batch_callback() used to receive only detect_embedded_sql as a bare
positional bool. PipelineConfig (src/pipeline/config.rs) has carried
per_file_timeout_secs, per_file_timeout_min_size_kb, and
config_file_size_threshold_kb since early in the Rust-pipeline work,
labeled "Pass-through (parse callback)" — but nothing ever read them back
on the Rust side, and Python's parse_file_callback() hardcoded a 20 KB
config threshold and never enforced a timeout at all, despite its own
docstring once claiming one was "applied by the caller via
multiprocessing." A pathological/hanging file could stall a whole parse
batch, and every batch queued behind it, indefinitely.

Adds ParseCallConfig, a Rust #[pyclass] (src/pipeline/parse_call_config.rs)
bundling detect_embedded_sql, per_file_timeout_secs,
per_file_timeout_min_size_kb, config_file_size_threshold_kb, and
parse_thread_pool_size into one object Rust constructs once per
IndexingPipeline.run() and hands to every parse_batch_callback() call —
replacing both the single bool argument and the configure_parse_pool()
module-global workaround from the previous commit, and giving future
per-call config values a home that doesn't require another call-arity
change.

chunkhound/pipeline_bridge.py now honors all of these:
- config_file_size_threshold_kb replaces the hardcoded 20.
- per_file_timeout_secs is actually enforced via _parse_with_timeout(), a
  dedicated killable child process for files at/above
  per_file_timeout_min_size_kb — mirroring
  chunkhound.services.batch_processor's existing per-file-timeout pattern,
  so a hung parse is terminated instead of stalling the pool worker (and
  everything queued behind it).
- parse_thread_pool_size sizes the persistent pool directly from Rust's
  config, closing the gap left by 92de44e6's module-global stopgap.

Since ProcessPoolExecutor.map() pickles every argument to send it to a
worker process and the Rust pyclass has no pickle support,
parse_batch_callback() copies the fields it needs into a plain picklable
dataclass (_ParsePoolConfig) before dispatch.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: make chunkhound-native required, remove dead availability checks

CHUNKHOUND_USE_RUST resolved to two different defaults for two
different subsystems, even though the design intended one toggle: Rust
file discovery defaulted on whenever chunkhound_native was importable,
while the parse->embed->write pipeline defaulted off unconditionally.
The availability probe existed because chunkhound-native was an
optional dependency; make it required instead, since its "optional"
status was only ever a packaging bootstrap artifact from before the
package existed on PyPI, not an intentional design choice.

With the dependency guaranteed, the _RUST_AVAILABLE try/except probes
in file_patterns.py and pipeline_bridge.py no longer guard a reachable
failure mode, so they're deleted rather than hardcoded to True.

The pipeline's default stays off (opt-in): an A/B test-suite run
showed defaulting it on breaks 41 tests, including a confirmed bug
where the Rust-path branch in IndexingCoordinator.process_directory()
disconnects the DB provider before honoring its own DuckDB-only
fallback check, permanently killing non-DuckDB providers' executors
(LanceDB), plus divergent behavior in disk-usage limits, orphan
cleanup, search pagination, and compaction ordering versus the Python
path. Discovery's default is unaffected by any of that and stays on.

Also adds one INFO log line reporting which backend (rust/python) is
active for discovery and the pipeline, so the now-intentional split is
visible instead of silent.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: close progress-bar silent gaps and a thread-local resource leak

Adds visible progress feedback for file discovery, HNSW drop/rebuild, and
Rust-pipeline diffing so the UI no longer sits idle during long DB ops, and
quiets httpx/httpcore + duplicate Qwen-detection log noise now that the
progress sink runs at INFO.

Also fixes a real resource leak: threading.local() doesn't persist across
separate Python::with_gil() calls from the same rayon thread, so the embed
path was creating a new provider + event loop per batch instead of per
thread (confirmed empirically: ~795 creations across 4 real OS threads),
which was the source of "Too many open files" during large embedding runs.
Switched to dicts keyed by threading.get_ident(), and bounded the httpx
connection pool explicitly as defense in depth.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* feat: add files/min and writes/min rate display to indexing progress bars

Mirrors the existing chunks/s rate shown for embeddings, for both the
parse and DB-write progress bars, on both the default Python pipeline
and the opt-in Rust pipeline. Fixes a latent bug along the way where
reading a task via the position-indexed progress.tasks list (instead of
the TaskID-keyed progress._tasks dict) silently targeted the wrong task
once store_task is removed on the Rust pipeline path.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: fall back to Python path when Rust pipeline hits a non-DuckDB provider

CHUNKHOUND_USE_RUST=1 gated Rust-specific behavior (cleanup skip,
change-detection bypass, provider disconnect) on the env var alone, with no
check that the configured database provider was actually DuckDB. Pointed at
a LanceDB-backed project, this disconnected the live LanceDB connection and
then handed the DuckDB-only Rust IndexingPipeline a db_path it can't use,
silently dropping the indexing run. Now checks isinstance(self._db,
DuckDBProvider) up front and falls back to Python otherwise.

Also adds the design doc's missing test_progress_callback contract test,
pinned to the pipeline's actual 3-arg (phase, current, total) callback
contract (no abort-on-False, as originally spec'd, was ever implemented).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: run orphan cleanup unconditionally, even when Rust pipeline is active

_cleanup_orphaned_files() was skipped outright whenever CHUNKHOUND_USE_RUST=1,
based on a stale assumption that Python couldn't safely touch the DB around a
Rust-driven run. It executes before Rust's own connection handoff, so self._db
is always live at that point regardless of pipeline. The gap this caused: a
force_reindex=True run under Rust skipped both Rust's own diff (which never
runs on a forced full reindex) and Python's cleanup, so deleted files' rows
persisted forever with no cleanup path at all.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: three CI failures in progress shim, embedding dedup, and TLS verify

- rich_output.py: the no-Rich _Shim progress fallback only exposed a
  public `tasks` dict, but _update_speed_field() (added for the
  files/min and writes/min bars) reads Rich's private `_tasks` mapping
  directly. Alias `_tasks` to the same dict so both names work.

- duckdb_provider.py: CREATE UNIQUE INDEX still counts a row deleted
  earlier in the same open transaction as a live duplicate, so
  _executor_ensure_embedding_upsert_contract's dedupe-then-index-create
  sequence hit "Data contains duplicates" even though the delete had
  already run. Split the dedupe delete into its own committed guarded
  mutation before the index-creation mutation begins.

- openai_provider.py: the connection-pool-bounding fix unconditionally
  applied `verify=self._ssl_verify` to the httpx client even when no
  custom base_url was set, letting ssl_verify=False silently disable
  TLS verification against the official OpenAI endpoint. ssl_verify is
  only meant for custom/self-hosted endpoints; force verify=True
  whenever base_url is unset while keeping the connection-pool bound
  for all cases.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: recognize newer DuckDB lock-conflict message during WAL validation

Newer DuckDB versions raise "Could not set lock on file ... Conflicting
lock is held" instead of "Unique file handle conflict" when a database
file is already open by another connection. WAL validation was only
matching the older message, so it treated a healthy already-open
database as needing WAL cleanup.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* feat: show DB size reduction in the compaction progress bar

The Compacting bar previously just said "done" when finished. It now
snapshots the DB file size before and after compaction (via the
write-compact/write-done phase callbacks from the Rust pipeline) and
displays e.g. "17.0MB -> 11.3MB (34% smaller)".

Also includes an idempotency guard on DuckDbHnswBackend::open() to avoid
erroring on re-open under Windows' exclusive file lock.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: build chunkhound_native in watchman-runtime-validation CI job

The watchman job ran uv sync --locked but never built the Rust extension,
so chunkhound_native.chunkhound_native (the compiled .so) was absent and
pytest collection crashed on any module that transitively imports it.

Add the same Rust toolchain install, cargo/DuckDB caches, and maturin
develop steps that the main tests job already uses.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix: set DYLD_LIBRARY_PATH on macOS test collection check step

The Test collection check step imported chunkhound_native, which
links against libduckdb.dylib via @rpath, but the .so has no
LC_RPATH entries. DYLD_LIBRARY_PATH was only set on the Run tests
step, so pytest --collect-only failed with "Library not loaded:
@rpath/libduckdb.dylib / Reason: no LC_RPATH's found" on macOS.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix: add chunkhound_native to PATH on Windows for installed-wheel DLL resolution

The watchman-runtime-validation job already copies duckdb.dll into
chunkhound_native/ via the maturin develop step, but never makes that
directory findable for the Windows DLL loader when loading from a fresh
venv.  In a fresh venv (e.g. the installed-wheel e2e test), the .pyd
lives in site-packages/chunkhound_native/ with no co-located duckdb.dll,
so the MCP server crashes on import and the initialize request times out.

Add chunkhound_native/ to $GITHUB_PATH on Windows — the direct analogue
of DYLD_LIBRARY_PATH on macOS.  _clean_room_env() passes PATH through, so
the MCP server subprocess inherits the directory and Windows finds duckdb.dll.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): make Rust the sole owner of orphan cleanup (Option D)

**Bug fixed (Bug 1):** The `hasattr(self._db, "db_path")` guard was placed
*after* the cleanup gate, creating a window where `_use_rust=True` caused
Python to skip `_cleanup_orphaned_files()`, but Rust was then also disabled —
leaving orphaned DB rows permanently. The check is now moved to the early
`_use_rust` gate block alongside the `DuckDBProvider` isinstance check, so
both disqualifying conditions are evaluated before any cleanup decision is made.

**Option D changes:**
- `src/pipeline/pipeline.rs`: force_reindex branch now calls
  `compute_diff_blocking()` to harvest `diff.removed` for orphan deletion
  instead of setting `delete_paths = Vec::new()`. This closes the gap where
  force-reindexing silently kept stale DB rows for deleted files.
- `chunkhound/services/indexing_coordinator.py`: cleanup gate is gated on
  `not _use_rust`; when Rust owns the pipeline, Python's
  `_cleanup_orphaned_files()` is skipped. The redundant late `hasattr` check
  is removed (responsibility moved to the early gate).
- `chunkhound/pipeline_bridge.py`: removed `skip_cleanup: True` from the
  config dict — the flag was never honored by Rust and is now meaningless.
- `src/pipeline/config.rs`: removed the dead `skip_cleanup` field entirely.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): address two post-review gaps found by independent reviewer

**Fix 1 — _diff_task progress bar leak on empty directory:**
When `_use_rust=True` and `self.progress` is set, `_diff_task` was added to
the Rich display before the `if not files: return` early-exit. The task was
never removed, leaving a stuck "Checking for changes" bar at 0%. Added
`self.progress.remove_task(_diff_task)` before the early return.

**Fix 2 — config.indexing.cleanup=False silently ignored by Rust pipeline:**
`cleanup=False` suppressed Python's `_cleanup_orphaned_files()`, but Rust
always called `compute_diff_blocking()` and deleted orphans regardless.
Threaded `do_cleanup` from the coordinator through `run_rust_pipeline()` →
`PipelineConfig` → `pipeline.rs`. Rust now gates orphan deletion on
`self.config.do_cleanup`: in incremental mode, `diff.removed` is discarded
when false; in force_reindex mode, `compute_diff_blocking()` is skipped
entirely (avoiding the unnecessary DB query).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): honor fragmentation_threshold_pct in Rust pipeline compaction

Rust's compaction_threshold was hardcoded to 0.30, ignoring the user-facing
--fragmentation-threshold-pct setting that the Python indexing path already
respects (duckdb_provider.py). Now sourced from config.database and
converted from percentage to ratio.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): preserve non-cosine HNSW metric through Rust index rebuild

recreate_hnsw_indexes rebuilt dropped HNSW indexes from duckdb_indexes().sql,
but DuckDB strips the WITH (metric = ...) clause from that DDL text, so any
non-cosine index silently reverted to cosine after a drop/recreate cycle.
Capture the live metric via pragma_hnsw_index_info() instead, mirroring the
existing Python-side _extract_hnsw_metric fix.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(indexing): correct compaction progress label when DB file grows

The label always said "smaller" regardless of the sign of the
before/after percentage, producing nonsensical output like
"8.4GB → 11.8GB (-40% smaller)" when compaction increased file size.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* perf(db): eliminate per-batch catalog scans by deriving emb_tables from known_dims

delete_paths and pre_delete_for_upsert were calling discover_embedding_tables()
on every batch, scanning information_schema.tables each time to find embeddings_N
tables. The table name is fully deterministic from the dimension value, and the
set of known dimensions is already maintained in self.known_dims (populated at
open() and kept current in prepare_write). Pass known_dims to both functions so
they derive the table list from memory instead of the catalog.

Also replace the catalog scan in ensure_all_hnsw_indexes with self.known_dims
iteration, eliminating one additional scan per run.

The two remaining discover_embedding_tables calls in open() and reopen() are
intentional: they seed known_dims from disk at session start.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(db): preserve non-cosine HNSW metric through bulk-mode drop and post-compaction rebuild

ensure_all_hnsw_indexes() hardcoded 'cosine' when recreating indexes after a
pipeline run (bulk mode) or after compaction, silently replacing any l2sq/ip
index the user had created.

Fix: drop_all_hnsw_indexes() now saves the discovered metrics into
saved_hnsw_metrics: HashMap<u32, String> before dropping the indexes.
ensure_all_hnsw_indexes() looks up the per-dims metric from that map and
falls back to 'cosine' only for dimension tables that had no prior index.

Adds a test covering the drop→ensure round-trip that verifies the metric
is preserved end-to-end, complementing the existing recreate_hnsw_indexes
test.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(db): remove no-op temp-table DELETEs and eliminate catalog scans in compaction_stats

Item 2: rust_temp_chunks and rust_temp_emb_{dims} are both DROP'd at the end
of every call, so the CREATE TABLE IF NOT EXISTS at the top always produces an
empty table. The DELETE immediately after CREATE was always a no-op — removed.

Item 3: compaction_stats() called discover_embedding_tables() twice (once for
live_embeddings, once for stored_embeddings), each scanning
information_schema.tables. known_dims is authoritative at this point; table
names are deterministic from dims. Both catalog scans replaced with iteration
over self.known_dims — same fix already applied to delete_paths and
pre_delete_for_upsert.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(pipeline): eliminate per-file SELECT in upsert_file by threading IDs from diff phase

On a 50k-file repo, every incremental index run issues one SELECT per file
in upsert_file (even on fresh index where all SELECTs return None). The diff
phase already queries the DB for all file paths+mtimes but discarded the id
column. Thread the id through DiffResult.existing_ids → FileRecord.existing_file_id
so upsert_file can skip the SELECT and go straight to UPDATE for changed files.

Also activates the pre_delete_for_upsert by_id fast path (direct id match
instead of nested path subquery) for the same set of changed files.

Non-incremental runs produce an empty existing_ids map → upsert_file falls
through to the existing SELECT-then-UPDATE-or-INSERT slow path, which is
correct (the old data may have been deleted and re-inserted).

New tests: test_upsert_file_with_known_id_skips_insert (Rust),
test_mtime_change_detected carries existing_ids assertion (expanded),
test_compute_diff_no_id_for_new_files (new Rust differ test),
test_upsert_replaces_chunks_on_update asserts returned file_id == original fid (expanded).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(pipeline): collapse three stat passes into one via precomputed_stats

Incremental indexing called std::fs::metadata on every file three times:
Pass 1 (compute_diff_blocking, all files, mtime only — TZ-offset),
Pass 2 (compute_diff, all files, mtime only — change detection), and
Pass 3 (parse_one_batch, changed files, mtime+size — ParsedFile fields).
For 10k files with 1k changed that was 21k syscalls; now it is 10k.

collect HashMap<PathBuf,(u64,f64)> once in compute_diff_blocking, pass it
into compute_diff (eliminating Pass 2), carry the changed-file subset in
DiffResult.disk_stats, and thread it into parse_one_batch (eliminating
Pass 3). A fallback stat call is retained in each stage so the
non-incremental and test paths are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(db): remove per-batch CHECKPOINT from write_batch_incremental

The Python indexing path commits with force_checkpoint=False and relies
on DuckDB's 1 GB WAL auto-checkpoint plus an explicit CHECKPOINT at
disconnect. The Rust path was issuing an additional CHECKPOINT after
every single batch commit, producing N+1 flushes for N batches where
the Python path produces 1.

Remove the per-batch CHECKPOINT. close() at line 1219 already issues
CHECKPOINT before dropping the connection — identical to Python's
_executor_disconnect() pattern. DuckDB readers see committed WAL data
without a CHECKPOINT, so visibility is unaffected.

For 100 batches: 101 flushes → 1 (99% reduction).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(db): use saved_hnsw_metrics in finish_write pending_new_dims path

When drop_all_hnsw_indexes() enters bulk mode it saves each dim's HNSW
metric into saved_hnsw_metrics before dropping the indexes. The
pending_new_dims path in finish_write was ignoring that map and
hardcoding 'cosine' — so a dim that previously used l2sq (or ip) would
get recreated with cosine, and the subsequent ensure_all_hnsw_indexes
call in close() could not fix it because CREATE INDEX IF NOT EXISTS is
a no-op on the already-wrong index.

Replace the hardcoded 'cosine' with
saved_hnsw_metrics.get(&dims).unwrap_or("cosine"), matching the
pattern already used in ensure_all_hnsw_indexes and recreate_hnsw_indexes.

New test test_finish_write_new_dims_uses_saved_hnsw_metric exercises
the exact bulk-mode path: creates an l2sq HNSW, enters bulk mode, writes
a batch, asserts the recreated index uses l2sq not cosine.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(db): raise WAL auto-checkpoint threshold to 1 GiB in Rust open()

DuckDB's default checkpoint_threshold is ~16 MB, causing frequent WAL
flushes during indexing.  Setting it to 1 GiB on the writer connection
matches the intended write pattern: accumulate in WAL, flush once at
close() via the explicit CHECKPOINT.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* revert: remove checkpoint_threshold pragma from open()

DuckDB auto-checkpoints after every COMMIT when no other transactions
are active — checkpoint_threshold only throttles size-based triggers
and has no effect on this per-COMMIT behavior. The pragma was adding
complexity with no measurable benefit.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* chore(pipeline): remove stale design-era dead code and fix config key typo

Drop three unused types from types.rs (DiffResult, EmbeddedBatch,
DbFileState) that matched the original design's channel types but were
superseded by differ::DiffResult and DbWriterBatch in the actual
implementation. Delete state.rs (PipelineState) — pipeline.rs never
imported it, building PipelineReport directly from StoreOutcome instead.

Fix 12 contract-test config dicts that passed "skip_cleanup": False
(unrecognized key, silently ignored) instead of "do_cleanup": True
(the key config.rs actually reads at line 67).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(db): collapse double batch traversal in prepare_write into one pass

count_total_embeddings and collect_unique_dims both iterated the same
batch.files → chunks → embedding chain. Replace with a single
collect_dims_and_count that returns (HashSet<u32>, usize) in one loop.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): wire indexing.max_concurrent to Rust parse thread pool size

parse_thread_pool_size was hardcoded to min(cpu_count, 16); it now reads
indexing_cfg.max_concurrent when set, falling back to the CPU formula only
when the value is absent or zero.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(instrumentation): add per-batch store timing and silence HTTP log noise

Split the store stage's monolithic timer into three sub-timers (prep_ms,
write_ms, commit+checkpoint ms) and log DB/WAL file sizes per batch, making
checkpoint-driven slowdown directly observable in --verbose output.

Silence httpx/httpcore/openai loggers unconditionally so their per-request
DEBUG spam no longer drowns the Rust pipeline's timing lines under --verbose.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(db): batch store commits every 10 batches to reduce checkpoint frequency

DuckDB auto-checkpoints synchronously on COMMIT when WAL exceeds ~16 MB, and
checkpoint cost grows with DB file size. With one COMMIT per batch this caused
monotonic throughput degradation confirmed by instrumentation.

Adds write_batches_in_one_txn() to DbBackend: the store stage now buffers 10
batches, runs prepare_write() for each in auto-commit mode (preserving FK and
nested-BEGIN invariants), then writes all 10 in a single transaction. One
COMMIT per window = one checkpoint opportunity instead of one per batch.

The Python-callable RustDbWriter path is unchanged (default trait impl calls
write_batch_incremental per batch).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(db): eliminate temp-table DDL from insert functions to fix multi-batch transaction performance

CREATE/DROP TEMPORARY TABLE inside an explicit transaction caused DuckDB
to treat each DDL as an implicit checkpoint boundary, silently splitting
the 10-batch window into 10 per-batch commits — identical overhead to the
old approach. Replace with direct INSERT INTO ... VALUES ... RETURNING id
(for chunks) and INSERT INTO ... VALUES ... ON CONFLICT DO UPDATE (for
embeddings), eliminating all DDL from within transactions.

Also emit write-data progress after each prepare_write during window
accumulation so writes/min stays live instead of spiking at window end.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(db): remove write_batches_in_one_txn override to fix FK violation

The 10-batch transaction override caused a foreign key constraint error:
delete_paths Phase 1 (DELETE chunks, COMMIT) ran inside or adjacent to the
multi-batch transaction, making the COMMIT a no-op nested commit. Phase 2
(DELETE files) then failed because chunk rows still referenced file_id.

Removing the override reverts to the trait default: write_batch_incremental
per batch, each in its own BEGIN-COMMIT. This preserves the DDL-free INSERT
changes from af5c3bf3 (no temp table overhead) while restoring FK safety.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): wire index_unknown_files and disk_usage_limit_mb to Rust path

index_unknown_files was silently ignored on the Rust pipeline — parse_file_callback
returned ("", []) for UNKNOWN-extension files regardless of the flag. Now the flag
flows through _ParsePoolConfig (via a run_rust_pipeline closure) and the UNKNOWN
branch is treated as Language.TEXT, matching the Python batch_processor path.

disk_usage_limit_mb (database_cfg.max_disk_usage_mb) was also never forwarded to
Rust's PipelineConfig; added to config_dict so Rust enforces the disk cap.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(db): defer WAL checkpoints to fix store-stage degradation

The Rust store stage degraded monotonically on large indexes. Isolated the
cause with per-batch instrumentation on a 5k-file subtree:

  commit+checkpoint grew 0.26s -> 1.7s -> 2.6s -> ... -> 8.1s across 26
  batches, tracking DB file size (~30ms/MiB), while the WAL flushed was only
  0-6 MiB. So each checkpoint does work proportional to the whole DB file,
  not the WAL delta, and at the default ~16MB threshold it fires every ~2
  batches — hundreds of ever-growing checkpoints over a full run.

Ruled out other hypotheses with direct measurement:
  - fragmentation/bloat: freshly-built DB has free_ratio=0.0000,
    row_waste=0.0000 (zero free blocks, zero dead rows) — so mid-run
    compaction would reclaim nothing.
  - network FS: DB is on local ext4.
  - embed starvation: the degrading number is pure DB write time.
  - per-batch HNSW: bulk mode already drops HNSW during the run.

Fix: raise checkpoint_threshold (default 8GB, env-tunable via
CHUNKHOUND_DUCKDB_CHECKPOINT_THRESHOLD) so auto-checkpoints are deferred;
close() still issues the final CHECKPOINT to flush the WAL. Verified in
DuckDB 1.5.4 that the threshold genuinely suppresses mid-run checkpoints
(the earlier 6b20a48a/a9adf78f "no effect" finding was contaminated by the
temp-table DDL bug fixed later in af5c3bf3).

Re-running the same subtree: commit+checkpoint stays flat at 90-410ms with
no growth; final DB is correct (free_ratio=0, wal=0, HNSW present). Also
fixes a stale log label that printed milliseconds with an "s" suffix.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* perf(pipeline): overlap embed and store stages (~40% faster pipelined)

The streaming store thread accumulated a 10-batch window before writing —
leftover from the multi-batch transaction reverted in 9141d7dd. Combined with
a 2-slot embed->store channel it forced embed and store to ping-pong instead of
running concurrently.

Measured on a QDR subtree (~480k chunks) with wait-time instrumentation:
  embed blocked on store (send):  613.8s
  store blocked on embed (recv):  793.2s
Both stages sat idle ~40% of the pipelined wall waiting on each other.

Fix:
  - STORE_COMMIT_INTERVAL 10 -> 1: write each batch as it arrives (per-batch
    commits are already the default write path, so no change to DB behaviour;
    checkpoint_threshold governs WAL cost, not commit frequency).
  - embed->store channel capacity 2 -> 8: lets embed run ahead during store's
    write bursts and absorbs embed's large per-batch variance (2s-28s).

After (same subtree, same config):
  embed blocked on store:  0.0s   (eliminated)
  store blocked on embed:  55.4s  (-93%)
  pipelined wall:  1830s -> 1308s (-29%, +40% throughput)
  total run:       2150s -> 1675s (-22% end-to-end)

Embed is now the clean marginal bottleneck, as expected.

(Also folds in an incidental rustfmt reflow of the checkpoint_threshold block
in duckdb_backend.rs.)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* feat(pipeline): add per-stage channel wait-time instrumentation

Adds cheap, debug-level observability for the parse/embed/store pipeline so the
rate-limiting stage is directly visible instead of inferred from timestamps:

  [pipe] embed blocked: parse-recv Xs  store-send Ys
  [pipe] store blocked: embed-recv Zs

Each stage accumulates the wall-time it spends BLOCKED on its channels — recv
(upstream empty) and send (downstream full). The bottleneck stage shows ~0
blocked time; starved stages show large waits. This is the exact signal that
diagnosed the embed/store serialization fixed in the previous commit, and it's
the canary for future regressions when batch sizes, embed concurrency, or DB
cost shift the balance.

Cost is negligible (a few Instant::now() per batch; three log::debug! lines that
only surface under --verbose). The embed loop is restructured from `while let`
to `loop { match recv }` so the recv wait can be timed.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(pipeline): show write-data throughput as chunks/s, not batches/min

The "Writing data" progress bar displayed writes/min = cumulative batches ÷
elapsed. That decays from the pipeline's hot start (early batches clear fast as
buffers fill) and sags further as later files get heavier — so it looks like the
index is slowing down even when true throughput is flat/rising. Measured on a
QDR subtree: the bar fell 7.5 -> ~5 while real throughput rose 296 -> 395
chunks/s.

Fix: display true throughput in chunks/s, mirroring the embed bar. The store
loop's cumulative chunks_written is passed to the Python progress callback via a
new 4-arg emit helper; the callback computes chunks/s over elapsed. The bar's
progress fraction stays on batches (total = batch_count is known upfront; total
chunks is not), so only the speed source changes.

- src/pipeline/pipeline.rs: add emit_progress_gil_chunks(); use it at the two
  write-data emit sites, passing chunks_written. 3-arg emit_progress_gil (all
  other phases) unchanged.
- indexing_coordinator.py: _progress_cb gains an optional `chunks` arg; the
  write-data branch computes chunks/s (guarded elapsed > 0.05, like the embed
  bar) instead of calling _update_speed_field.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(db): tolerate VSS INSTALL failure and rediscover HNSW tables from DB state

Split try_load_vss's INSTALL/LOAD/SET into separate calls so a failed
INSTALL (air-gapped envs, version already present) doesn't block LOAD,
mirroring Python's connection_manager.py. Also rebuild the HNSW
dims/metric list by querying embedding tables directly instead of
trusting in-memory known_dims, which can diverge after a reconnect or
compaction.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): fix skipped counter, compaction display, error count, and timeout on Rust path

- skipped_unchanged now uses len(files) - agg_total_files instead of
  skipped_by_hash (which only counts mtime-changed-but-hash-matched
  files, missing the majority that were mtime-matched and never counted)
- compaction size display gated on _any_files_to_parse so re-index of
  unchanged tree shows "done" instead of stale before/after numbers
- added "errors" key to Rust path return dict so summary error count
  is populated (was always 0)
- fixed pipeline_bridge per_file_timeout fallback from `or 3.0` to
  `or 0.0` so config per_file_timeout_seconds: 0 correctly disables
  the parse timeout

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(tests): update contract test mocks to match current callback signatures

Both CI failures were test mocks with stale signatures:
- _raising_parse_file_callback lacked index_unknown_files, so the
  TypeError from the extra kwarg replaced the intended RuntimeError.
- progress_callback lacked the optional chunks=0 4th arg, causing
  write-data calls (via emit_progress_gil_chunks) to silently fail
  and never appear in the recorded phases.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* feat(pipeline): make Rust parse→embed→write pipeline the default (opt-out)

CHUNKHOUND_USE_RUST now defaults to "1" — the Rust pipeline is active unless
explicitly overridden with CHUNKHOUND_USE_RUST=0. File discovery was already
Rust-by-default; this makes the parse→embed→write phase consistent.

Tests updated TDD-style: test_rust_enabled_by_default asserts True on unset
env var, test_rust_enabled_via_env is extracted as its own case. Docstrings
updated across pipeline_bridge, directory_indexing_service, and pipeline_harness.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(ci): fix ImportError for chunkhound_native by removing stale PyPI package before maturin develop; extract repeated Rust build steps into composite action

uv sync installs the published chunkhound-native from PyPI; maturin
develop installs under the name "chunkhound", so the old site-packages
entry shadowed the locally-built .so on import, causing
`ImportError: cannot import name 'IndexingPipeline' from chunkhound_native`
in watchman-runtime-validation.  Uninstalling chunkhound-native before
maturin develop ensures the workspace version is always imported.

The four-step Rust build block (toolchain, cargo cache, DuckDB cache,
maturin develop) was duplicated across tests, watchman-runtime-validation,
and watchman-rollout-gate; extracted into
.github/actions/build-rust-extension/action.yml.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(ci): uninstall chunkhound-native after maturin develop, not before

maturin develop re-installs chunkhound-native from PyPI as a transitive
dep (it is listed in pyproject.toml dependencies), so uninstalling it
before the build had no effect.  Moving the uninstall to after maturin
develop ensures the PyPI package is gone before any test subprocess
imports chunkhound_native, leaving only the freshly-built .so reachable
via the editable-install path.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(ci): patch site-packages chunkhound_native in-place instead of uninstalling

Uninstalling chunkhound-native and relying on the editable-install path
does not work because every subsequent `uv run` command re-syncs the venv
against pyproject.toml and reinstalls chunkhound-native from PyPI before
running the command.

Instead, keep the package installed (dist-info intact so uv is satisfied)
but overwrite the .so and __init__.py inside site-packages with the
freshly-built files from maturin develop.  uv sees the dep as present and
skips the reinstall; tests see the locally-built symbols (IndexingPipeline).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(tests): update expected_surfaces for fast Watchman failure path

When the Watchman sidecar fails and exits quickly, the daemon can
exit before the client proxy even connects. In that case the proxy
raises "daemon may have shut down before accepting" (client_proxy.py)
instead of "exited before it became reachable" (discovery.py) or
"closed the IPC connection before serving any MCP traffic".

Add that message to expected_surfaces so the assertion covers both
timing orderings. Also replace the stale "crashed after publishing
lock" entry which no longer exists in any source path.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): reconnect Python DB after Rust pipeline to prevent executor shutdown error

disconnect() permanently shuts down the ThreadPoolExecutor in
SerialDatabaseProvider.  Calling it before run_rust_pipeline() left the
provider unusable afterward — any DB operation (search, live indexing,
compaction) raised "cannot schedule new futures after shutdown".

Add release_for_rust_pipeline() which closes only the DuckDB connection
in the executor thread (via the existing _executor_disconnect path) and
clears thread-local state, but does NOT call executor.shutdown().  The
executor stays alive so connect() can reopen the connection once the Rust
pipeline has released its write lock.

Call release_for_rust_pipeline() before and connect() after
run_rust_pipeline() in indexing_coordinator.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): close all DuckDB connections before Rust takes ownership and guard non-chunks.db filenames

Two CI failures fixed:

1. DuckDBProvider.release_for_rust_pipeline() now overrides the base class
   to also close _connection_manager.connection. Previously only the
   executor's thread-local connection was closed; Python's DuckDB C-instance
   kept the file open in its buffer pool, so the reconnect after Rust saw
   stale cached state instead of Rust's freshly-written data.

2. Rust pipeline hardcodes appending "chunks.db" to the directory it
   receives. When the configured DB file is not named "chunks.db"
   (e.g. isolated_test.db), the path computation produced the wrong file.
   process_directory now falls back to the Python pipeline for any DB not
   named "chunks.db".

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): check disk usage limit before Rust pipeline runs

_store_parsed_results checked the limit for the Python path, but the Rust
pipeline bypasses that function entirely. Adding a pre-check in
process_directory before either pipeline starts ensures the
disk_limit_exceeded status is returned correctly on both paths.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(ci): co-locate duckdb shared lib with the site-packages chunkhound_native copy

eb67af17 switched to patching chunkhound_native.pyd in place inside
site-packages instead of uninstalling the PyPI package, so Python now
imports the site-packages copy rather than the source-tree one. The
DuckDB shared lib was only ever copied next to the source-tree copy,
so the site-packages .pyd loads with no co-located duckdb.dll/dylib.

Windows extension modules haven't searched PATH for dependent DLLs
since Python 3.8, so the existing PATH-based workaround doesn't help
there — duckdb.dll must sit next to whichever .pyd actually gets
imported. macOS masked the same gap via DYLD_LIBRARY_PATH.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(native): make DuckDB linking self-contained instead of relying on build-machine-absolute paths and CI-only env vars

chunkhound_native's new duckdb dependency was resolved at runtime via an
absolute build-time RPATH on Linux and CI-only DYLD_LIBRARY_PATH/PATH
hacks on macOS/Windows, none of which survive a real package install
(confirmed via a live ImportError on the installed-wheel path). Extension
now resolves its DuckDB dependency relative to its own location: a
self-relative RPATH ($ORIGIN/@loader_path) baked in via RUSTFLAGS for dev
builds, maturin's built-in --auditwheel repair for published wheels, and
os.add_dll_directory() on Windows, backed by a clear diagnostic that
distinguishes a missing library from one that's present but won't load.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(ci): unlink before overwriting installed chunkhound_native to avoid poisoning uv's package cache

cp/shutil.copy2 overwrite file content in place; when the target is
hardlinked into uv's shared cache (same filesystem as $UV_CACHE_DIR), that
mutates the cache itself, so later unrelated venvs on the same runner that
install chunkhound-native fresh silently get this dev-only build instead of
the real package. This is what broke the Windows "Verify installed-wheel
Watchman live mutation e2e" CI job on PR #380.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): close compaction crash-recovery gap and DB-reconnect-on-error, restore lost smoke suite

Found during PR #380 review:

- duckdb_backend.rs: "phase2" crash recovery in open() deleted the
  pre-compaction .old backup unconditionally, without checking whether
  the compact_path -> db_path rename actually completed. A crash in
  that window left db_path missing and the backup destroyed, so the
  next open() silently created an empty database. Recovery now finishes
  the rename first when compact_path still exists.

- indexing_coordinator.py: the Rust pipeline call released the Python
  DuckDB connection but only reconnected it on the happy path. If
  run_rust_pipeline() raised, self._db stayed disconnected for the rest
  of the process. Wrapped in try/finally.

- tests/test_smoke.py: a merge conflict on this file had been resolved
  by deleting it outright, silently dropping the CLI/import/parser/type
  smoke tests AGENTS.md and the Makefile mandate before every commit.
  Restored the non-MCP test classes (the MCP subprocess tests already
  live in tests/mcp/test_smoke.py).

- Removed .pi/tasks/*.json (accidental commit of local agent
  task-tracker state; .gitignore already excludes .pi/) and the empty,
  unreferenced docker/entrypoint.sh stub.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* chore: cross-platform-safe file move in native diagnostics test, tidy bundled-lib error message

Path.rename() across filesystems/drives can fail on Windows; shutil.move()
handles that. Minor f-string readability cleanup in the ImportError message.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(pipeline): dedupe config extraction, use structured errors, rename colliding module, trim implementation-detail tests

Follow-up from the full-checklist pass of the PR #380 review (DRY, module
boundaries, architecture consistency, testing philosophy):

- src/pipeline/config.rs: replaced five near-duplicate get_*_or() extractors
  with the crate's existing generic extract_opt/extract_req pattern from
  db_writer.rs (added a third generic extract_or() there for the
  fallback-to-default case).
- src/pipeline/mod.rs: added the required inline comment to the
  #[allow(clippy::module_inception)] the project's own rule mandates.
- src/pipeline/pipeline.rs: DuckDB errors in compute_diff_blocking() now
  convert to PyErr via the crate's existing DbError -> PyErr impl instead of
  flattening to a generic PyRuntimeError with a hand-formatted message.
- Renamed chunkhound/providers/database/pipeline_bridge.py to
  rust_pipeline_flag.py — it shared a basename with the unrelated, much
  larger chunkhound/pipeline_bridge.py, inviting import/grep confusion.
  Updated all call sites and doc references.
- chunkhound/pipeline_bridge.py: collapsed ~12 repetitions of
  getattr(cfg, attr, default) or default into one _cfg_or() helper.
- tests/contracts/test_parse_pool_reused.py: dropped a test that only
  asserted on a monkeypatched private pool's construction count, and
  removed the remaining test's pool-identity assertion — both violated this
  project's testing philosophy (no tests against private helpers/internal
  plumbing). Kept the PID-equality assertion, which is the actual externally
  observable effect (no per-batch process respawn) a caller would feel as
  wall-clock overhead.

Verified: cargo fmt/clippy -D warnings/test all clean; tests/contracts/
(41 tests) and the feature-flag tests in tests/test_rust_db_writer.py pass.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): stop swallowing parse-thread panics, fix embed skip on Rust fallback

A panicked parse thread's join result was discarded, so the run reported
success despite an incomplete parse; parse_one_batch now also errors
instead of indexing out of bounds if the callback returns a mismatched
result count. IndexingCoordinator.process_directory now reports the
pipeline it actually used (rust vs python fallback for non-DuckDB
providers or non-standard db filenames), and DirectoryIndexingService
uses that resolved value instead of the raw feature flag, so projects
that fall back to Python (e.g. LanceDB-backed) still get their
embedding-generation pass.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(tests): move DuckDB diagnostics fixture files to a same-drive temp dir

shutil.move()'s cross-drive fallback (copy+unlink) fails on Windows CI
because the bundled DuckDB library is already loaded into the process by
this point, and Windows denies deleting an in-use DLL. A plain rename
works even on a loaded DLL as long as source and destination share a
drive, so create the temp dir as a sibling of the package instead of
using pytest's tmp_path (which lives on a different drive in CI).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): close HNSW-restore/thread-reset error-path gaps, un-stick compaction skip, preserve error file context

Four independent Major-severity fixes from PR review:

- pipeline.rs: chain the post-write compaction/HNSW-rebuild step onto
  write_result so a failure there still funnels through the existing
  best-effort backend.close() instead of leaving the connection open
  with HNSW indexes un-restored (Invariant 14).
- duckdb_backend.rs: ensure_all_hnsw_indexes' SET threads=8 -> 1 reset
  now always runs even if a CREATE INDEX/CHECKPOINT in between fails,
  so a failed build can no longer leave the connection pinned at 8
  threads contending with the embed thread pool.
- indexing_coordinator.py: set self._skip_compaction unconditionally
  each call instead of only inside the Rust branch — a cached/reused
  coordinator no longer inherits a stale True from a prior Rust run
  and skips compaction forever on a later Python-path call.
- pipeline_bridge.py: split Rust's "{path}: {message}" error strings
  back into real file/error fields instead of always reporting
  file=None, fixing "Failed to process None: ..." in error logs.
- directory_indexing_service.py: _ensure_hnsw_indexes now uses the
  coordinator's resolved pipeline decision instead of the raw feature
  flag, so a fallback-to-Python run's newly created embedding table
  still gets its HNSW index built.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(tests): dedupe contract-test Rust invocation helpers into pipeline_harness

Four contract tests each hand-duplicated their own _index_with_rust /
…
grzegorznowak pushed a commit to grzegorznowak/chunkhound that referenced this pull request Sep 17, 2026
* fix: run orphan cleanup unconditionally, even when Rust pipeline is active

_cleanup_orphaned_files() was skipped outright whenever CHUNKHOUND_USE_RUST=1,
based on a stale assumption that Python couldn't safely touch the DB around a
Rust-driven run. It executes before Rust's own connection handoff, so self._db
is always live at that point regardless of pipeline. The gap this caused: a
force_reindex=True run under Rust skipped both Rust's own diff (which never
runs on a forced full reindex) and Python's cleanup, so deleted files' rows
persisted forever with no cleanup path at all.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: three CI failures in progress shim, embedding dedup, and TLS verify

- rich_output.py: the no-Rich _Shim progress fallback only exposed a
  public `tasks` dict, but _update_speed_field() (added for the
  files/min and writes/min bars) reads Rich's private `_tasks` mapping
  directly. Alias `_tasks` to the same dict so both names work.

- duckdb_provider.py: CREATE UNIQUE INDEX still counts a row deleted
  earlier in the same open transaction as a live duplicate, so
  _executor_ensure_embedding_upsert_contract's dedupe-then-index-create
  sequence hit "Data contains duplicates" even though the delete had
  already run. Split the dedupe delete into its own committed guarded
  mutation before the index-creation mutation begins.

- openai_provider.py: the connection-pool-bounding fix unconditionally
  applied `verify=self._ssl_verify` to the httpx client even when no
  custom base_url was set, letting ssl_verify=False silently disable
  TLS verification against the official OpenAI endpoint. ssl_verify is
  only meant for custom/self-hosted endpoints; force verify=True
  whenever base_url is unset while keeping the connection-pool bound
  for all cases.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: recognize newer DuckDB lock-conflict message during WAL validation

Newer DuckDB versions raise "Could not set lock on file ... Conflicting
lock is held" instead of "Unique file handle conflict" when a database
file is already open by another connection. WAL validation was only
matching the older message, so it treated a healthy already-open
database as needing WAL cleanup.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* feat: show DB size reduction in the compaction progress bar

The Compacting bar previously just said "done" when finished. It now
snapshots the DB file size before and after compaction (via the
write-compact/write-done phase callbacks from the Rust pipeline) and
displays e.g. "17.0MB -> 11.3MB (34% smaller)".

Also includes an idempotency guard on DuckDbHnswBackend::open() to avoid
erroring on re-open under Windows' exclusive file lock.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix: build chunkhound_native in watchman-runtime-validation CI job

The watchman job ran uv sync --locked but never built the Rust extension,
so chunkhound_native.chunkhound_native (the compiled .so) was absent and
pytest collection crashed on any module that transitively imports it.

Add the same Rust toolchain install, cargo/DuckDB caches, and maturin
develop steps that the main tests job already uses.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix: set DYLD_LIBRARY_PATH on macOS test collection check step

The Test collection check step imported chunkhound_native, which
links against libduckdb.dylib via @rpath, but the .so has no
LC_RPATH entries. DYLD_LIBRARY_PATH was only set on the Run tests
step, so pytest --collect-only failed with "Library not loaded:
@rpath/libduckdb.dylib / Reason: no LC_RPATH's found" on macOS.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix: add chunkhound_native to PATH on Windows for installed-wheel DLL resolution

The watchman-runtime-validation job already copies duckdb.dll into
chunkhound_native/ via the maturin develop step, but never makes that
directory findable for the Windows DLL loader when loading from a fresh
venv.  In a fresh venv (e.g. the installed-wheel e2e test), the .pyd
lives in site-packages/chunkhound_native/ with no co-located duckdb.dll,
so the MCP server crashes on import and the initialize request times out.

Add chunkhound_native/ to $GITHUB_PATH on Windows — the direct analogue
of DYLD_LIBRARY_PATH on macOS.  _clean_room_env() passes PATH through, so
the MCP server subprocess inherits the directory and Windows finds duckdb.dll.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): make Rust the sole owner of orphan cleanup (Option D)

**Bug fixed (Bug 1):** The `hasattr(self._db, "db_path")` guard was placed
*after* the cleanup gate, creating a window where `_use_rust=True` caused
Python to skip `_cleanup_orphaned_files()`, but Rust was then also disabled —
leaving orphaned DB rows permanently. The check is now moved to the early
`_use_rust` gate block alongside the `DuckDBProvider` isinstance check, so
both disqualifying conditions are evaluated before any cleanup decision is made.

**Option D changes:**
- `src/pipeline/pipeline.rs`: force_reindex branch now calls
  `compute_diff_blocking()` to harvest `diff.removed` for orphan deletion
  instead of setting `delete_paths = Vec::new()`. This closes the gap where
  force-reindexing silently kept stale DB rows for deleted files.
- `chunkhound/services/indexing_coordinator.py`: cleanup gate is gated on
  `not _use_rust`; when Rust owns the pipeline, Python's
  `_cleanup_orphaned_files()` is skipped. The redundant late `hasattr` check
  is removed (responsibility moved to the early gate).
- `chunkhound/pipeline_bridge.py`: removed `skip_cleanup: True` from the
  config dict — the flag was never honored by Rust and is now meaningless.
- `src/pipeline/config.rs`: removed the dead `skip_cleanup` field entirely.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): address two post-review gaps found by independent reviewer

**Fix 1 — _diff_task progress bar leak on empty directory:**
When `_use_rust=True` and `self.progress` is set, `_diff_task` was added to
the Rich display before the `if not files: return` early-exit. The task was
never removed, leaving a stuck "Checking for changes" bar at 0%. Added
`self.progress.remove_task(_diff_task)` before the early return.

**Fix 2 — config.indexing.cleanup=False silently ignored by Rust pipeline:**
`cleanup=False` suppressed Python's `_cleanup_orphaned_files()`, but Rust
always called `compute_diff_blocking()` and deleted orphans regardless.
Threaded `do_cleanup` from the coordinator through `run_rust_pipeline()` →
`PipelineConfig` → `pipeline.rs`. Rust now gates orphan deletion on
`self.config.do_cleanup`: in incremental mode, `diff.removed` is discarded
when false; in force_reindex mode, `compute_diff_blocking()` is skipped
entirely (avoiding the unnecessary DB query).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): honor fragmentation_threshold_pct in Rust pipeline compaction

Rust's compaction_threshold was hardcoded to 0.30, ignoring the user-facing
--fragmentation-threshold-pct setting that the Python indexing path already
respects (duckdb_provider.py). Now sourced from config.database and
converted from percentage to ratio.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): preserve non-cosine HNSW metric through Rust index rebuild

recreate_hnsw_indexes rebuilt dropped HNSW indexes from duckdb_indexes().sql,
but DuckDB strips the WITH (metric = ...) clause from that DDL text, so any
non-cosine index silently reverted to cosine after a drop/recreate cycle.
Capture the live metric via pragma_hnsw_index_info() instead, mirroring the
existing Python-side _extract_hnsw_metric fix.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(indexing): correct compaction progress label when DB file grows

The label always said "smaller" regardless of the sign of the
before/after percentage, producing nonsensical output like
"8.4GB → 11.8GB (-40% smaller)" when compaction increased file size.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* perf(db): eliminate per-batch catalog scans by deriving emb_tables from known_dims

delete_paths and pre_delete_for_upsert were calling discover_embedding_tables()
on every batch, scanning information_schema.tables each time to find embeddings_N
tables. The table name is fully deterministic from the dimension value, and the
set of known dimensions is already maintained in self.known_dims (populated at
open() and kept current in prepare_write). Pass known_dims to both functions so
they derive the table list from memory instead of the catalog.

Also replace the catalog scan in ensure_all_hnsw_indexes with self.known_dims
iteration, eliminating one additional scan per run.

The two remaining discover_embedding_tables calls in open() and reopen() are
intentional: they seed known_dims from disk at session start.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(db): preserve non-cosine HNSW metric through bulk-mode drop and post-compaction rebuild

ensure_all_hnsw_indexes() hardcoded 'cosine' when recreating indexes after a
pipeline run (bulk mode) or after compaction, silently replacing any l2sq/ip
index the user had created.

Fix: drop_all_hnsw_indexes() now saves the discovered metrics into
saved_hnsw_metrics: HashMap<u32, String> before dropping the indexes.
ensure_all_hnsw_indexes() looks up the per-dims metric from that map and
falls back to 'cosine' only for dimension tables that had no prior index.

Adds a test covering the drop→ensure round-trip that verifies the metric
is preserved end-to-end, complementing the existing recreate_hnsw_indexes
test.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(db): remove no-op temp-table DELETEs and eliminate catalog scans in compaction_stats

Item 2: rust_temp_chunks and rust_temp_emb_{dims} are both DROP'd at the end
of every call, so the CREATE TABLE IF NOT EXISTS at the top always produces an
empty table. The DELETE immediately after CREATE was always a no-op — removed.

Item 3: compaction_stats() called discover_embedding_tables() twice (once for
live_embeddings, once for stored_embeddings), each scanning
information_schema.tables. known_dims is authoritative at this point; table
names are deterministic from dims. Both catalog scans replaced with iteration
over self.known_dims — same fix already applied to delete_paths and
pre_delete_for_upsert.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(pipeline): eliminate per-file SELECT in upsert_file by threading IDs from diff phase

On a 50k-file repo, every incremental index run issues one SELECT per file
in upsert_file (even on fresh index where all SELECTs return None). The diff
phase already queries the DB for all file paths+mtimes but discarded the id
column. Thread the id through DiffResult.existing_ids → FileRecord.existing_file_id
so upsert_file can skip the SELECT and go straight to UPDATE for changed files.

Also activates the pre_delete_for_upsert by_id fast path (direct id match
instead of nested path subquery) for the same set of changed files.

Non-incremental runs produce an empty existing_ids map → upsert_file falls
through to the existing SELECT-then-UPDATE-or-INSERT slow path, which is
correct (the old data may have been deleted and re-inserted).

New tests: test_upsert_file_with_known_id_skips_insert (Rust),
test_mtime_change_detected carries existing_ids assertion (expanded),
test_compute_diff_no_id_for_new_files (new Rust differ test),
test_upsert_replaces_chunks_on_update asserts returned file_id == original fid (expanded).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(pipeline): collapse three stat passes into one via precomputed_stats

Incremental indexing called std::fs::metadata on every file three times:
Pass 1 (compute_diff_blocking, all files, mtime only — TZ-offset),
Pass 2 (compute_diff, all files, mtime only — change detection), and
Pass 3 (parse_one_batch, changed files, mtime+size — ParsedFile fields).
For 10k files with 1k changed that was 21k syscalls; now it is 10k.

collect HashMap<PathBuf,(u64,f64)> once in compute_diff_blocking, pass it
into compute_diff (eliminating Pass 2), carry the changed-file subset in
DiffResult.disk_stats, and thread it into parse_one_batch (eliminating
Pass 3). A fallback stat call is retained in each stage so the
non-incremental and test paths are unaffected.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(db): remove per-batch CHECKPOINT from write_batch_incremental

The Python indexing path commits with force_checkpoint=False and relies
on DuckDB's 1 GB WAL auto-checkpoint plus an explicit CHECKPOINT at
disconnect. The Rust path was issuing an additional CHECKPOINT after
every single batch commit, producing N+1 flushes for N batches where
the Python path produces 1.

Remove the per-batch CHECKPOINT. close() at line 1219 already issues
CHECKPOINT before dropping the connection — identical to Python's
_executor_disconnect() pattern. DuckDB readers see committed WAL data
without a CHECKPOINT, so visibility is unaffected.

For 100 batches: 101 flushes → 1 (99% reduction).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(db): use saved_hnsw_metrics in finish_write pending_new_dims path

When drop_all_hnsw_indexes() enters bulk mode it saves each dim's HNSW
metric into saved_hnsw_metrics before dropping the indexes. The
pending_new_dims path in finish_write was ignoring that map and
hardcoding 'cosine' — so a dim that previously used l2sq (or ip) would
get recreated with cosine, and the subsequent ensure_all_hnsw_indexes
call in close() could not fix it because CREATE INDEX IF NOT EXISTS is
a no-op on the already-wrong index.

Replace the hardcoded 'cosine' with
saved_hnsw_metrics.get(&dims).unwrap_or("cosine"), matching the
pattern already used in ensure_all_hnsw_indexes and recreate_hnsw_indexes.

New test test_finish_write_new_dims_uses_saved_hnsw_metric exercises
the exact bulk-mode path: creates an l2sq HNSW, enters bulk mode, writes
a batch, asserts the recreated index uses l2sq not cosine.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(db): raise WAL auto-checkpoint threshold to 1 GiB in Rust open()

DuckDB's default checkpoint_threshold is ~16 MB, causing frequent WAL
flushes during indexing.  Setting it to 1 GiB on the writer connection
matches the intended write pattern: accumulate in WAL, flush once at
close() via the explicit CHECKPOINT.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* revert: remove checkpoint_threshold pragma from open()

DuckDB auto-checkpoints after every COMMIT when no other transactions
are active — checkpoint_threshold only throttles size-based triggers
and has no effect on this per-COMMIT behavior. The pragma was adding
complexity with no measurable benefit.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* chore(pipeline): remove stale design-era dead code and fix config key typo

Drop three unused types from types.rs (DiffResult, EmbeddedBatch,
DbFileState) that matched the original design's channel types but were
superseded by differ::DiffResult and DbWriterBatch in the actual
implementation. Delete state.rs (PipelineState) — pipeline.rs never
imported it, building PipelineReport directly from StoreOutcome instead.

Fix 12 contract-test config dicts that passed "skip_cleanup": False
(unrecognized key, silently ignored) instead of "do_cleanup": True
(the key config.rs actually reads at line 67).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(db): collapse double batch traversal in prepare_write into one pass

count_total_embeddings and collect_unique_dims both iterated the same
batch.files → chunks → embedding chain. Replace with a single
collect_dims_and_count that returns (HashSet<u32>, usize) in one loop.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): wire indexing.max_concurrent to Rust parse thread pool size

parse_thread_pool_size was hardcoded to min(cpu_count, 16); it now reads
indexing_cfg.max_concurrent when set, falling back to the CPU formula only
when the value is absent or zero.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(instrumentation): add per-batch store timing and silence HTTP log noise

Split the store stage's monolithic timer into three sub-timers (prep_ms,
write_ms, commit+checkpoint ms) and log DB/WAL file sizes per batch, making
checkpoint-driven slowdown directly observable in --verbose output.

Silence httpx/httpcore/openai loggers unconditionally so their per-request
DEBUG spam no longer drowns the Rust pipeline's timing lines under --verbose.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(db): batch store commits every 10 batches to reduce checkpoint frequency

DuckDB auto-checkpoints synchronously on COMMIT when WAL exceeds ~16 MB, and
checkpoint cost grows with DB file size. With one COMMIT per batch this caused
monotonic throughput degradation confirmed by instrumentation.

Adds write_batches_in_one_txn() to DbBackend: the store stage now buffers 10
batches, runs prepare_write() for each in auto-commit mode (preserving FK and
nested-BEGIN invariants), then writes all 10 in a single transaction. One
COMMIT per window = one checkpoint opportunity instead of one per batch.

The Python-callable RustDbWriter path is unchanged (default trait impl calls
write_batch_incremental per batch).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(db): eliminate temp-table DDL from insert functions to fix multi-batch transaction performance

CREATE/DROP TEMPORARY TABLE inside an explicit transaction caused DuckDB
to treat each DDL as an implicit checkpoint boundary, silently splitting
the 10-batch window into 10 per-batch commits — identical overhead to the
old approach. Replace with direct INSERT INTO ... VALUES ... RETURNING id
(for chunks) and INSERT INTO ... VALUES ... ON CONFLICT DO UPDATE (for
embeddings), eliminating all DDL from within transactions.

Also emit write-data progress after each prepare_write during window
accumulation so writes/min stays live instead of spiking at window end.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(db): remove write_batches_in_one_txn override to fix FK violation

The 10-batch transaction override caused a foreign key constraint error:
delete_paths Phase 1 (DELETE chunks, COMMIT) ran inside or adjacent to the
multi-batch transaction, making the COMMIT a no-op nested commit. Phase 2
(DELETE files) then failed because chunk rows still referenced file_id.

Removing the override reverts to the trait default: write_batch_incremental
per batch, each in its own BEGIN-COMMIT. This preserves the DDL-free INSERT
changes from af5c3bf3 (no temp table overhead) while restoring FK safety.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): wire index_unknown_files and disk_usage_limit_mb to Rust path

index_unknown_files was silently ignored on the Rust pipeline — parse_file_callback
returned ("", []) for UNKNOWN-extension files regardless of the flag. Now the flag
flows through _ParsePoolConfig (via a run_rust_pipeline closure) and the UNKNOWN
branch is treated as Language.TEXT, matching the Python batch_processor path.

disk_usage_limit_mb (database_cfg.max_disk_usage_mb) was also never forwarded to
Rust's PipelineConfig; added to config_dict so Rust enforces the disk cap.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* perf(db): defer WAL checkpoints to fix store-stage degradation

The Rust store stage degraded monotonically on large indexes. Isolated the
cause with per-batch instrumentation on a 5k-file subtree:

  commit+checkpoint grew 0.26s -> 1.7s -> 2.6s -> ... -> 8.1s across 26
  batches, tracking DB file size (~30ms/MiB), while the WAL flushed was only
  0-6 MiB. So each checkpoint does work proportional to the whole DB file,
  not the WAL delta, and at the default ~16MB threshold it fires every ~2
  batches — hundreds of ever-growing checkpoints over a full run.

Ruled out other hypotheses with direct measurement:
  - fragmentation/bloat: freshly-built DB has free_ratio=0.0000,
    row_waste=0.0000 (zero free blocks, zero dead rows) — so mid-run
    compaction would reclaim nothing.
  - network FS: DB is on local ext4.
  - embed starvation: the degrading number is pure DB write time.
  - per-batch HNSW: bulk mode already drops HNSW during the run.

Fix: raise checkpoint_threshold (default 8GB, env-tunable via
CHUNKHOUND_DUCKDB_CHECKPOINT_THRESHOLD) so auto-checkpoints are deferred;
close() still issues the final CHECKPOINT to flush the WAL. Verified in
DuckDB 1.5.4 that the threshold genuinely suppresses mid-run checkpoints
(the earlier 6b20a48a/a9adf78f "no effect" finding was contaminated by the
temp-table DDL bug fixed later in af5c3bf3).

Re-running the same subtree: commit+checkpoint stays flat at 90-410ms with
no growth; final DB is correct (free_ratio=0, wal=0, HNSW present). Also
fixes a stale log label that printed milliseconds with an "s" suffix.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* perf(pipeline): overlap embed and store stages (~40% faster pipelined)

The streaming store thread accumulated a 10-batch window before writing —
leftover from the multi-batch transaction reverted in 9141d7dd. Combined with
a 2-slot embed->store channel it forced embed and store to ping-pong instead of
running concurrently.

Measured on a QDR subtree (~480k chunks) with wait-time instrumentation:
  embed blocked on store (send):  613.8s
  store blocked on embed (recv):  793.2s
Both stages sat idle ~40% of the pipelined wall waiting on each other.

Fix:
  - STORE_COMMIT_INTERVAL 10 -> 1: write each batch as it arrives (per-batch
    commits are already the default write path, so no change to DB behaviour;
    checkpoint_threshold governs WAL cost, not commit frequency).
  - embed->store channel capacity 2 -> 8: lets embed run ahead during store's
    write bursts and absorbs embed's large per-batch variance (2s-28s).

After (same subtree, same config):
  embed blocked on store:  0.0s   (eliminated)
  store blocked on embed:  55.4s  (-93%)
  pipelined wall:  1830s -> 1308s (-29%, +40% throughput)
  total run:       2150s -> 1675s (-22% end-to-end)

Embed is now the clean marginal bottleneck, as expected.

(Also folds in an incidental rustfmt reflow of the checkpoint_threshold block
in duckdb_backend.rs.)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* feat(pipeline): add per-stage channel wait-time instrumentation

Adds cheap, debug-level observability for the parse/embed/store pipeline so the
rate-limiting stage is directly visible instead of inferred from timestamps:

  [pipe] embed blocked: parse-recv Xs  store-send Ys
  [pipe] store blocked: embed-recv Zs

Each stage accumulates the wall-time it spends BLOCKED on its channels — recv
(upstream empty) and send (downstream full). The bottleneck stage shows ~0
blocked time; starved stages show large waits. This is the exact signal that
diagnosed the embed/store serialization fixed in the previous commit, and it's
the canary for future regressions when batch sizes, embed concurrency, or DB
cost shift the balance.

Cost is negligible (a few Instant::now() per batch; three log::debug! lines that
only surface under --verbose). The embed loop is restructured from `while let`
to `loop { match recv }` so the recv wait can be timed.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(pipeline): show write-data throughput as chunks/s, not batches/min

The "Writing data" progress bar displayed writes/min = cumulative batches ÷
elapsed. That decays from the pipeline's hot start (early batches clear fast as
buffers fill) and sags further as later files get heavier — so it looks like the
index is slowing down even when true throughput is flat/rising. Measured on a
QDR subtree: the bar fell 7.5 -> ~5 while real throughput rose 296 -> 395
chunks/s.

Fix: display true throughput in chunks/s, mirroring the embed bar. The store
loop's cumulative chunks_written is passed to the Python progress callback via a
new 4-arg emit helper; the callback computes chunks/s over elapsed. The bar's
progress fraction stays on batches (total = batch_count is known upfront; total
chunks is not), so only the speed source changes.

- src/pipeline/pipeline.rs: add emit_progress_gil_chunks(); use it at the two
  write-data emit sites, passing chunks_written. 3-arg emit_progress_gil (all
  other phases) unchanged.
- indexing_coordinator.py: _progress_cb gains an optional `chunks` arg; the
  write-data branch computes chunks/s (guarded elapsed > 0.05, like the embed
  bar) instead of calling _update_speed_field.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix(db): tolerate VSS INSTALL failure and rediscover HNSW tables from DB state

Split try_load_vss's INSTALL/LOAD/SET into separate calls so a failed
INSTALL (air-gapped envs, version already present) doesn't block LOAD,
mirroring Python's connection_manager.py. Also rebuild the HNSW
dims/metric list by querying embedding tables directly instead of
trusting in-memory known_dims, which can diverge after a reconnect or
compaction.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): fix skipped counter, compaction display, error count, and timeout on Rust path

- skipped_unchanged now uses len(files) - agg_total_files instead of
  skipped_by_hash (which only counts mtime-changed-but-hash-matched
  files, missing the majority that were mtime-matched and never counted)
- compaction size display gated on _any_files_to_parse so re-index of
  unchanged tree shows "done" instead of stale before/after numbers
- added "errors" key to Rust path return dict so summary error count
  is populated (was always 0)
- fixed pipeline_bridge per_file_timeout fallback from `or 3.0` to
  `or 0.0` so config per_file_timeout_seconds: 0 correctly disables
  the parse timeout

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(tests): update contract test mocks to match current callback signatures

Both CI failures were test mocks with stale signatures:
- _raising_parse_file_callback lacked index_unknown_files, so the
  TypeError from the extra kwarg replaced the intended RuntimeError.
- progress_callback lacked the optional chunks=0 4th arg, causing
  write-data calls (via emit_progress_gil_chunks) to silently fail
  and never appear in the recorded phases.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* feat(pipeline): make Rust parse→embed→write pipeline the default (opt-out)

CHUNKHOUND_USE_RUST now defaults to "1" — the Rust pipeline is active unless
explicitly overridden with CHUNKHOUND_USE_RUST=0. File discovery was already
Rust-by-default; this makes the parse→embed→write phase consistent.

Tests updated TDD-style: test_rust_enabled_by_default asserts True on unset
env var, test_rust_enabled_via_env is extracted as its own case. Docstrings
updated across pipeline_bridge, directory_indexing_service, and pipeline_harness.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(ci): fix ImportError for chunkhound_native by removing stale PyPI package before maturin develop; extract repeated Rust build steps into composite action

uv sync installs the published chunkhound-native from PyPI; maturin
develop installs under the name "chunkhound", so the old site-packages
entry shadowed the locally-built .so on import, causing
`ImportError: cannot import name 'IndexingPipeline' from chunkhound_native`
in watchman-runtime-validation.  Uninstalling chunkhound-native before
maturin develop ensures the workspace version is always imported.

The four-step Rust build block (toolchain, cargo cache, DuckDB cache,
maturin develop) was duplicated across tests, watchman-runtime-validation,
and watchman-rollout-gate; extracted into
.github/actions/build-rust-extension/action.yml.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(ci): uninstall chunkhound-native after maturin develop, not before

maturin develop re-installs chunkhound-native from PyPI as a transitive
dep (it is listed in pyproject.toml dependencies), so uninstalling it
before the build had no effect.  Moving the uninstall to after maturin
develop ensures the PyPI package is gone before any test subprocess
imports chunkhound_native, leaving only the freshly-built .so reachable
via the editable-install path.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(ci): patch site-packages chunkhound_native in-place instead of uninstalling

Uninstalling chunkhound-native and relying on the editable-install path
does not work because every subsequent `uv run` command re-syncs the venv
against pyproject.toml and reinstalls chunkhound-native from PyPI before
running the command.

Instead, keep the package installed (dist-info intact so uv is satisfied)
but overwrite the .so and __init__.py inside site-packages with the
freshly-built files from maturin develop.  uv sees the dep as present and
skips the reinstall; tests see the locally-built symbols (IndexingPipeline).

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(tests): update expected_surfaces for fast Watchman failure path

When the Watchman sidecar fails and exits quickly, the daemon can
exit before the client proxy even connects. In that case the proxy
raises "daemon may have shut down before accepting" (client_proxy.py)
instead of "exited before it became reachable" (discovery.py) or
"closed the IPC connection before serving any MCP traffic".

Add that message to expected_surfaces so the assertion covers both
timing orderings. Also replace the stale "crashed after publishing
lock" entry which no longer exists in any source path.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): reconnect Python DB after Rust pipeline to prevent executor shutdown error

disconnect() permanently shuts down the ThreadPoolExecutor in
SerialDatabaseProvider.  Calling it before run_rust_pipeline() left the
provider unusable afterward — any DB operation (search, live indexing,
compaction) raised "cannot schedule new futures after shutdown".

Add release_for_rust_pipeline() which closes only the DuckDB connection
in the executor thread (via the existing _executor_disconnect path) and
clears thread-local state, but does NOT call executor.shutdown().  The
executor stays alive so connect() can reopen the connection once the Rust
pipeline has released its write lock.

Call release_for_rust_pipeline() before and connect() after
run_rust_pipeline() in indexing_coordinator.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): close all DuckDB connections before Rust takes ownership and guard non-chunks.db filenames

Two CI failures fixed:

1. DuckDBProvider.release_for_rust_pipeline() now overrides the base class
   to also close _connection_manager.connection. Previously only the
   executor's thread-local connection was closed; Python's DuckDB C-instance
   kept the file open in its buffer pool, so the reconnect after Rust saw
   stale cached state instead of Rust's freshly-written data.

2. Rust pipeline hardcodes appending "chunks.db" to the directory it
   receives. When the configured DB file is not named "chunks.db"
   (e.g. isolated_test.db), the path computation produced the wrong file.
   process_directory now falls back to the Python pipeline for any DB not
   named "chunks.db".

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(pipeline): check disk usage limit before Rust pipeline runs

_store_parsed_results checked the limit for the Python path, but the Rust
pipeline bypasses that function entirely. Adding a pre-check in
process_directory before either pipeline starts ensures the
disk_limit_exceeded status is returned correctly on both paths.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>

* fix(ci): co-locate duckdb shared lib with the site-packages chunkhound_native copy

eb67af17 switched to patching chunkhound_native.pyd in place inside
site-packages instead of uninstalling the PyPI package, so Python now
imports the site-packages copy rather than the source-tree one. The
DuckDB shared lib was only ever copied next to the source-tree copy,
so the site-packages .pyd loads with no co-located duckdb.dll/dylib.

Windows extension modules haven't searched PATH for dependent DLLs
since Python 3.8, so the existing PATH-based workaround doesn't help
there — duckdb.dll must sit next to whichever .pyd actually gets
imported. macOS masked the same gap via DYLD_LIBRARY_PATH.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(native): make DuckDB linking self-contained instead of relying on build-machine-absolute paths and CI-only env vars

chunkhound_native's new duckdb dependency was resolved at runtime via an
absolute build-time RPATH on Linux and CI-only DYLD_LIBRARY_PATH/PATH
hacks on macOS/Windows, none of which survive a real package install
(confirmed via a live ImportError on the installed-wheel path). Extension
now resolves its DuckDB dependency relative to its own location: a
self-relative RPATH ($ORIGIN/@loader_path) baked in via RUSTFLAGS for dev
builds, maturin's built-in --auditwheel repair for published wheels, and
os.add_dll_directory() on Windows, backed by a clear diagnostic that
distinguishes a missing library from one that's present but won't load.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(ci): unlink before overwriting installed chunkhound_native to avoid poisoning uv's package cache

cp/shutil.copy2 overwrite file content in place; when the target is
hardlinked into uv's shared cache (same filesystem as $UV_CACHE_DIR), that
mutates the cache itself, so later unrelated venvs on the same runner that
install chunkhound-native fresh silently get this dev-only build instead of
the real package. This is what broke the Windows "Verify installed-wheel
Watchman live mutation e2e" CI job on PR #380.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): close compaction crash-recovery gap and DB-reconnect-on-error, restore lost smoke suite

Found during PR #380 review:

- duckdb_backend.rs: "phase2" crash recovery in open() deleted the
  pre-compaction .old backup unconditionally, without checking whether
  the compact_path -> db_path rename actually completed. A crash in
  that window left db_path missing and the backup destroyed, so the
  next open() silently created an empty database. Recovery now finishes
  the rename first when compact_path still exists.

- indexing_coordinator.py: the Rust pipeline call released the Python
  DuckDB connection but only reconnected it on the happy path. If
  run_rust_pipeline() raised, self._db stayed disconnected for the rest
  of the process. Wrapped in try/finally.

- tests/test_smoke.py: a merge conflict on this file had been resolved
  by deleting it outright, silently dropping the CLI/import/parser/type
  smoke tests AGENTS.md and the Makefile mandate before every commit.
  Restored the non-MCP test classes (the MCP subprocess tests already
  live in tests/mcp/test_smoke.py).

- Removed .pi/tasks/*.json (accidental commit of local agent
  task-tracker state; .gitignore already excludes .pi/) and the empty,
  unreferenced docker/entrypoint.sh stub.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* chore: cross-platform-safe file move in native diagnostics test, tidy bundled-lib error message

Path.rename() across filesystems/drives can fail on Windows; shutil.move()
handles that. Minor f-string readability cleanup in the ImportError message.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(pipeline): dedupe config extraction, use structured errors, rename colliding module, trim implementation-detail tests

Follow-up from the full-checklist pass of the PR #380 review (DRY, module
boundaries, architecture consistency, testing philosophy):

- src/pipeline/config.rs: replaced five near-duplicate get_*_or() extractors
  with the crate's existing generic extract_opt/extract_req pattern from
  db_writer.rs (added a third generic extract_or() there for the
  fallback-to-default case).
- src/pipeline/mod.rs: added the required inline comment to the
  #[allow(clippy::module_inception)] the project's own rule mandates.
- src/pipeline/pipeline.rs: DuckDB errors in compute_diff_blocking() now
  convert to PyErr via the crate's existing DbError -> PyErr impl instead of
  flattening to a generic PyRuntimeError with a hand-formatted message.
- Renamed chunkhound/providers/database/pipeline_bridge.py to
  rust_pipeline_flag.py — it shared a basename with the unrelated, much
  larger chunkhound/pipeline_bridge.py, inviting import/grep confusion.
  Updated all call sites and doc references.
- chunkhound/pipeline_bridge.py: collapsed ~12 repetitions of
  getattr(cfg, attr, default) or default into one _cfg_or() helper.
- tests/contracts/test_parse_pool_reused.py: dropped a test that only
  asserted on a monkeypatched private pool's construction count, and
  removed the remaining test's pool-identity assertion — both violated this
  project's testing philosophy (no tests against private helpers/internal
  plumbing). Kept the PID-equality assertion, which is the actual externally
  observable effect (no per-batch process respawn) a caller would feel as
  wall-clock overhead.

Verified: cargo fmt/clippy -D warnings/test all clean; tests/contracts/
(41 tests) and the feature-flag tests in tests/test_rust_db_writer.py pass.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): stop swallowing parse-thread panics, fix embed skip on Rust fallback

A panicked parse thread's join result was discarded, so the run reported
success despite an incomplete parse; parse_one_batch now also errors
instead of indexing out of bounds if the callback returns a mismatched
result count. IndexingCoordinator.process_directory now reports the
pipeline it actually used (rust vs python fallback for non-DuckDB
providers or non-standard db filenames), and DirectoryIndexingService
uses that resolved value instead of the raw feature flag, so projects
that fall back to Python (e.g. LanceDB-backed) still get their
embedding-generation pass.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(tests): move DuckDB diagnostics fixture files to a same-drive temp dir

shutil.move()'s cross-drive fallback (copy+unlink) fails on Windows CI
because the bundled DuckDB library is already loaded into the process by
this point, and Windows denies deleting an in-use DLL. A plain rename
works even on a loaded DLL as long as source and destination share a
drive, so create the temp dir as a sibling of the package instead of
using pytest's tmp_path (which lives on a different drive in CI).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): close HNSW-restore/thread-reset error-path gaps, un-stick compaction skip, preserve error file context

Four independent Major-severity fixes from PR review:

- pipeline.rs: chain the post-write compaction/HNSW-rebuild step onto
  write_result so a failure there still funnels through the existing
  best-effort backend.close() instead of leaving the connection open
  with HNSW indexes un-restored (Invariant 14).
- duckdb_backend.rs: ensure_all_hnsw_indexes' SET threads=8 -> 1 reset
  now always runs even if a CREATE INDEX/CHECKPOINT in between fails,
  so a failed build can no longer leave the connection pinned at 8
  threads contending with the embed thread pool.
- indexing_coordinator.py: set self._skip_compaction unconditionally
  each call instead of only inside the Rust branch — a cached/reused
  coordinator no longer inherits a stale True from a prior Rust run
  and skips compaction forever on a later Python-path call.
- pipeline_bridge.py: split Rust's "{path}: {message}" error strings
  back into real file/error fields instead of always reporting
  file=None, fixing "Failed to process None: ..." in error logs.
- directory_indexing_service.py: _ensure_hnsw_indexes now uses the
  coordinator's resolved pipeline decision instead of the raw feature
  flag, so a fallback-to-Python run's newly created embedding table
  still gets its HNSW index built.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(tests): dedupe contract-test Rust invocation helpers into pipeline_harness

Four contract tests each hand-duplicated their own _index_with_rust /
DB-query helpers instead of using pipeline_harness.index_with_rust(),
left over from before the harness existed. Extend the harness function
with the compaction/progress-callback/thread-pool knobs those tests
needed, then delete the ~300 lines of duplicated glue and switch each
test to call it directly. Also drops a stale "MUST FAIL until Rust
pipeline is implemented" scaffolding comment now that it's implemented.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs(pipeline): fix stale opt-in/opt-out docstring on run_rust_pipeline

The docstring claimed CHUNKHOUND_USE_RUST=1 opts into the Rust path
with Python as default, but rust_pipeline_flag.py's own docstring and
_get_use_rust() default it to "1" — Rust is the default path and
CHUNKHOUND_USE_RUST=0 opts out. Fix the docstring to match actual
behavior.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(native): remove dead RustDbWriter PyO3 class, port its valuable tests

RustDbWriter was never constructed from Python — pipeline.rs's
IndexingPipeline calls DbBackend/create_backend() directly, bypassing it
entirely. Extensive review-round hardening had accumulated on a class with
zero real callers.

- Delete src/db_writer.rs; move its still-used extract_opt/extract_or
  PyDict helpers into pipeline/config.rs, their only remaining consumer.
- Remove the RustDbWriter registration from lib.rs and the matching
  Python-side try/except import shim in chunkhound_native/__init__.py.
- Delete the now-unusable scripts/bench_db_writer.py (imports RustDbWriter
  directly; already superseded by scripts/bench_pipeline.py per review).
- tests/test_rust_db_writer.py mixed real RustDbWriter-only tests with two
  unrelated things riding along in the same file:
    - Crash-recovery (.swap_intent), compaction-counter, and HNSW-threshold
      tests exercised real DuckDbHnswBackend/DbBackend invariants through
      RustDbWriter as their only PyO3 entry point. Ported to native
      #[cfg(test)] tests in duckdb_backend.rs (crash_recovery_tests,
      compaction_tests, hnsw_threshold_tests, plus one new hnsw_metric_tests
      case) so they keep running without PyO3.
    - TestSchemaParity (DDL-drift guard vs schema_constants.py) only used
      RustDbWriter.open() to trigger schema creation. Moved to
      tests/contracts/test_schema_parity.py, using the Rust pipeline (the
      only remaining production entry point) against the fixture directory
      instead.
    - TestFeatureFlag (rust_pipeline_flag._get_use_rust()) was unrelated to
      RustDbWriter and just lived in the same file. Moved to
      tests/unit/test_rust_pipeline_flag.py.

cargo fmt/clippy/test (26/26) and the affected pytest suites all pass.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): surface compaction ratio/disk usage in summary, fix zombie compact bar

The Rust-mode "Compacting" progress bar was suppressing its before/after
size readout on any run with zero reparsed files (even when the Rust
backend genuinely ran compaction), and force-marking itself "done" when
compaction wasn't needed at all despite never having started — visible
as a stuck spinner with elapsed time "-:--:--". The two branches now
resolve their bars immediately and symmetrically ("not needed" /
"included in compaction"), and compaction size is captured whenever
write-compact fires, regardless of reparse count.

Compaction ratio and before/after disk size (Rust and Python paths
alike) now flow through IndexingStats into the CLI's "Processing
Complete" summary panel instead of being computed and discarded.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(pipeline): remove dead force_reindex field from Rust config dict

force_reindex is fully redundant in the Rust pipeline: the live channel is
the incremental=not force_reindex argument already passed directly to
IndexingPipeline.run() (pipeline_bridge.py:569). The config-dict copy
(PipelineConfig.force_reindex) was parsed but never read anywhere in src/.

Python's own use of force_reindex (gating its own change-detection loop in
the non-Rust path, indexing_coordinator.py:1425) is untouched -- only the
redundant second copy sent to Rust is removed.

Verified via tests/contracts/test_orphan_cleanup_rust_parity.py (the one
test built around force_reindex semantics under Rust) -- it drives
everything through IndexingCoordinator.process_directory() and depends
only on the live incremental channel, unaffected by this change. The ~8
other contract tests that still pass a literal "force_reindex": False in
their manually-built config dicts need no changes -- extract_or() in Rust
simply ignores dict keys it no longer looks for.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* feat(native): wire db_batch_size into Rust INSERT-batching (parity with Python)

The Rust write path hardcoded CHUNK_INSERT_BATCH/EMBED_INSERT_BATCH to 100
rows per INSERT statement instead of reading PipelineConfig.db_batch_size
(itself sourced from Python's indexing.db_batch_size, which already drives
the same concern on the Python path via EmbeddingService.db_batch_size).
Defaults matched by coincidence, so this wasn't a bug -- but a user tuning
indexing.db_batch_size got silently ignored behavior in Rust mode.

DbConfig gains an insert_batch_size field, threaded from
PipelineConfig.db_batch_size (clamped .max(1) -- slice::chunks(0) panics,
and Python's config has no hard lower-bound validation). Written TDD-first:
two new tests (insert_batch_size_tests) prove chunks/embeddings persist
correctly at a batch size of 3 with 7 rows (a boundary that doesn't evenly
divide), rather than asserting internal INSERT-statement counts -- per this
repo's testing philosophy, the legitimate external contract is correctness
under an unusual configured value, not implementation-detail call counts.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* feat(native): mirror Python's mid-run disk_usage_limit_mb enforcement in Rust

Python's indexing path re-checks disk usage before every DB write mid-run
(_check_disk_usage_limit, called from _store_parsed_results); the Rust
pipeline only had the shared pre-run check in indexing_coordinator.py, so
a single large Rust-mode run (huge new repo, or force_reindex) could
overshoot the configured limit by an unbounded amount before the next
process_directory() call's pre-check would ever catch it.

- src/db/duckdb_backend.rs: new check_disk_usage_limit() free function
  mirrors _check_disk_usage_limit's exact semantics -- single stat() on the
  exact chunks.db path (WAL/.compact/.old/.swap_intent sidecars excluded),
  strict >=, fails OPEN on a stat error (never blocks indexing on a
  measurement failure). TDD: 6 unit tests written first (disk_usage_limit_tests).
- src/pipeline/pipeline.rs: store thread now checks before writing each
  incoming batch (pre-write guard, matching Python's once-per-store-call
  granularity -- STORE_COMMIT_INTERVAL==1 keeps this aligned). Unlike
  Python's own behavior (which lets parse/embed keep running wastefully
  after the trip -- an acknowledged inefficiency, not a contract), the
  store thread stops immediately and drops its receiver to force the
  existing panic/error cooperative-shutdown cascade, winding down parse
  and embed early too.
- The trip is threaded as data (StoreOutcome/PipelineReport fields), never
  a raised exception -- Python's own DiskUsageLimitExceededError contract
  is always a clean returned status. pipeline_bridge.py's run_rust_pipeline
  reconstructs the exact error-dict shape indexing_coordinator.py's
  _store_parsed_results already builds, so the coordinator's existing
  generic disk-limit scan picks it up with zero coordinator changes.
- New contract test (test_disk_usage_limit_rust.py) proves the Rust store
  thread's pre-write guard directly; new pipeline_bridge unit tests prove
  the error-dict reconstruction; existing tests/unit/test_disk_usage_limit.py
  (22 tests, Python-path + pipeline-agnostic pre-check) all still pass.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): check disk-usage limit once per window, not once per batch

The disk-usage check ran inside the per-batch for-loop, before
prepare_write() -- which issues real, un-rollback-able DELETEs outside any
transaction. With STORE_COMMIT_INTERVAL == 1 that's safe (the window can
only ever hold 0 or 1 batches when the check runs). But nothing enforced
that constant staying at 1 -- if it's ever raised again (the surrounding
comments note a multi-batch window existed before and was reverted once
already), the check could trip after some batches in the window already
had prepare_write's deletes applied but before write_batches_in_one_txn
ever inserted their replacements: silent, untracked data loss.

Move the check to the top of the outer loop, before the window starts
filling at all. Either the whole window is left completely untouched, or
it's fully processed (deletes AND their matching inserts) -- correct
regardless of STORE_COMMIT_INTERVAL's value. No behavior change today
(a window is always exactly one batch), but the correctness no longer
depends on that constant never changing.

Found via an independent critical-review pass over the disk-usage-limit
commit (fa52e6c0).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(pipeline): never compact after a disk-limit trip

run_compaction()'s EXPORT/IMPORT rewrite needs a full second copy of the
database on disk (old + new coexist until the swap), transiently roughly
doubling disk usage. Post-write logic ran this unconditionally whenever
needs_compaction() said so, even right after the store thread had just
determined the DB is already at/over the configured disk-usage limit --
doing the one thing most likely to make that exact problem worse, directly
undercutting what the check was for.

needs_compaction() is now never even called once disk_limit_hit is set;
falls back to the cheaper ensure_all_hnsw_indexes() over whatever was
already written. Actual compaction is deferred to a future run, where
indexing_coordinator.py's pre-run check will catch the still-over-limit
condition before any writes start.

New contract test forces compaction eligibility (compaction_threshold=0.0,
compaction_min_size_mb=0 -- same technique as test_compaction_before_index.py)
simultaneously with a disk-limit trip and asserts "write-compact" never
fires while "write-index" does.

Found via an independent critical-review pass over the disk-usage-limit
commit (fa52e6c0).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(native): collapse disk-limit fields into one Option, dedupe error-dict shape

Two related cleanups from an independent critical-review pass over the
disk-usage-limit commit (fa52e6c0):

1. PipelineReport exposed the disk-limit trip as three independent fields
   (disk_limit_exceeded: bool, disk_limit_current_mb: Option<f64>,
   disk_limit_max_mb: Option<f64>) -- an illegal state was representable
   (exceeded=true with a None mb value would raise TypeError formatting
   None with .1f in pipeline_bridge.py). Collapsed into a single
   disk_limit: Option<(f64, f64)> -- either both numbers or nothing,
   nothing in between.

2. The disk-limit error message and dict shape
   ({"file", "error", "disk_limit_exceeded", "current_size_mb", "limit_mb"})
   was hand-duplicated in pipeline_bridge.py, indexing_coordinator.py's
   _store_parsed_results, and DiskUsageLimitExceededError's own message
   format -- three independently-maintained copies of the same contract.
   Added DiskUsageLimitExceededError.to_error_dict() as the single source
   of truth; both the Python and Rust paths now construct the exception
   and call it, rather than rebuilding the dict inline.

tests/contracts/pipeline_harness.py's IndexResult keeps its three separate
convenience fields for easy test assertions -- only the actual FFI-boundary
type (PipelineReport) and the duplicated dict-building logic changed.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* test(contracts): cover concurrent multi-batch shutdown for disk-usage-limit trips

Every existing disk_usage_limit_mb test used the default parse_batch_size,
which collapses the 5-file fixture into a single batch -- so store's
drop(store_rx) cascade on trip never had anything queued upstream to
cancel. Expose parse_batch_size on the harness and add a test with 50
files at parse_batch_size=1 to prove the shutdown cascade drains dozens
of in-flight batches without hanging.

* fix(tests): assert_identical must catch duplicate chunk/embedding rows

set()-based comparison discarded duplicate multiplicity -- a chunk written
twice on one side and once on the other reduced to the same set and passed
silently, with chunks_written (a separate counter, not len(chunk_tuples))
providing no backstop. Switch to Counter so multiplicities must match too.

* refactor(ci): extract shared build-native-wheel composite action

release.yml and release-rc.yml each carried a byte-identical ~95-line
copy of the maturin build + smoke-test steps for the native wheel,
differing only in comments. Extract into .github/actions/build-native-wheel,
mirroring the existing build-rust-extension composite action pattern,
so the two release pipelines can't silently drift apart.

* fix(rust): justify or remove clippy allows per AGENTS.md rule

AGENTS.md mandates an inline comment on every #[allow(clippy::...)] --
three were missing:

- lib.rs's crate-wide useless_conversion allow had its explanatory
  comment accidentally dropped in 31fd16c2 while adding `mod pipeline;`.
  Restored.
- run()'s too_many_arguments allow is dead: the function only has 7
  params (incl. &mut self), under clippy's default threshold of 8 --
  verified by removing it and running clippy clean. Removed rather than
  justifying a no-op allow.
- pipeline_parse_embed_store()'s too_many_arguments allow is genuinely
  needed (14 params, each with distinct per-thread ownership semantics)
  -- added the justification.

* fix(native): make rust-pipeline mandatory, remove silent None fallback

There's no supported build without the Rust indexing pipeline, so the
optional `rust-pipeline` Cargo feature only created a code path where
IndexingPipeline/PipelineReport/ParseCallConfig silently became None
and later crashed deep in pipeline_bridge.py with a confusing TypeError
instead of a clear error. Compile them in unconditionally and let a
genuinely broken build fail loudly at import time instead.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs(rust-pipeline): sync design doc with shipped implementation

The doc still described an early planning-phase design that diverged
from what was actually built: opt-in rollout vs. the real opt-out
default, a callback contract that doesn't match run()'s real
signature, an undercounted test suite (9 vs. the real 21 contract
tests), references to state.rs/pipeline_service.py that were never
created, and the now-removed rust-pipeline Cargo feature. Corrected
each section against the current code and added a banner marking this
as a historical design record, pointing to src/pipeline/*.rs and
chunkhound/pipeline_bridge.py as the source of truth for exact
contracts.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* docs(rust-pipeline): remove design doc from repo

Moved out of the repo to ~/views for personal reference.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(native): surface silent cosine fallback when HNSW metric is unknown

ensure_all_hnsw_indexes() silently rebuilt with metric='cosine' whenever
saved_hnsw_metrics had no entry for a dims value — e.g. after a mid-run
crash between drop_all_hnsw_indexes() and ensure_all_hnsw_indexes(),
since the metric cache only lives in memory for the current process.
No production path creates a non-cosine index today (every call site
hardcodes "cosine"), so this can't lose real data yet, but the fallback
was silent. Log a warning instead so a future non-default metric (or a
manually-created custom index) doesn't quietly regress to cosine
without a trace.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(native): delete dead per-batch HNSW lifecycle (finish_write)

The real pipeline (src/pipeline/pipeline.rs) only ever drives the bulk
HNSW lifecycle: drop_all_hnsw_indexes() once, write many batches, then
ensure_all_hnsw_indexes() once. It never calls write_batch() directly,
so finish_write() and the per-batch pending_hnsw_indexes/pending_new_dims
bookkeeping it consumed — along with prepare_write's non-bulk-mode
index drop/cache branch — were a second, untested-by-production
implementation of the same job, only exercised by unit tests calling
write_batch() in isolation.

Removed finish_write() (trait + impl), the two pending_* fields, the
now-fully-dead hnsw_cache field (its only reader was the removed
branch), and the drop_hnsw_indexes/recreate_hnsw_indexes helpers that
only that branch called. write_batch() still works for its remaining
real callers (tests exercising upsert-by-id, batch-size chunking,
etc.) — it just no longer carries per-batch HNSW bookkeeping nothing
in production ever consumed.

Deleted the tests that specifically covered the removed path
(test_finish_write_new_dims_uses_saved_hnsw_metric,
recreate_hnsw_indexes_preserves_non_cosine_metric, and the
hnsw_threshold_tests module) since they tested per-batch HNSW
triggering that no longer exists. Verified via the full contract-test
suite (48/48) that the real bulk-mode lifecycle is unaffected.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(tests): stop hand-rolled set() diffing from hiding duplicate chunks

test_incremental_updates.py and test_pipeline_parallel.py compared
chunk_tuples via set() difference instead of the Counter-based multiset
comparison this same PR already fixed in assert_identical() (see
f0015114 and test_assert_identical_multiset.py). A set collapses
duplicate copies of the same row, so a stale duplicate chunk left
behind by a buggy incremental re-index — exactly the scenario these
two tests exist to catch — would show up as zero missing/extra and
pass silently.

Extracted assert_identical()'s Counter-diffing logic into a reusable
assert_chunk_multiset_identical() helper in pipeline_harness.py (used
by assert_identical itself, so there's one implementation instead of
three), and switched both tests to call it instead of hand-rolled
set() logic. Confirmed the helper actually catches a duplicate-row
case that the old set()-based check would have silently passed.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(build): make `make dev`/`make dev-release` actually build

Both targets were missing DUCKDB_DOWNLOAD_LIB=1 and the self-relative
RPATH RUSTFLAGS that every other build path (CI, RUST_COMMANDS in
AGENTS.md) already requires, so `maturin develop`/`maturin build`
failed at link time with "unable to find library -lduckdb" on a clean
checkout. Neither target ran scripts/copy_duckdb_runtime.py either, so
even a successful link would still fail at import time looking for the
DuckDB runtime library next to the compiled extension.

Also found and fixed a real repeat-invocation bug while testing this:
maturin's release wheel-repair step renames the linked libduckdb.so to
a hashed name IN PLACE inside cargo's own cached build artifact
(target/release/deps/libchunkhound_native.so). A second `make
dev-release` run with no source changes reuses that cached artifact
via cargo's fingerprinting and fails looking for the hashed name from
the now-deleted previous wheel. `cargo clean -p chunkhound_native
--release` before each build forces a fresh relink so this is safe to
run repeatedly.

Verified by running `make dev` and `make dev-release` (including twice
in a row) end to end on a fresh build.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(ci): call make rust-check/rust-test instead of duplicating them

rust-checks had its own copy of the fmt/clippy/test commands the
Makefile already defines, so a future change to the Makefile recipe
(e.g. a new clippy flag) wouldn't propagate to CI without someone
remembering to update both places by hand. Route through
`make rust-check`/`make rust-test` so there's exactly one place that
defines how the Rust code is linted and tested.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* fix(cli): stop collapsing Rust log levels to WARNING

The stdlib-logging-to-loguru bridge relabeled every chunkhound_native
record as WARNING so Rust's routine log::info! progress lines would
clear loguru's WARNING-only default console threshold. That made a
real log::warn! (e.g. a disk-usage-limit trip) visually identical to
routine progress output, defeating the purpose of having levels at all
on the newest, most failure-prone part of the pipeline.

Preserve the record's real level and instead widen visibility only for
Rust-origin records: tag them via logger.bind(rust_native=...), then
gate the default (non-verbose) sink with a filter that admits Rust
records at INFO+ while still requiring WARNING+ for everything else.
Verified directly: Rust INFO now shows as INFO (previously WARNING),
Rust WARNING still shows as WARNING, non-Rust INFO stays suppressed,
non-Rust WARNING still shows -- both with and without --verbose.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(db): replace concrete DuckDBProvider isinstance check with capability

IndexingCoordinator is written against the abstract DatabaseProvider
protocol so it can work with any backend, but its Rust-pipeline gate
imported the concrete DuckDBProvider class and did isinstance(self._db,
DuckDBProvider) -- the only place in the file coupled to one specific
backend implementation instead of the interface.

Added supports_rust_pipeline to the DatabaseProvider protocol,
defaulting to False on SerialDatabaseProvider (inherited by LanceDB and
any future backend) and overridden to True on DuckDBProvider. The
coordinator now checks getattr(self._db, "supports_rust_pipeline",
False) -- same defensive getattr style already used for db_path just
below it for test fakes -- so it never needs to know concrete provider
class names.

Updated the stale docstring in test_rust_pipeline_lancedb_fallback.py
that described the old isinstance mechanism. Verified via the full
contract suite (48/48) plus the directly related unit/integration
tests (79/79, 1 pre-existing skip from an unrelated broken lancedb/six
dependency in this environment).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(config): unify the two independent CHUNKHOUND_USE_RUST readers

file_patterns.py froze _USE_RUST at import time while
rust_pipeline_flag.py's _get_use_rust() read the env var at call time
-- two independent copies of the same check that could disagree if the
env var changed after file_patterns had already been imported (e.g. a
long-lived process or a test that sets it mid-run).

Relocated rust_pipeline_flag.py from providers/database/ to utils/ (it
has no DB-specific dependency -- it only reads os.environ -- and utils
is already the layer providers/database imports from, never the
reverse) and made it the single call-time-evaluated source both
file_patterns.py and indexing_coordinator.py/directory_indexing_service.py
read, instead of file_patterns.py keeping its own frozen copy.

Updated test_rust_scanner.py's ~7 call sites that directly poked the
now-removed fp._USE_RUST module attribute to use
monkeypatch.setenv("CHUNKHOUND_USE_RUST", ...) instead, matching the
pattern test_rust_pipeline_flag.py already used -- monkeypatch also
auto-restores the env var, so the manual try/finally/original dance
is no longer needed. Updated stale docstring references to the old
module path in test_rust_pipeline_lancedb_fallback.py.

Verified: full contract suite (48/48), the directly affected unit
tests (12/12), and the broader indexing_coordinator/directory-service
test suites (43/43, 1 pre-existing skip) all pass.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* refactor(rust): remove dead write_count compaction fallback

The Rust pipeline's production write path never incremented write_count,
so needs_compaction()'s write-count threshold fallback was permanently
unreachable dead code. The metric-based (free-space/row-waste) detection
is the only signal that ever fires in practice, so drop the counter and
its plumbing (DbConfig field, Rust/Python config wiring, and the unit
tests that only existed to exercise the dead fallback) instead of fixing
…
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.

4 participants