fix(mcp): count cypress/e2e and snapshot paths as test files#2120
Merged
JSONbored merged 2 commits intoJul 1, 2026
Conversation
The MCP client copy of isTestFile is a hand-copied duplicate of the canonical isTestPath in src/signals/test-evidence.ts, but it dropped the last two branches: `*.cy.*` / `*.e2e.*` (Cypress/Playwright e2e) and `__snapshots__/` (Jest/Vitest snapshots). The server-side analysis delegates to isTestPath, so the client and server classify the same diff and must agree. Because isCodeFile is `codeExt && !isTestFile`, a changed `Button.cy.ts` or `__snapshots__/x.snap.ts` was misclassified as source: dropped from collectLocalDiff().testFiles, counted in codeFiles, inflating the source-line/token estimate and under-reporting test evidence in the local packet. Add the two missing branches so the client mirrors isTestPath, export isTestFile/isCodeFile, and add a regression test. No issue because issue creation is restricted on this repo; this is a small, self-evident consistency fix in a pure helper with no schema or API change.
|
Important 🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪 🔍 Gittensory is reviewing…AI analysis is in progress. This comment will update when the review is complete. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2120 +/- ##
=======================================
Coverage 95.74% 95.75%
=======================================
Files 223 223
Lines 24787 24812 +25
Branches 8989 9004 +15
=======================================
+ Hits 23732 23758 +26
+ Misses 433 432 -1
Partials 622 622 🚀 New features to boost your workflow:
|
JSONbored
approved these changes
Jul 1, 2026
Closed
12 tasks
This was referenced Jul 9, 2026
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
The MCP client copy of
isTestFileinpackages/gittensory-mcp/lib/local-branch.jsis a hand-copied duplicate of the canonicalisTestPathinsrc/signals/test-evidence.ts, but it dropped the last two branches:/(^|\/)[^/]+\.(cy|e2e)\.(ts|tsx|js|jsx)$/i— Cypress / Playwright e2e tests/(^|\/)__snapshots__\//i— Jest/Vitest snapshot filesThe server-side analysis (
src/signals/local-branch.ts) delegates toisTestPath(and a test asserts it stays "in sync"), so the client and server classify the same diff and must agree. BecauseisCodeFile = codeExt && !isTestFile, a changedButton.cy.tsorsrc/__snapshots__/x.snap.tswas misclassified as source — dropped fromcollectLocalDiff().testFiles, counted incodeFiles, inflating the source-line/token estimate and under-reporting test evidence in the emitted local packet.Fix: add the two missing branches so the client mirrors
isTestPath, and exportisTestFile/isCodeFileso the regression is unit-testable. Pure helper — no schema or API change.No issue because issue creation is restricted on this repo for outside accounts; this is a small, self-evident consistency fix.
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coverage(see note below)npm run test:workersnpm run build:mcpnpm run test:mcp-pack(see note below)npm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
src/**/*.tsinclude, so no patch-coverage obligation). A regression test was added intest/unit/local-branch.test.ts(via the existing dynamic-import harness) asserting the Cypress/e2e/snapshot paths now classify as tests (and no longer as code) while plain source is unchanged; it passes, and the fulllocal-branch.test.ts(56 tests) passes.build:mcp(node --check) andtypecheckare clean. I did not run the fulltest:coverage/ UI / workers steps (unrelated to this MCP-only diff), and could not runtest:mcp-packlocally because this machine runs Node 24 while the repo pins Node 22 (.nvmrc);scripts/check-mcp-package.mjsthrowsERR_INVALID_ARG_TYPEon Node 24 identically on unmodifiedmain. CI runs the full matrix on the pinned Node.Safety
UI Evidencesection below. — N/A: no visible UI change.Notes
components/Button.cy.ts,e2e/login.e2e.tsx, andsrc/__snapshots__/Button.snap.tsare test files (and not code files), the existing test forms still classify as tests, and plainsrc/app.tsstays source.