Skip to content

CodeDB 0.2.5863

Choose a tag to compare

@justrach justrach released this 09 Nov 09:18
· 2 commits to main since this release

CodeDB 0.2.5863

Reuses chunk embeddings across codedb semantic-index builds, tolerates stale ANN sidecars during codedb context queries, and prevents in-root codedb.snapshot files from self-indexing.

Incremental semantic-index and crash-safe checkpointing (#775)

codedb semantic-index now persists a local binary embedding cache (semantic-embeddings-v1.cache, 0600 permissions) in the project data directory alongside the HNSW sidecar:

  • Each chunk card is keyed by a 128-bit CardKey over (path, line_start, line_end, card_text).
  • On rebuild, after verifying live calibration cosine (>= 0.9999) and vector space compatibility, unchanged chunk vectors are reused directly from disk without re-embedding.
  • semantic-embeddings-v1.cache is written atomically before the final RepositoryChangedDuringAnnBuild check so an interrupted or mid-edit build retains all computed embeddings for the next run.

Stale-ANN query tolerance (#775)

codedb context no longer discards the entire HNSW index when HEAD advances or a small set of files changes after semantic-index:

  • Commit-only HEAD changes with identical repository content pass freshness validation immediately.
  • When files have been modified, added, or deleted since the ANN build, semantic-embeddings-v1.cache supplies the sorted per-file build manifest ((path, content_hash, size, line_count)) via a header-prefix read that does not load cached vectors into RAM.
  • HNSW hits from modified or deleted files are filtered out, while bounded chunks from modified or newly added safe files (up to max_documents - 2 = 22 chunks, gated by isRemoteCandidatePathAllowed) are embedded in the same single HTTP request as [query, calibration_text, ...delta_cards], exact-scored (1.0 - cosine), and merged with HNSW results.
  • If the delta exceeds the single-request budget, searchLoaded falls back cleanly to the existing bounded exact-scoring path.

Provider resilience, vector space stability, and watcher snapshot filtering (#750, #760, #761, #766, #775)

  • URL-independent vector space ID: Config.vectorSpaceId() now hashes (model, dimensions) (or optional CODEDB_EMBEDDINGS_SPACE_ID) rather than the endpoint URL/port, while Config.matchesVectorSpaceId() preserves backward compatibility with existing sidecars built under legacy URL hashing.
  • Optional exact-fallback disable: CODEDB_SEMANTIC_NO_EXACT_FALLBACK=1 allows slow local CPU embedders to skip synchronous 23-document exact fallback on unindexed repos while keeping hosted exact fallback enabled by default.
  • Provider status & transport retry: All HTTP 500..599 responses classify as EmbeddingProviderUnavailable (#761), and transient transport errors (UnknownHostName, TemporaryNameServerFailure, ConnectionResetByPeer, ConnectionRefused, HttpConnectionClosing) retry once inside the existing request deadline (#750).
  • Snapshot exclusion & scan ordering: shouldSkipFile and collectInitialScanEntries now exclude codedb.snapshot and codedb.snapshot.*.tmp, and scanBg completes writeSnapshotDual and index compaction before signaling scan_done and .ready (#766).
  • Toolchain: Upgrades the release compiler and package minimum_zig_version from 0.17.0-dev.813+2153f8143 to official Zig 0.17.0.

Verification

  • Official Zig 0.17.0, arm64 macOS:
    • Full unit test suite (zig build test): 37/37 steps succeeded; 1,692/1,705 tests passed (13 skipped), 0 failures, 0 leaks.
    • ReleaseFast CLI build (zig build -Doptimize=ReleaseFast) and MCP E2E suite (scripts/e2e_mcp_test.py): 76/76 passed.