Skip to content

Move Reindex button to Settings → Index tab - #129

Merged
samkeen merged 2 commits into
mainfrom
claude/reindex-ui-reorganization-0yyikk
Aug 2, 2026
Merged

Move Reindex button to Settings → Index tab#129
samkeen merged 2 commits into
mainfrom
claude/reindex-ui-reorganization-0yyikk

Conversation

@samkeen

@samkeen samkeen commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Indexing is now automatic (on open + fs-watch), so the manual Reindex button no longer belongs in permanent top-bar chrome. This change relocates it to Settings → Index, where it sits beside the coverage numbers that tell you whether you need it.

Summary

The Reindex button moves from the top bar to a new "Index" tab in Settings (⌘,), while the progress meter and Cancel button remain in the top bar beside the vault name. This reflects the shift to automatic indexing: the exception (manual reindex) belongs where you go looking for it, not in permanent chrome.

Key changes

  • New Settings tab: Added "Index" tab to the Settings dialog (settingstabs.ts) with its own panel (render.ts indexPanelHtml)
  • Button relocation: Moved Reindex button from top bar (main.ts buildShell) to Settings → Index panel
  • State management: Extracted button state logic into pure functions (reindexDisabled, reindexLabel) so the panel's initial paint and main.ts's targeted repaints (paintReindex) stay in sync
  • Progress meter stays: The live progress bar, label, and Cancel button remain in the top bar, grouped with the vault name in a new .vault-status container
  • Focus handling: Updated captureModalFocus to handle disabled elements correctly—a disabled button that exists can't take focus, so it falls through to the next focusable element
  • Event delegation: Reindex click handler moved to the Settings-open branch in wireEvents (the only place the button can be clicked); Cancel stays in the shell handlers
  • Coverage display: Index panel shows honest indexing state—distinguishes between "indexed" and "embedded" (a projected-but-unembedded vault is not finished), and explains why the meter is in the top bar

Implementation details

  • The button carries id="reindex" in both the panel paint and main.ts's targeted repaint, so focus restoration and click delegation both work
  • reindexDisabled and reindexLabel are exported from render.ts so they're the single source of truth for button state
  • The Index panel shows coverage numbers (total notes, embedded count) and points to the top bar for the live meter when a run is active
  • CSS changes group the vault name and progress meter visually (.vault-status with tight gap and min-width: 0 for ellipsis)
  • Tests added to verify the button carries the right id, respects disabled state, and the panel counts indexed/embedded separately

https://claude.ai/code/session_01QGNb4cJT7YL6ejApdNizpM

Summary by CodeRabbit

  • New Features
    • Added an Index tab to Settings with index status, embedding coverage, and automatic/manual indexing guidance.
    • Added a state-aware Reindex action with clear progress labels.
    • Kept indexing progress and cancellation controls visible in the top bar after closing Settings.
  • Bug Fixes
    • Improved focus restoration when closing dialogs.
  • Documentation
    • Updated Settings and top-bar documentation to reflect the new indexing controls.
    • Updated frontend test discovery documentation to include nested tests.

