codespine 1.0.0__tar.gz → 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codespine-1.0.0 → codespine-1.0.1}/PKG-INFO +1 -1
- {codespine-1.0.0 → codespine-1.0.1}/codespine/__init__.py +1 -1
- {codespine-1.0.0 → codespine-1.0.1}/codespine/db/duckdb_store.py +33 -1
- {codespine-1.0.0 → codespine-1.0.1}/codespine.egg-info/PKG-INFO +1 -1
- {codespine-1.0.0 → codespine-1.0.1}/pyproject.toml +1 -1
- {codespine-1.0.0 → codespine-1.0.1}/LICENSE +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/README.md +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/analysis/__init__.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/analysis/community.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/analysis/context.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/analysis/coupling.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/analysis/crossmodule.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/analysis/deadcode.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/analysis/flow.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/analysis/impact.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/cache/__init__.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/cache/result_cache.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/cli.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/config.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/db/__init__.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/db/_cypher_compat.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/db/schema.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/db/store.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/diff/__init__.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/diff/branch_diff.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/guide.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/indexer/__init__.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/indexer/call_resolver.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/indexer/di_resolver.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/indexer/engine.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/indexer/java_parser.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/indexer/symbol_builder.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/mcp/__init__.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/mcp/server.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/noise/__init__.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/noise/blocklist.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/overlay/__init__.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/overlay/git_state.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/overlay/merge.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/overlay/store.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/search/__init__.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/search/bm25.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/search/fuzzy.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/search/hybrid.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/search/rrf.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/search/vector.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/sharding/__init__.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/sharding/router.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/sharding/store.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/watch/__init__.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/watch/git_hook.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine/watch/watcher.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine.egg-info/SOURCES.txt +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine.egg-info/dependency_links.txt +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine.egg-info/entry_points.txt +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine.egg-info/requires.txt +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/codespine.egg-info/top_level.txt +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/gindex.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/setup.cfg +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_branch_diff_normalize.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_call_resolver.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_community_detection.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_cypher_compat.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_deadcode.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_duckdb_store.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_index_and_hybrid.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_java_parser.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_multimodule_index.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_overlay.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_result_cache.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_search_ranking.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_sharding.py +0 -0
- {codespine-1.0.0 → codespine-1.0.1}/tests/test_store_recovery.py +0 -0
|
@@ -201,7 +201,39 @@ class DuckDBStore:
|
|
|
201
201
|
from codespine.overlay.store import OverlayStore
|
|
202
202
|
self.overlay_store = OverlayStore()
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
# Prefer snapshot for read-only access; fall back to write path.
|
|
205
|
+
snap_exists = os.path.exists(self._snapshot_path)
|
|
206
|
+
db_file = self._snapshot_path if read_only and snap_exists else self._db_path
|
|
207
|
+
|
|
208
|
+
# ----------------------------------------------------------------
|
|
209
|
+
# Legacy KùzuDB migration guard
|
|
210
|
+
# KùzuDB stores its database as a *directory*; DuckDB uses a single
|
|
211
|
+
# file. When CODESPINE_BACKEND is changed to "duckdb" an existing
|
|
212
|
+
# KùzuDB shard directory sits at the same path and DuckDB refuses to
|
|
213
|
+
# open it. Detect this case, wipe the directory, and start fresh.
|
|
214
|
+
# ----------------------------------------------------------------
|
|
215
|
+
for legacy_path in (self._db_path, self._snapshot_path):
|
|
216
|
+
if os.path.isdir(legacy_path):
|
|
217
|
+
LOGGER.info(
|
|
218
|
+
"Removing legacy KùzuDB directory at %s — "
|
|
219
|
+
"re-index with 'codespine analyse' to rebuild.",
|
|
220
|
+
legacy_path,
|
|
221
|
+
)
|
|
222
|
+
shutil.rmtree(legacy_path)
|
|
223
|
+
|
|
224
|
+
# Re-evaluate db_file after possible cleanup.
|
|
225
|
+
snap_exists = os.path.exists(self._snapshot_path)
|
|
226
|
+
db_file = self._snapshot_path if read_only and snap_exists else self._db_path
|
|
227
|
+
|
|
228
|
+
# When opening read-only and no snapshot exists yet, open the write
|
|
229
|
+
# DB in read-only mode so callers get an empty-but-valid store rather
|
|
230
|
+
# than an error.
|
|
231
|
+
if read_only and not snap_exists and not os.path.exists(self._db_path):
|
|
232
|
+
# No data at all — open an in-memory DB so queries return [] cleanly.
|
|
233
|
+
self._conn = duckdb.connect(":memory:")
|
|
234
|
+
self._ensure_schema()
|
|
235
|
+
return
|
|
236
|
+
|
|
205
237
|
os.makedirs(os.path.dirname(db_file) or ".", exist_ok=True)
|
|
206
238
|
self._conn: duckdb.DuckDBPyConnection = duckdb.connect(db_file, read_only=read_only)
|
|
207
239
|
if not read_only:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|