fix(FN-000): skip qmd index mutations in test runs

Why: tests were leaking ~700 per-temp-dir collection registrations
into the user's global ~/.config/qmd/index.yml because searchWithQmd
and the agent-memory qmd path called execFile("qmd", ...) with the
real binary, bypassing shouldSkipBackgroundQmdRefresh() which only
guarded the schedule* wrappers.

Guard both direct-execFile paths under the same skip flag and fall
back to file-based agent memory search when skipping.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-04-17 13:54:28 -07:00
parent ef696f4564
commit 217ccdd4aa
3 changed files with 11 additions and 1 deletions

View File

@@ -452,6 +452,7 @@ export {
buildQmdRefreshCommands,
refreshQmdProjectMemoryIndex,
scheduleQmdProjectMemoryRefresh,
shouldSkipBackgroundQmdRefresh,
installQmd,
ensureQmdInstalled,
ensureQmdInstalledAndRefresh,

View File

@@ -857,6 +857,9 @@ function normalizeQmdSearchResultPath(rootDir: string, rawPath: unknown): string
}
async function searchWithQmd(rootDir: string, options: MemorySearchOptions): Promise<MemorySearchResult[]> {
if (shouldSkipBackgroundQmdRefresh()) {
return [];
}
const command = "qmd";
const limit = Math.max(1, Math.min(options.limit ?? 5, 20));
try {