Indexing is automatic now — auto-index on open (#25), the fs-watch pulse
re-projecting every external save, and a cancelled run healing off the
DB-derived pending set on the next pass. A manual Reindex is therefore the
exception, and permanent top-bar chrome for an exception trains the eye to
skip the bar. The button moves to a new Settings section, Index, where it sits
beside the coverage numbers that say whether you need it.

What stays on the front page is the half you can't put behind a modal: the
live progress meter and its Cancel. It moves to sit with the vault name — a
run is *about* a vault, so the meter reads beside the one being indexed rather
than floating at the far end of the bar (`.vault-status`).

- settingstabs.ts: a fourth section, General / Index / Embedding / Keyboard.
  The rail's walk, roving tabstop and Home/End all follow from the list.
- render.ts: `indexPanelHtml`, plus `reindexDisabled`/`reindexLabel` exported
  so the panel's paint and main.ts's targeted repaint (which runs on every
  streamed progress batch without a full render) can't drift on either.
- main.ts: the click is wired inside the `settingsOpen` branch — that branch
  returns unconditionally, so a click in the dialog never reaches the shell's
  handlers. `paintReindex` now tolerates a button that isn't on screen.
- `captureModalFocus` restores focus only to a control that can *take* it:
  pressing Reindex leaves the button present and disabled, which `.focus()`
  silently declines — the `<body>`-behind-a-backdrop outcome an overlay may
  never produce (obligation 3). Membership in `overlayFocusables()` is the
  test, since its selector already excludes `[disabled]`.

render.test.ts pins the button's id (both halves restore by it), its
disabled/renamed state mid-run, and that the panel counts indexed and embedded
separately — the #26 honesty, in the one place a human comes to ask whether
the index is finished.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGNb4cJT7YL6ejApdNizpM
@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 05aa9dc7-719b-4897-882d-13aa3062ae7f

📥 Commits

Reviewing files that changed from the base of the PR and between 17c9eaf and 54f63b8.

📒 Files selected for processing (3)
  • CLAUDE.md
  • justfile
  • ui/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • CLAUDE.md

📝 Walkthrough

Walkthrough

The PR adds an Index tab to Settings. It displays index coverage and Reindex states. Manual reindexing starts from Settings, while progress and cancellation remain in the top bar. Frontend test discovery now includes nested test files.

Changes

Index settings and reindex controls

Layer / File(s) Summary
Index tab and status panel
ui/src/settingstabs.ts, ui/src/render.ts, ui/src/render.test.ts, ui/style.css, CLAUDE.md
Adds the Index tab, coverage displays, Reindex labels and disabled states, related tests, styling, and Settings documentation.
Reindex shell integration
ui/src/main.ts, ui/style.css
Moves manual reindexing into Settings. The top bar retains vault status, progress, and cancellation controls.
Modal focus restoration
ui/src/main.ts
Restores focus only to an enabled overlay target, with fallback to the first available target.
Recursive frontend test discovery
ui/package.json, justfile, CLAUDE.md
Updates the frontend test pattern and documentation to include nested test files.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SettingsDialog
  participant MainShell
  participant IndexingRun
  participant TopBar

  SettingsDialog->>MainShell: Click Reindex
  MainShell->>IndexingRun: Start tracked indexing run
  IndexingRun-->>MainShell: Report indexing state
  MainShell-->>SettingsDialog: Update label and disabled state
  MainShell-->>TopBar: Show progress and Cancel controls
Loading

Possibly related PRs

Suggested reviewers: claude

Poem

A rabbit taps the Index tab bright,
Reindex starts with one small bite.
Progress hops along the bar,
Cancel waits, not very far.
Focus returns to targets right.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: moving the Reindex button to the Settings → Index tab.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/reindex-ui-reorganization-0yyikk

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/src/render.test.ts`:
- Around line 390-455: Update the test script in ui/package.json to use a
recursive test glob such as src/**/*.test.ts instead of src/*.test.ts, ensuring
ui/src/render.test.ts and future nested test files are discovered by the Node
test runner.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 52069b5b-9645-4f5d-90c7-3aa6179d1f75

📥 Commits

Reviewing files that changed from the base of the PR and between 2c98a9f and 17c9eaf.

📒 Files selected for processing (6)
  • CLAUDE.md
  • ui/src/main.ts
  • ui/src/render.test.ts
  • ui/src/render.ts
  • ui/src/settingstabs.ts
  • ui/style.css

Comment thread ui/src/render.test.ts
`src/*.test.ts` already finds every test file — ui/src is flat, and the suite
reports all 25 — so nothing was being skipped. But the claim the justfile and
CLAUDE.md make for that glob is "a new file is never silently skipped", and a
nested one would break it in the quietest way there is: a green run over a
smaller set. `**` makes the promise true for that case too.

Verified a strict superset before taking it: both globs discover and pass the
same 25 files, so this cannot be the failure it protects against.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QGNb4cJT7YL6ejApdNizpM
@samkeen
samkeen merged commit e08afbd into main Aug 2, 2026
2 checks passed
@samkeen
samkeen deleted the claude/reindex-ui-reorganization-0yyikk branch August 2, 2026 03:23
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