Repository navigation
Add explicit backed-up embedding index rebuild - #119
blast-hardcheese wants to merge 7 commits into
Conversation
2b1c45d to
59afdf5
Compare
There was a problem hiding this comment.
Confidence Score: 4/5
Summary
Adds explicitly confirmed, backed-up kin embed rebuild with fail-closed preflight, transactional reset and drain-based resume. Deferred-with-pending now fails and unknown-queue storage faults keep recovery guidance; 55 rebuild/health and 232 related tests pass locally.
Important Files Changed
| File | Overview |
|---|---|
| src/kindex/embedding_rebuild.py | Rebuild flow; deferred+pending now failed, unknown-pending failures get resume and message |
| src/kindex/vectors.py | Public rebuild interfaces: validate, plan, probe, stage queue; lock alias |
| src/kindex/cli.py | embed rebuild subcommand, confirm prompt, output, cancelled exits 1 |
| src/kindex/snapshots.py | Public default_state_root; keep accepts None |
| src/kindex/embedding_health.py | Mismatch guidance now points to kin embed rebuild |
| tests/test_embedding_rebuild.py | 28 CLI cases incl. deferred-edit exit and storage-fault recovery |
| tests/test_kindex_embedding_health.py | Updated doctor message assertions |
| README.md | Rebuild procedure, quiescence requirement, restore guidance |
| CHANGELOG.md | Unreleased Added entry |
| .kin/knowledge.json | Two concept records for calibration invalidation and JSON output |
Findings
src/kindex/embedding_rebuild.py:110— Deferred-to-failed sets no message, so text output reads "failed; 1 embedded, 0 failed" with no reason; add a message with deferred_reason and pending count.
Reviewed 528566c...bd8e384 · ↻ Re-run review · View in Adapt
|
Addressed both new findings in the updated Adapt review, published in
Known-empty completed/rolled-back and quarantine-only cases still receive no misleading resume hint. Ordinary drain/reindex behavior is unchanged. Validation: 4,986 passed, 4 skipped, 286 subtests passed; separately 28 rebuild + 27 embedding-health cases passed. |
|
Verified and addressed the latest deferred-message finding in the updated Adapt review, published as The human-readable result now explains The real concurrent-edit CLI regression failed before the fix in both text and JSON modes and now passes in both, including successful later drain. Validation: 29 rebuild + 27 health cases passed; full suite 4,987 passed, 4 skipped, 286 subtests passed; |
|
Published the three fresh independent-audit fixes in
All three findings were verified before changing implementation; none declined. 36 rebuild + 27 health cases passed; full suite 4,994 passed, 4 skipped, 286 subtests passed. README and PR body document the result/exit contract and follow-ups. Hosted validation is running. Sim remains advisory, not Jeremy's human approval. No merge or release. |
Follow-up to Preserve embedding indexes and report coverage health, released in 0.54.2. Based on main
528566c; no version bump or release.Adds
kin embed rebuildfor deliberate replacement of all derived vectors using the configured identity. Preview includes the selected database, stored/target fingerprints, eligible count and estimated tokens/cost. Confirmation defaults to no; unattended runs require--yes. Credential/backend checks and an approved paid readiness probe precede destruction. Provider defaults and user configuration are unchanged; ordinary indexing/search still refuse incompatible identities and recommend restoring matching configuration first. All clients of a shared graph must resolve the same identity after rebuilding.A validated whole-database SQLite backup is mandatory and reported before reset. Each rebuild retains its copy outside normal snapshot rotation until the operator manually deletes it. The writer lock and SQLite reservation protect backup/reset. Pause writing clients during approval/preflight, including access-time writes. Reset atomically replaces derived vectors, checkpoints and the queue, invalidating only the target model's active grounding calibration. Nodes, edges, FTS, history, other calibrations and calibration history remain intact. Semantic search is interrupted; this is not an atomic index switchover.
Rebuild stages the full selected set without the ordinary enqueue cap and uses the existing drain lifecycle. Matching quarantine survives; new terminal input rejections remain tracked; transient failures remain queued. Successful vectors/checkpoints survive failures.
okcompleted_with_quarantinekin embed status, do not re-run rebuild for thisfailed,persistence_error,unavailable,refused,cancelledcompleted_with_quarantineis Devon's explicit exit-code decision for both pre-existing and newly diagnosed quarantine. JSON retainsquarantined,coverage_complete,queue_pendingand failed-attempt counts; incomplete coverage is not operation failure in this state. The text plainly reports that the index was replaced and how many quarantined inputs were not embedded. Failed-attempt count can be positive for newly quarantined inputs even with exit0.After a committed reset, interruption prints the backup, readable pending count and recovery command to stderr, then re-raises. Pre-reset interrupts give no resume advice. Recovery uses
kin embed drain --max-jobs N --time-budget infwith N equal to the pending queue size, including already-fresh entries, so the backlog can be visited in one pass. If the count is unknown, inspect status first; the command uses a deliberately largesys.maxsizejob bound. Use the same graph/config selection. Do not repeat rebuild to resume. New arrivals after a queue snapshot may require another drain. README covers restoration and its effect on later graph edits.Verbose rebuilds report visited-entry/embedded counts during the pass on stderr, including with
--json; normal-return JSON stdout stays one document. Ordinary drain output and fresh-entry job-cap accounting are unchanged. Public vector interfaces provide locking, validation, planning, probing, queue snapshots/staging and optional progress notification; snapshots exposes its root. Existing private lock/root names remain compatibility aliases.Known follow-ups (not implemented here):
max_jobs; change that accounting separately. Current recovery guidance sizes the cap to the full queue.Validation at
70b9bce0899e852a09ef71154c52a71a03eb4ee7:git diff --checkpassed. Current common-footguns taxonomy reverified; affected completion/cancellation/durability/output boundaries reviewed. Existing knowledge records preserved.testpassed on this head (run); Proof was skipped; covering post-fix Adapt validation has not been posted. Human review remains required; readiness is not claimed.Diff against main: 10 files, 1,279 additions / 19 deletions. Latest repair: 5 files, +263/-26. Head:
70b9bce0899e852a09ef71154c52a71a03eb4ee7.