fix(signals): count C#/Swift/Groovy source as code files#2776
Conversation
isCodeFile recognized the JVM trio (kt/scala/java) plus go/rust/python, but not cs/swift/groovy — even though isTestPath already recognizes their SomethingTest(s)/Spec test files. So a C#/Swift/Groovy source file was classified as neither test nor code by the local scorer, understating real source effort while its test counterpart still counted as a test. Add cs/swift/groovy to both isCodeFile copies (local-branch.ts + engine.ts, kept in sync) so their source counts as code, and cover the source-as-code plus test-still-excluded cases.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2776 +/- ##
=======================================
Coverage 96.12% 96.12%
=======================================
Files 248 248
Lines 27548 27550 +2
Branches 10007 10007
=======================================
+ Hits 26480 26483 +3
Misses 443 443
+ Partials 625 624 -1
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-03 19:43:59 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 5 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.
|
The MCP score-preview scorer (gittensor-score-preview.mjs) and its Python metadata-fallback (gittensor-score-preview.py) carry their own copies of the code-extension list; add cs/swift/groovy there too so C#/Swift/Groovy source counts as code on every scoring path, matching the signal classifiers.
Recognizing cs/swift/groovy as code in the preview scorers meant their PascalCase test classes (AccountTests.cs, LoginTests.swift) were counted as source. Add the case-sensitive `SomethingTest(s)/Spec` suffix rule to the .mjs isTestFile and the .py is_test_file so those test files are excluded from code, matching the signal classifiers (Latest.cs/Contest.cs stay code).
…sifiers lib/local-branch.js carries committed copies of isCodeFile/isTestFile; add cs/swift/groovy to isCodeFile and the JVM/C#/Swift PascalCase test suffix to isTestFile so every classifier copy agrees (C#/Swift/Groovy source counts as code, their test classes stay tests).
…languages # Conflicts: # packages/gittensory-mcp/lib/local-branch.js
… conventions The local score-preview scripts inline their own test/code classifiers (they ship in the standalone Node bin package and can't import from src/). Both had drifted from the canonical isTestPath/isCodeFile: the .mjs and .py test detectors missed the pytest `test_*.py` prefix (JSONbored#2666), the Cypress/Playwright `*.cy.*`/`*.e2e.*` convention and `__snapshots__` dirs (JSONbored#2665); the `.mjs` isCodeFile and the `.py` metadata_fallback source-extension tuple both missed the `.mts/.cts/.mjs/.cjs` module extensions. So a miner's LOCAL preview classified a `.mts` source file as non-code and a Cypress/pytest test as source — disagreeing with the gate's own source/test split and skewing the previewed token scores. (JSONbored#2776 already re-synced these scripts' C#/Swift/Groovy code extensions; this closes the older test-convention + module- extension gaps.) Bring both scripts' classifiers to parity with isTestPath/isCodeFile. Adds a spawn-based regression running the real .mjs (and the .py metadata_fallback when python is available) over module-ext/Cypress/pytest files.
… conventions The local score-preview scripts inline their own test/code classifiers (they ship in the standalone Node bin package and can't import from src/). Both had drifted from the canonical isTestPath/isCodeFile: the .mjs and .py test detectors missed the pytest `test_*.py` prefix (JSONbored#2666), the Cypress/Playwright `*.cy.*`/`*.e2e.*` convention and `__snapshots__` dirs (JSONbored#2665); the `.mjs` isCodeFile and the `.py` metadata_fallback source-extension tuple both missed the `.mts/.cts/.mjs/.cjs` module extensions. So a miner's LOCAL preview classified a `.mts` source file as non-code and a Cypress/pytest test as source — disagreeing with the gate's own source/test split and skewing the previewed token scores. (JSONbored#2776 already re-synced these scripts' C#/Swift/Groovy code extensions; this closes the older test-convention + module- extension gaps.) Bring both scripts' classifiers to parity with isTestPath/isCodeFile. Adds a spawn-based regression running the real .mjs (and the .py metadata_fallback when python is available) over module-ext/Cypress/pytest files.
… conventions The local score-preview scripts inline their own test/code classifiers (they ship in the standalone Node bin package and can't import from src/). Both had drifted from the canonical isTestPath/isCodeFile: the .mjs and .py test detectors missed the pytest `test_*.py` prefix (JSONbored#2666), the Cypress/Playwright `*.cy.*`/`*.e2e.*` convention and `__snapshots__` dirs (JSONbored#2665); the `.mjs` isCodeFile and the `.py` metadata_fallback source-extension tuple both missed the `.mts/.cts/.mjs/.cjs` module extensions. So a miner's LOCAL preview classified a `.mts` source file as non-code and a Cypress/pytest test as source — disagreeing with the gate's own source/test split and skewing the previewed token scores. (JSONbored#2776 already re-synced these scripts' C#/Swift/Groovy code extensions; this closes the older test-convention + module- extension gaps.) Bring both scripts' classifiers to parity with isTestPath/isCodeFile. Adds a spawn-based regression running the real .mjs (and the .py metadata_fallback when python is available) over module-ext/Cypress/pytest files.
… conventions (#2822) The local score-preview scripts inline their own test/code classifiers (they ship in the standalone Node bin package and can't import from src/). Both had drifted from the canonical isTestPath/isCodeFile: the .mjs and .py test detectors missed the pytest `test_*.py` prefix (#2666), the Cypress/Playwright `*.cy.*`/`*.e2e.*` convention and `__snapshots__` dirs (#2665); the `.mjs` isCodeFile and the `.py` metadata_fallback source-extension tuple both missed the `.mts/.cts/.mjs/.cjs` module extensions. So a miner's LOCAL preview classified a `.mts` source file as non-code and a Cypress/pytest test as source — disagreeing with the gate's own source/test split and skewing the previewed token scores. (#2776 already re-synced these scripts' C#/Swift/Groovy code extensions; this closes the older test-convention + module- extension gaps.) Bring both scripts' classifiers to parity with isTestPath/isCodeFile. Adds a spawn-based regression running the real .mjs (and the .py metadata_fallback when python is available) over module-ext/Cypress/pytest files.
Summary
isCodeFilerecognized the JVM trio (kt/scala/java) plus go/rust/python, but notcs/swift/groovy— even thoughisTestPathalready recognizes theirSomethingTest(s)/Spectest files. So a C#/Swift/Groovy source file was classified as neither test nor code by the local scorer, understating real source effort while its test counterpart still counted as a test.Adds
cs/swift/groovyto bothisCodeFilecopies (local-branch.ts+engine.ts, kept in sync).Validation
npx vitest run test/unit/local-branch-file-classifiers.test.ts test/unit/local-branch.test.ts— green (source-as-code + test-still-excluded)npm run typecheck— clean