Skip to content

feat(ui): auto-index a vault on open, no confirm dialog (#25) - #54

Merged
samkeen merged 1 commit into
mainfrom
claude/gh-25-remove-confirm-alvtvt
Jul 16, 2026
Merged

feat(ui): auto-index a vault on open, no confirm dialog (#25)#54
samkeen merged 1 commit into
mainfrom
claude/gh-25-remove-confirm-alvtvt

Conversation

@samkeen

@samkeen samkeen commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Detect an unindexed or partly-indexed vault the moment it's opened — app
launch (boot) and vault switch (switchVault) — and start the index
immediately instead of waiting behind a manual Reindex click. The UX call
in the issue goes to silent auto-start: no confirm dialog.

The detector is the model-free embedding-coverage read already surfaced in
VaultInfo (notes_embedded/notes_total, #26), so this needs no engine
change — it's adapter sequencing over the existing project/embed ops:

  • notes_total == 0 never projected: run the fast, model-free
    project (tree + keyword search live in
    seconds), then embed.
  • notes_embedded < total projected but embedding didn't finish (a prior
    cancel/crash): resume only the trailing embed;
    the pending set is DB-derived and self-healing.
  • embedded == total (>0) index complete: left untouched, so reopening a
    vault is never busywork.

The embed phase runs only when a real model is installed (state.semantic);
without one a fresh vault still gets its keyword + graph index and nothing
errors — the search caveat already reads "keyword-only for now". The run is
silent like the trailing embed after a save: the progress meter and Cancel
are the only chrome, no toast.

Concurrency: a new module-local indexingRun handle tracks the in-flight
background index (manual reindex, auto-index, or trailing embed). A vault
switch cancels the departing run host-side (already) and chains the new
vault's auto-index after that handle settles, so the fresh run never starts
on a not-yet-cleared reindexing flag. autoIndexOnOpen reuses doReindex's
vault-switch guards and adds a pre-embed root check so a switch mid-run
never embeds the vault being left.

Docs: mark #25 shipped in tasks.md and projection-embedding-split.md §9.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01JuNkPDNLJchKqzkMciWMcz

Summary by CodeRabbit

  • New Features

    • Automatically indexes vaults when opened or at application launch when needed.
    • Supports projected and partially indexed vaults, embedding content when a semantic model is available.
    • Runs indexing silently without requiring confirmation.
  • Bug Fixes

    • Improved vault switching to prevent background indexing from affecting the previously opened vault.
    • Ensured indexing operations complete safely before starting work on a newly selected vault.
  • Documentation

    • Updated project specifications and task tracking to record the auto-indexing feature as shipped.

Detect an unindexed or partly-indexed vault the moment it's opened — app
launch (`boot`) and vault switch (`switchVault`) — and start the index
immediately instead of waiting behind a manual Reindex click. The UX call
in the issue goes to silent auto-start: no confirm dialog.

The detector is the model-free embedding-coverage read already surfaced in
`VaultInfo` (`notes_embedded`/`notes_total`, #26), so this needs no engine
change — it's adapter sequencing over the existing `project`/`embed` ops:

  - notes_total == 0        never projected: run the fast, model-free
                            `project` (tree + keyword search live in
                            seconds), then `embed`.
  - notes_embedded < total  projected but embedding didn't finish (a prior
                            cancel/crash): resume only the trailing `embed`;
                            the pending set is DB-derived and self-healing.
  - embedded == total (>0)  index complete: left untouched, so reopening a
                            vault is never busywork.

The embed phase runs only when a real model is installed (`state.semantic`);
without one a fresh vault still gets its keyword + graph index and nothing
errors — the search caveat already reads "keyword-only for now". The run is
silent like the trailing embed after a save: the progress meter and Cancel
are the only chrome, no toast.

Concurrency: a new module-local `indexingRun` handle tracks the in-flight
background index (manual reindex, auto-index, or trailing embed). A vault
switch cancels the departing run host-side (already) and chains the new
vault's auto-index after that handle settles, so the fresh run never starts
on a not-yet-cleared `reindexing` flag. autoIndexOnOpen reuses doReindex's
vault-switch guards and adds a pre-embed root check so a switch mid-run
never embeds the vault being left.

Docs: mark #25 shipped in tasks.md and projection-embedding-split.md §9.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JuNkPDNLJchKqzkMciWMcz
@samkeen
samkeen merged commit 270e8bc into main Jul 16, 2026
1 check was pending
@samkeen
samkeen deleted the claude/gh-25-remove-confirm-alvtvt branch July 16, 2026 13:18
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6877a82d-6830-47f2-b61f-2ddfe0d61385

📥 Commits

Reviewing files that changed from the base of the PR and between 8a78d1c and 78d0b46.

📒 Files selected for processing (3)
  • planning/specs/completed/projection-embedding-split.md
  • planning/tasks.md
  • ui/src/main.ts

📝 Walkthrough

Walkthrough

Automatic indexing now runs on launch and vault switches, coordinates projection and embedding based on vault state, and tracks background runs to prevent stale-vault work during transitions.

Changes

Automatic indexing

Layer / File(s) Summary
Indexing run tracking
ui/src/main.ts
Vault switches defer new-vault indexing until departing indexing runs settle, using shared promise tracking.
Automatic index-on-open flow
ui/src/main.ts, planning/specs/completed/projection-embedding-split.md, planning/tasks.md
Launch and vault-open flows evaluate projection and embedding state, skip embedding without a model, guard against vault changes, and document the shipped behavior.
Background indexing integration
ui/src/main.ts
Scheduled trailing embeds and manual reindex operations participate in shared indexing tracking.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

  • AlteredCraft/B2 issue 25 — Directly implemented by the new automatic indexing behavior and startup/vault-switch integration.

Possibly related PRs

  • AlteredCraft/B2#11 — Both changes modify ui/src/main.ts startup and refresh-related flows.

Suggested reviewers: claude

Poem

A bunny watched the vault doors swing,
While quiet indexes took to wing.
Project, embed, then hop along,
Old runs settle where they belong.
New notes bloom at morning’s start.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/gh-25-remove-confirm-alvtvt

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

2 participants