Repository navigation
CodeDB 0.2.5863
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
CardKeyover(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.cacheis written atomically before the finalRepositoryChangedDuringAnnBuildcheck 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
HEADchanges with identical repository content pass freshness validation immediately. - When files have been modified, added, or deleted since the ANN build,
semantic-embeddings-v1.cachesupplies 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 = 22chunks, gated byisRemoteCandidatePathAllowed) 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,
searchLoadedfalls 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 optionalCODEDB_EMBEDDINGS_SPACE_ID) rather than the endpoint URL/port, whileConfig.matchesVectorSpaceId()preserves backward compatibility with existing sidecars built under legacy URL hashing. - Optional exact-fallback disable:
CODEDB_SEMANTIC_NO_EXACT_FALLBACK=1allows 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..599responses classify asEmbeddingProviderUnavailable(#761), and transient transport errors (UnknownHostName,TemporaryNameServerFailure,ConnectionResetByPeer,ConnectionRefused,HttpConnectionClosing) retry once inside the existing request deadline (#750). - Snapshot exclusion & scan ordering:
shouldSkipFileandcollectInitialScanEntriesnow excludecodedb.snapshotandcodedb.snapshot.*.tmp, andscanBgcompleteswriteSnapshotDualand index compaction before signalingscan_doneand.ready(#766). - Toolchain: Upgrades the release compiler and package
minimum_zig_versionfrom0.17.0-dev.813+2153f8143to official Zig0.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.
- Full unit test suite (