test(mcp): fix store tests writing fixtures outside getStateDir; sync hub-search specs with pagination API#693
Open
mojoho81 wants to merge 1 commit into
Open
Conversation
… hub-search specs with pagination API Root cause A (23 tests): mcp-presets-store, mcp-hub-sources-store, mcp-tools-cache and the /api/mcp/presets route tests wrote fixture files at $HERMES_HOME/<file>, but the stores resolve paths via getStateDir(), which appends a workspace/ segment ($HERMES_HOME/workspace/<file>). The stores never saw the fixtures and bootstrapped from seed instead, so every user-file/invalid-path assertion failed on any machine. Fix: tests now derive paths from the modules' own exported helpers (presetsFilePath(), hubSourcesFilePath(), getStateDir()) instead of hand-building them. Also un-vacuouses the two mcp-tools-cache corrupt- file tests, which previously wrote the corrupt file to an unread path. Root cause B (4 tests): -hub-search.test.ts still expected the old 3-arg unifiedSearch signature and a limit clamp of 100; the route now clamps to 500 and forwards an offset param. Updated expectations, added offset coverage, and corrected the stale limit/offset docblock in hub-search.ts (comment-only product change). Before: 27 failed across these 5 files. After: 70/70 pass; full vitest run leaves only the known out-of-scope failures (chat components, i18n, e2e playwright).
mojoho81
force-pushed
the
fix/mcp-store-test-isolation
branch
from
July 6, 2026 20:32
f6456b0 to
01424e7
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
27 tests across the 5 MCP store/route test files fail on any machine (verified identical failures on a clean checkout of
main). Two independent root causes, both test-side:Root cause A (23 tests): fixtures written outside
getStateDir().mcp-presets-store.test.ts,mcp-hub-sources-store.test.ts,mcp-tools-cache.test.ts, and-presets.test.tssetHERMES_HOMEto a temp dir correctly, but then write fixture files at$HERMES_HOME/<file>— while the stores resolve their paths viagetStateDir(), which appends aworkspace/segment ($HERMES_HOME/workspace/<file>). The stores never see the fixtures and bootstrap from seed data instead, so every user-file / invalid-path assertion fails.Fix: tests now derive paths from the modules' own exported helpers (
presetsFilePath(),hubSourcesFilePath(),getStateDir()) instead of hand-building them. This also un-vacuouses the twomcp-tools-cachecorrupt-file tests, which previously wrote the corrupt file to a path the cache never read (they passed for the wrong reason).Root cause B (4 tests): stale hub-search specs.
-hub-search.test.tsstill expected the old 3-argunifiedSearchsignature and a limit clamp of 100; the route now clamps to 500 and forwards anoffsetparam. Updated expectations and added offset coverage.The only product-code change is a comment: the limit/offset docblock in
hub-search.tssaid1..100while the code clamps to 500 — corrected to match behavior.Test results
main)vitest run: no new failures introduced; eslint and tsc output identical to baselineNotes
Test-only change (plus the one docblock line). No behavior changes. Should make these suites pass for every contributor regardless of local Hermes state or platform.