Files
Marcos Paulo 5e8020aa38
ci / ci (macos-latest) (push) Has been cancelled
ci / ci (ubuntu-latest) (push) Has been cancelled
ci / ci (windows-latest) (push) Has been cancelled
feat: Obsidian basics, editor previews, graph rework, query blocks, stacked tabs, pop-out windows
Editor previews (colour swatches, arrows, embeds), the 18 obsidian-basics tasks (find and replace
with regex, back/forward, auto-pair, footnotes, folding, search operators, split view, PDF/audio/
video embeds, spelling, drag and drop, pinned tabs, settings) and round 2: ```query blocks, stacked
tabs, pop-out windows, tasks ticked inside embeds, text around an embed, embeds that follow edits,
block menu shortcut. New crates: notescraft-regex (linear-time engine) and notescraft-syntax.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 11:21:19 -03:00

8.3 KiB

Tasks: Fast open and large-vault explorer

Rules: each task is independently testable. No task depends on work in an unfinished task. Order = execution order. Every task ends with cargo test -p <crate>, cargo clippy -p <crate> --all-targets -- -D warnings and cargo fmt -p <crate> for the crates it touched; the last task runs cargo xtask ci and cargo xtask i18n.

  • 1. Add size, modified time and a bounded file count to the vault listing
    Files: crates/vault/src/lib.rs:72,332 (VaultEntry, list), crates/vault/src/count.rs (new; free fn count_files(root, limit) so it runs before Vault::open creates the state folder)
    Done when: new unit tests pass: list returns size and modified for files; count_files(5000) on a 6,000-file temp folder returns "over limit" without walking the rest; hidden entries and symlinks stay skipped; existing vault tests unchanged.

  • 2. Open a session lazily and index it in time-boxed steps
    Files: crates/engine/src/vault/indexing.rs (new), crates/engine/src/vault/session.rs:73-100,320-355, crates/engine/src/vault/mod.rs
    Done when: tests pass showing open_lazy + index_step until finished yields the same note list, links, tags, search hits and knowledge counts as eager open on a fixture vault; index_step(budget) always processes at least one note and stops within the budget; knowledge_end_scan runs once, only at queue end; Session::open (CLI, MCP) behavior is unchanged.

  • 3. Add pause, resume, priority order and progress; gate link-rewriting operations while indexing
    Files: crates/engine/src/vault/indexing.rs, crates/engine/src/vault/notes.rs:181, crates/engine/src/vault/folders.rs:194,205, crates/engine/src/vault/mod.rs (register index.pause, index.resume)
    Done when: tests pass: the focused and recently modified notes are read first; pause stops steps and resume continues without re-reading; a note edited during indexing is not overwritten by a stale step; rename, move and folder move return a clear "still indexing" error until finished, then work; IndexProgress reports total, done, paused, finished.

  • 4. Search disk content with the ripgrep crates, cancellable and bounded
    Files: root Cargo.toml, xtask/src/layers.rs, crates/engine/Cargo.toml, crates/engine/src/vault/content_search.rs (new), crates/engine/src/vault/search.rs:38-41
    Done when: cargo xtask layers is green with the new dependencies on the engine only; tests pass: hits match a query on a vault with no index; a new query cancels the old thread and stale hits are dropped; files over the size cap, binary files, non-UTF-8 files and very long lines are skipped without panic; hit count is capped; search reports whether results are partial.

  • 5. Build the tree from the file listing, with folder note counts and a virtualized row list
    Files: crates/ui-egui/src/panels/tree.rs:41-50,120-272, crates/ui-egui/src/panels/tree_tests.rs
    Done when: tests pass: TreeNode carries a note count per folder; the flat row list is cached per model version and collapse set; the show_rows window math returns visible rows plus about ten rows of overscan for a 50,000-row model; a truncated tree (past the node cap) gets a visible "truncated" row instead of a silent cut; scroll-to-row returns the right offset for a path.

  • 6. Open the window first and drive indexing from the frame loop
    Files: apps/notescraft/src/main.rs:163-184, crates/ui-egui/src/shell/app.rs:147-153, crates/ui-egui/src/shell/app/window/frame.rs:129,160, crates/ui-egui/src/shell/app/window/commands.rs:308-318
    Done when: tests pass: NotesApp::new builds the tree from the listing before any note is parsed; each frame calls index_step with the budget and requests a repaint only while work remains; the change stamp is a coarse progress bucket while indexing; an "index finished" event refreshes sidebar data, right-panel data and the graph cache exactly once. Manual check: target/debug/notescraft /tmp/big shows the window before indexing ends.

  • 7. Show indexing state where the index is read
    Files: crates/ui-egui/src/panels/index_status.rs (new), crates/ui-egui/src/panels/sidebar.rs:46-160, crates/ui-egui/src/panels/search_panel.rs:48-56, crates/ui-egui/src/shell/app/window/cards.rs:65, crates/ui-egui/src/views/note_view/blocks/embed_data.rs:66, crates/ui-egui/src/views/graph_view.rs:100-109, crates/ui-egui/src/panels/right_view.rs:76
    Done when: tests pass: the status card shows "Indexing n / N" with progress and a pause control and disappears when finished; the header chip shows the percentage; search shows partial results with a "still reading" line and merges streamed disk hits; while indexing, links render neutral (not broken), embeds show loading, the graph and backlinks show a loading state instead of wrong data. Snapshot of the sidebar matches the "Explorer / Large vault" artboard.

  • 8. Warn before opening a very large folder
    Files: crates/ui-egui/src/shell/app/vault/large_folder.rs (new; reuses the app's dialog::show, shown on a throw-away vault, "Open anyway" relaunches with --large-ok), apps/notescraft/src/main.rs, crates/vault/src/count.rs (LARGE_FOLDER_FILES)
    Done when: tests pass: the dialog appears when count_files(5000) says over limit (also on the open-recent and pick paths) and shows path, file and note counts and the "state folder will be added" note; Cancel writes nothing and keeps the previous vault; Open anyway continues. Snapshot matches the "Dialog / Large folder warning" artboard. Manual check: opening the repository folder shows the dialog.

  • 9. Add explorer navigation: collapse all, reveal active, filter, pinned folders, sticky breadcrumb
    Files: crates/ui-egui/src/panels/sidebar.rs, crates/ui-egui/src/panels/tree.rs, crates/ui-egui/src/shell/app/window/commands.rs (register explorer.collapse_all, explorer.reveal_active, explorer.focus_filter, no default key binding), UI state persisted by persist_ui
    Done when: tests pass: collapse all keeps only the active note's path open; reveal active expands and scrolls to the note; the filter keeps matches and their parents and restores the old collapse state when cleared; pinned folders appear above the tree and survive a restart; the sticky breadcrumb names the folder of the first visible row and clicking a segment scrolls to it. Snapshot matches the artboard.

  • 10. Measure on the reference machine and decide the index cache
    Files: crates/engine/perf/ (new #[ignore]d test on a generated 5,000-note vault), measurement notes in specs/fast-open-and-explorer/plan.md (Data section)
    Done when: in a release build on the owner's Mac against /tmp/big, time to first window is under 1 second, frame time with 50,000 explorer rows is under 16 ms, and the time of each indexing stage (list, read, parse, search feed, knowledge feed) is recorded; the plan states whether a cache is needed and for which stage. If no stage justifies it, task 11 is closed as "not needed".

  • 11. Add the index cache for the stage task 10 names (skip if task 10 says not needed)
    Files: crates/engine/src/vault/indexing.rs, new cache module in the engine, cache file in the vault state folder written with write_private
    Closed without code: task 10 measured every stage (largest 90 ms for 5,000 notes, whole index 435 ms) and the first window no longer waits for it, so a cache would save at most that and add a staleness risk. Original check, not needed: a second open of an unchanged vault does not re-read or re-parse cached notes (counted by a test hook); a changed file (path, size or modified time) is re-read; a corrupt, oversize or version-mismatched cache is discarded and rebuilt without an error; release timing on /tmp/big shows backlinks available within 1 second of the second open.

  • 12. Update the roadmap and architecture notes and run the full gate
    Files: ROADMAP.md, docs/ARCHITECTURE.md, i18n string tables
    Done when: cargo xtask ci and cargo xtask i18n are green; ROADMAP and ARCHITECTURE state the new public API (open_lazy, index_step, IndexProgress, count_files, content search), the commands and the measured numbers; no new hardcoded user strings.