fix(mcp): re-sync isTestFile with the server isTestPath (pytest prefix + JVM/C#/Swift) - #2753
Conversation
…x + JVM/C#/Swift) The MCP local-branch isTestFile is a standalone inlined copy of the server's canonical isTestPath (packages/gittensory-mcp ships as a Node bin package, so it cannot import from src/). Two conventions added to isTestPath were never mirrored here: the pytest `test_*.py` prefix (JSONbored#2666) and the JVM/C#/Swift `SomethingTest(s)`/`Spec` class-suffix (JSONbored#2743). So the local pre-submit predictor counted Java/Kotlin/Scala/C#/Swift test classes and pytest-prefixed files as SOURCE, disagreeing with the server gate's own test-coverage classification and misleading contributors in those ecosystems about readiness. Add both rules verbatim from isTestPath (same order, same case-sensitive JVM suffix so `Latest.java`/`Contest.cs`/`manifest.scala` stay source). Adds regressions to the MCP-copy classifier test.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2753 +/- ##
=======================================
Coverage 96.09% 96.09%
=======================================
Files 245 245
Lines 27391 27391
Branches 9947 9947
=======================================
Hits 26322 26322
Misses 443 443
Partials 626 626 🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-03 18:39:27 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 4 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
What
The MCP
local-branchisTestFile(packages/gittensory-mcp/lib/local-branch.js) is a standalone inlined copy of the server's canonicalisTestPath(src/signals/test-evidence.ts) — the MCP ships as a Node bin package and can't import fromsrc/. Two test-convention rules added toisTestPathwere never mirrored into this copy:test_*.pyprefix (#2666)SomethingTest(s)/Specclass-suffix (#2743):\w*(Tests?|Spec)\.(java|kt|kts|scala|cs|swift|groovy)Why it matters
isTestFiledrives how the MCP's local pre-submit predictor classifies changed files (test vs source) when it builds the local score packet. Because these two rules were missing, the predictor counted Java/Kotlin/Scala/C#/Swift test classes and pytest-prefixed files as SOURCE — disagreeing with the server gate's own test-coverage classification. A contributor in those ecosystems using the MCP gets a wrong local prediction about their test coverage / readiness.Concrete:
app/FooTests.java,src/BarSpec.kt,tests/test_utils.pywere all classified as non-test (and, for the.java/.kt/.scalaones, wrongly counted as code) by the MCP, while the server treats them as tests.Fix
Add both rules verbatim from
isTestPath— same order, same case-sensitive JVM suffix so a source file merely ending in "test"/"spec" (Latest.java,Contest.cs,manifest.scala) stays source. This restores the copy's parity with the canonical matcher (the same single-sourcing discipline as#2665).Tests
Extends the existing MCP-copy classifier test (
test/unit/local-branch.test.ts) with the pytest-prefix and JVM/C#/Swift test cases (now classified as tests) plus the case-sensitive negatives (still source). Fails on the pre-fix copy, passes with the fix.