Skip to content

fix: stop walking a folder for wiki links once the index is full - #181

Merged
ryanlewis merged 1 commit into
mainfrom
fix/vault-index-stop
Nov 2, 2026
Merged

ryanlewis merged 1 commit into
mainfrom
fix/vault-index-stop

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

Stops the vault walk once its index is full. Until now it went on reading every folder below, which MAX_FILES is there to prevent.

What a user sees differently: following a wiki link, or showing a wiki-embedded image, from a note outside any vault in a big folder such as ~ or / resolves sooner. Before, smd listed every folder under that root before it answered, even after it had its 50,000 files. Now it stops reading folders as soon as the index is full. The index is the same: the same files are found, and the same ones are left out. Notes inside a normal vault, with fewer files than the limit, are not affected.

How: index_files checks, before it reads each folder, whether it already has max files, and stops if so. The doc comment says so.

Test: the_walk_stops_once_the_index_is_full uses max = 2 and a vault with two notes at the top and more in folders below. It checks that two files are indexed and that only one folder was read. It failed before this change (4 folders read) and passes now.

cargo-mutants on index_files|Vault::index: 24 mutants, all caught.

Follows the refactor in #179.

@ryanlewis ryanlewis added the behaviour-change Changes what a user sees label Nov 2, 2026
@ryanlewis
ryanlewis merged commit a2f466a into main Nov 2, 2026
8 checks passed
@ryanlewis
ryanlewis deleted the fix/vault-index-stop branch November 2, 2026 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

behaviour-change Changes what a user sees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant