Skip to content

v0.1.4: a new embedding model needs --rebuild instead of wiping the index - #3

Merged
puretensor merged 1 commit into
mainfrom
fix/refuse-model-change-without-rebuild
Oct 17, 2026
Merged

puretensor merged 1 commit into
mainfrom
fix/refuse-model-change-without-rebuild

Conversation

@puretensor

Copy link
Copy Markdown
Owner

Fixes the known issue carried over from #1: changing the embedder name wiped the index without --rebuild. A puremind watch left running on the old config and a fresh puremind index on the new one kept wiping each other, and each wipe meant a full re-embed.

Behaviour

Situation Before (0.1.3) Now
puremind index, model or embedder_revision changed empties the index, re-embeds every note error: the index was built with A but B is configured; nothing was changed + hint to run --rebuild, exit 2
puremind index --rebuild, model changed probe, empty, re-embed unchanged
puremind watch whose model differs from the index's wipes and re-embeds stops, exit 2, hint: restart the watch if the model changed since it started, otherwise --rebuild
Model changed, index holds no notes takes the new model unchanged (nothing to lose)
Search with a mismatched model refused, says --rebuild unchanged

The refusal comes before the probe passage, so a refused run embeds nothing.

Changes

  • indexer.py: new ModelMismatch(ValueError). index_vault raises it when the model or revision changed, the index holds notes, and rebuild is not set.
  • cli.py: cmd_index reports it with a --rebuild hint. cmd_watch stops on it the same way it already stops on VaultMismatch, with a restart hint. --rebuild help text updated.
  • models.py: a comment at PINNED_REVISIONS. A future release that changes the pinned embedder revision now makes every existing index need --rebuild, so its release notes must say so.
  • README, CHANGELOG (## 0.1.4 (unreleased)), __version__ = "0.1.4".

Validation

  • pytest -q: 599 passed, 6 skipped. ruff check src tests bench (0.17.1): clean.
  • Four tests that relied on the wipe now use rebuild=True and check the refusal first. New tests: the empty-index case, the CLI index refusal and recovery, and the stale-watch scenario (a watch on old-model meets an index rebuilt for new-model, stops with exit 2, and the index keeps its 3 notes). The 5 behavioural tests fail against the previous source.
  • End-to-end CLI run with a stub model: index (A), then index (B) is refused with exit 2, then index --rebuild (B) rebuilds.

Not on the model-loading path, so the real-models job isn't needed for this one.

🤖 Generated with Claude Code

https://claude.ai/code/session_011zd8G1cibJoQPVbZEpVLYs

…ndex

`puremind index` with a changed embedder name or embedder_revision emptied
the index and re-embedded every note. A `watch` left on the old config and
a fresh `index` on the new one wiped each other in turn, with a full
re-embed each time.

- index_vault raises ModelMismatch (nothing changed, no probe embedded)
  when the model or revision differs from the one the index was built
  with and rebuild is not set. --rebuild keeps the probe-then-clear path.
  An index that holds no notes still takes a new model at once.
- `puremind index` reports it with exit 2 and a --rebuild hint.
- `puremind watch` stops on it, like a vault mismatch, with a hint to
  restart the watch, so a stale watch leaves the rebuilt index alone.
- README, --rebuild help, CHANGELOG (0.1.4, unreleased) and a note at
  PINNED_REVISIONS that changing the pinned embedder revision now makes
  every existing index need --rebuild.

Tests: the four tests that relied on the wipe now use rebuild=True and
check the refusal; new tests cover the empty-index case, the CLI index
refusal and the stale-watch scenario. The behavioural ones fail against
the previous source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011zd8G1cibJoQPVbZEpVLYs
@puretensor
puretensor merged commit 11d07db into main Oct 17, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant