Repository navigation
fix: refresh the vault's index only for notes written inside it - #397
Merged
Merged
Conversation
…ultIndex (#366) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ws (#366) The refresh trigger and validation's skip both use isInsideVault, so a drive letter cased differently from the vault root neither skips validation nor turns the refresh off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
breferrari
force-pushed
the
issue-366-refresh-in-vault
branch
from
October 14, 2026 00:53
5eb3e8e to
3f53b23
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
validate-writestarted the debounced QMD refresh for any.mdwrite, even one outside the vault: a repo's README edited in another folder, or a note in~/.claude/. The vault's index can't change from such a write, so the worker was wasted work, at most one per 30 s because of the debounce. Now only a note inside the vault refreshes. Paths inside the vault that validation skips (templates, root docs, a memory folder inside the vault) still refresh, since they are indexed all the same.Closes #366
Type
fix— bug fixWhat changed
lib/project-dir.ts:isInsideVault(path, vaultRoot)is the one boundary-safe in-vault check ("/vault" doesn't contain "/vaulting/…"), and it ignores case on Windows, where the hook's vault root and a tool's file path can spell the drive differently.lib/qmd-refresh.ts:refreshesVaultIndex(filePath, vaultRoot)isshouldRefreshForPathandisInsideVault.validate-write.ts: its own outside-vault skip usesisInsideVaulttoo. So a note whose drive letter is cased differently from the vault root is now validated; before, it was silently skipped.validate-write.ts, as well: the refresh trigger asksrefreshesVaultIndexfor each refreshed path, and the comment says why.tests/refresh-in-vault.test.ts(new, spawns nothing):tests/validate-write.test.ts, through the hook on CI: an outside note requests no refresh; an in-vault template still does (the control). Both read the trigger'srefresh requesteddebug line.Proof
3e3a9f0. With the helper still ignoring the root, the outside-note test failed./from the boundary check fails the sibling-folder case;Review (small code)
/simplify: the in-vault check was duplicated between the refresh and validation's skip, so it is now one sharedisInsideVault. A drive letter cased differently would have silently turned the refresh off for every in-vault write on Windows, so the shared check folds case there. The two path-less refresh callers (Stop, PreCompact) were checked and have no outside-path issue.Note
This PR touches the same
validate-write.tsblock as #395 (#360, the sentinel path). Whichever merges second needs a one-line rebase.Checklist
type: descriptionformatcd .claude/scripts && npm test): left to CI on this PR, not run locally🤖 Generated with Claude Code