fix: allow index clear to recover from incompatible index schemas - #171
Mahnoor-Zaffar wants to merge 4 commits into
Conversation
…gression detection (#1) * feat(benchmarks): add reproducible indexing-latency benchmark Adds a command that generates synthetic media via FFmpeg testsrc2 and measures per-stage indexing throughput, per-stage wall time, and peak memory across configurable modalities. Supports regression detection against a prior baseline report. - : corpus generation, run orchestrator (drives real run_index/ModelRuntime), per-stage aggregation, baseline comparison - CLI command with --modalities, --videos, --duration-seconds, --resolution, --repetitions, --input-mode (transcript/transcribe), --audio-mode, --baseline, --baseline-tolerance - documents the protocol, output schema, and limitations - 23 unit tests for validation, aggregation, clip command building, baseline comparison, and corpus spec * fix(benchmarks): address CodeRabbit review issues - Reject resolutions with extra components (e.g. 320x180x1) - Accumulate record_counts across repetitions instead of overwriting - Move corpus generation inside try block for proper failure handling - Pass reset parameter through instead of hardcoded True - Validate baseline configuration compatibility before comparison
Clear and reindex both validated the active snapshot before proceeding, so an older index_schema_version manifest raised IndexSchemaError and blocked recovery. Index clear now reads the active snapshot without per-generation manifest validation and also discards the Chroma collections so a rebuild recreates them with the current embedding dimensions. Source media is preserved; generated index data is removed. Internal-only; no automatic migration of old indexes.
|
Hey! Wanted to flag a few follow-ups that I think would make this fix feel complete for the exact scenarios in #167. This PR clears the main blocker: running
Optional extras: cleaning up the orphaned generation directories left behind from the old schema, and adding a CLI-level test for Net effect: new code → status says |
Fixes #167 — Cannot clear or rebuild an index after an index schema upgrade.
What changed
vidxp index clear --yesand reindexing both validated the active snapshot before proceeding, so an index containing generation manifests with an olderindex_schema_versionraisedIndexSchemaErrorand blocked recovery. Clearing also only published an empty snapshot, leaving the Chroma collections intact with their old embedding dimensions.This change makes recovery possible after an intentional schema change:
LocalSnapshotRepository.clear()now reads the active snapshot without per-generation manifest validation (validate_generations=Falsethreaded throughread_active/read_snapshot), so an incompatible manifest no longer blocks publishing the empty snapshot. Corrupt snapshot/pointer metadata still fails closed.SQLSnapshotRepository) gets the same tolerantclear()and threads the flag through_publish.LocalIndexBackend.clear()now also discards the vector collections (IndexStorage.clear()on the repository store) so a rebuild recreates them with the current embedding dimensions. Missing/empty stores are tolerated.index clearconfirmation and output now state that generated index data and vector collections are removed while imported source media is preserved.No automatic migration — reindex/status still reject incompatible manifests; the supported recovery is
clear, then rebuild from existing imported media.Validation
uv run --no-sync ruff check .— passestest_clear_recovers_from_incompatible_generation_schematest_clear_discards_incompatible_vector_collectionsuv run --no-sync pytest -q— 793 passed. Pre-existing environment failures only: 8 tests need optional model/deps not installed here (torch,opencv,transformers,av), and 5 infra tests import a top-levelutilspackage (confirmed failing on base too).