Skip to content

Commit 7510ec3

Browse files
committed
Index tooling: Add event dashboard and INFO logs
- Upgrade key indexing events from debug to INFO: startup path (cold-start replay / fresh scan / rescan), scan completion, reconciler replay, watcher lifecycle, `MustScanSubDirs` rescans - Add `DebugStats` shared atomics tracking `MustScanSubDirs` count, live event count, watcher status, recent rescan paths - Add `get_index_debug_status` IPC command exposing live DB counts (entries, dirs, dirs with stats), event counters, and recent `MustScanSubDirs` paths - Enhance debug window Drive index section: watcher status indicator, live DB stats, `MustScanSubDirs` event log, event rate sparkline (CSS/SVG, last 60s), extended event log (100 entries)
1 parent bf0b47f commit 7510ec3

9 files changed

Lines changed: 514 additions & 117 deletions

File tree

apps/desktop/src-tauri/src/commands/CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ immediately to business-logic modules. No significant logic lives here.
2222
| `settings.rs` | Settings | Port availability check, watcher debounce setting, menu accelerator updates |
2323
| `mcp.rs` | MCP server | `set_mcp_enabled`, `set_mcp_port` — live start/stop/port-change of the MCP server without app restart |
2424
| `licensing.rs` | Licensing | Status query, activation, expiry, reminder, key validation |
25-
| `indexing.rs` | Drive index | `start_drive_index`, `stop_drive_index`, `get_index_status`, `get_dir_stats`, `get_dir_stats_batch`, `prioritize_dir`, `cancel_nav_priority`, `clear_drive_index`, `set_indexing_enabled`. Uses `State<IndexManagerState>`. |
25+
| `indexing.rs` | Drive index | `start_drive_index`, `stop_drive_index`, `get_index_status`, `get_dir_stats`, `get_dir_stats_batch`, `prioritize_dir`, `cancel_nav_priority`, `clear_drive_index`, `set_indexing_enabled`, `get_index_debug_status` (dev-only extended stats). Uses `State<IndexManagerState>`. |
2626
| `clipboard.rs` | Clipboard file ops | `copy_files_to_clipboard`, `cut_files_to_clipboard`, `read_clipboard_files`, `clear_clipboard_cut_state`. macOS uses NSPasteboard via `clipboard::pasteboard`; non-macOS stubs return errors. |
2727
| `sync_status.rs` | Cloud sync status | `get_sync_status` — macOS delegates to `file_system::sync_status`; non-macOS returns empty map via `#[cfg]` on the function itself (not the module). |
2828

apps/desktop/src-tauri/src/commands/indexing.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
use tauri::AppHandle;
66

7-
use crate::indexing::{self, IndexStatusResponse, PubScanPriority, store::DirStats};
7+
use crate::indexing::{self, IndexDebugStatusResponse, IndexStatusResponse, PubScanPriority, store::DirStats};
88

99
#[tauri::command]
1010
pub async fn start_drive_index(app: AppHandle) -> Result<(), String> {
@@ -56,6 +56,12 @@ pub async fn clear_drive_index() -> Result<(), String> {
5656
indexing::clear_index()
5757
}
5858

59+
/// Extended debug status for the debug window (dev only).
60+
#[tauri::command]
61+
pub async fn get_index_debug_status() -> Result<IndexDebugStatusResponse, String> {
62+
indexing::get_debug_status()
63+
}
64+
5965
/// Toggle drive indexing on/off based on the user's setting.
6066
#[tauri::command]
6167
pub async fn set_indexing_enabled(app: AppHandle, enabled: bool) -> Result<(), String> {

apps/desktop/src-tauri/src/indexing/CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Full design: `docs/specs/drive-indexing/plan.md`
88

99
### Module structure
1010

11-
- **mod.rs** -- Public API: `init()`, `start_indexing()`, `stop_indexing()`, `clear_index()`, `enrich_entries_with_index()`. `IndexManager` coordinates all subsystems, owns a `PathResolver` (LRU-cached path→ID mapping) for IPC commands. `ReadPool` provides lock-free thread-local read connections for enrichment and verification. Enrichment uses an integer-keyed fast path: resolve parent dir once → batch-fetch child dir stats by ID → match by name. Falls back to individual path resolution for edge cases.
11+
- **mod.rs** -- Public API: `init()`, `start_indexing()`, `stop_indexing()`, `clear_index()`, `enrich_entries_with_index()`. `IndexManager` coordinates all subsystems, owns a `PathResolver` (LRU-cached path→ID mapping) for IPC commands. `ReadPool` provides lock-free thread-local read connections for enrichment and verification. Enrichment uses an integer-keyed fast path: resolve parent dir once → batch-fetch child dir stats by ID → match by name. Falls back to individual path resolution for edge cases. `DebugStats` static provides shared atomic counters (MustScanSubDirs count, rescan completions, live event count, watcher state) for the debug window's `get_index_debug_status` IPC command.
1212
- **store.rs** -- SQLite schema v2 (integer-keyed entries, dir_stats by entry_id, meta), platform_case collation, read queries, DB open/migrate. Schema version check: mismatch triggers drop+rebuild. Both path-keyed (backward compat) and integer-keyed APIs.
1313
- **path_resolver.rs** -- `PathResolver`: resolves filesystem paths to integer entry IDs via component-by-component walk with full-path LRU cache (50K entries). Case-aware `CacheKey` on macOS (NFD + case fold). Prefix-based invalidation for deletes/renames.
1414
- **memory_watchdog.rs** -- Background task monitoring resident memory via `mach_task_info` (macOS). Warns at 8 GB, stops indexing at 16 GB, emits `index-memory-warning` event to frontend. No-op stub on non-macOS. Started from `start_indexing()`.

0 commit comments

Comments
 (0)