feat(watch): periodic reindex backstop + status freshness signal (#44)#47
Merged
Conversation
Index freshness previously hinged entirely on the file watcher. A process restart, a high-churn burst, or a dropped inotify event could leave content silently stale until a manual reindex, with nothing to detect or correct it. Backstop: `bobbin watch` now runs a periodic full-tree reconciliation (on by default, every 15 min; `--reindex-interval-secs`, 0 disables). Each sweep reuses the same collector `bobbin index` uses, re-embeds files whose content hash drifted, and prunes rows for files that vanished from disk. Sweeps are incremental — unchanged files are hash-skipped — so a sweep where the watcher kept up does almost no work. Signal: `bobbin status` gains a Freshness line (and JSON field) that flags the index stale when the current git HEAD is newer than the last index run. Uses commit time, not wall-clock, so a quiet repo with no new commits is never a false positive. Fixes #44 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VsuPDxSUjMYqHvQyPvSAPW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #44. Index freshness previously hinged entirely on the file watcher. If a watcher missed or dropped events — a process restart, a high-churn burst, a source indexed without an active watcher — the affected content went silently stale, with nothing to detect or correct it until a manual reindex.
Backstop (freshness no longer hinges solely on watchers)
bobbin watchnow runs a periodic full-tree reconciliation, on by default, every 15 min (--reindex-interval-secs,0disables). Each sweep:bobbin indexuses,Removeevents).Sweeps are incremental — unchanged files are hash-skipped — so a sweep where the watcher kept up does almost no work.
Staleness signal (drift is now observable)
bobbin statusgains a Freshness line (and a JSONfreshnessfield) that flags the indexstalewhen the current git HEAD commit time is newer than the last index run. Using commit time rather than wall-clock means a quiet repo with no new commits is never a false positive.Tests
Freshness::compute— head-newer / head-older / equal / never-indexed.format_durationunit formatting.Follow-up (not in scope)
A richer per-repo "no active watcher" flag needs a watcher registry that doesn't exist yet; the HEAD-vs-index signal covers the drift case today. Happy to file that separately if wanted.
🤖 Generated with Claude Code