refactor(signals): consolidate isTestFile/isCodeFile into gittensory-engine - #4144
Conversation
…engine isTestFile/isCodeFile were hand-ported three times (canonical in src/signals/test-evidence.ts + path-matchers.ts, plus independent copies in packages/gittensory-mcp/lib/local-branch.js and packages/gittensory-mcp/scripts/gittensor-score-preview.mjs) -- commit history has multiple "re-sync isTestFile with the server" fixes for exactly this drift. A fourth, already-half-done copy was sitting unused in packages/gittensory-engine/src/signals/test-evidence.ts (orphaned from #3882, stale relative to the root file, never wired into the package's exports or imported anywhere). Makes the engine copy the actual up-to-date canonical source (adding the extended isCodeFile alongside isTestPath/isSourcePath), and turns src/signals/test-evidence.ts into a thin re-export shim -- same pattern already used for scoring/preview.ts and focus-manifest.ts. path-matchers.ts now delegates isCodeFile to the same source instead of composing its own copy. Every existing call site keeps importing from the same paths. The two packages/gittensory-mcp hand-ports aren't touched yet -- they can't depend on @jsonbored/gittensory-engine until it's actually published to npm (it currently only resolves via the workspace symlink), which needs a one-time manual bootstrap outside CI. Follow-up once that's done.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 62464c5 | Commit Preview URL Branch Preview URL |
Jul 08 2026, 07:48 AM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4144 +/- ##
==========================================
- Coverage 93.71% 93.71% -0.01%
==========================================
Files 385 384 -1
Lines 36212 36199 -13
Branches 13266 13264 -2
==========================================
- Hits 33937 33924 -13
Misses 1618 1618
Partials 657 657
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-08 07:59:33 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 6 non-blocking
Concerns raised — review before merging
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.
|
…nd-ports (#4159) Now that @jsonbored/gittensory-engine is published (0.1.0), gittensory-mcp adds it as a real dependency and both packages/gittensory-mcp/lib/local-branch.js and scripts/gittensor-score-preview.mjs import isTestFile/isCodeFile from @jsonbored/gittensory-engine/signals/test-evidence instead of hand-porting the regex logic -- the two remaining copies from the three-way drift that motivated the gittensory-engine consolidation (#4144). package-lock.json: hand-edited a single line rather than running `npm install --package-lock-only`, which was proven (twice, with and without --workspace scoping) to destructively prune ~150 unrelated packages from this monorepo's lockfile. Workspace-to-workspace dependencies only need the manifest-mirror entry updated; the shared node_modules symlink already resolves it. ci.yml: gittensory-mcp's "Build MCP"/"MCP package check" steps and the mcpCliHarness test-skip filter only checked the mcp path filter, not engine -- a PR touching only packages/gittensory-engine/** would have silently skipped rebuilding, pack-checking, and testing its now-real dependent. Verified end-to-end outside the monorepo: packed the mcp tarball, installed it into an isolated scratch directory, confirmed gittensory-engine resolved as a real registry copy (not a workspace symlink) and the classifier functions work through the full published dependency chain.
Summary
isTestFile/isCodeFilewere hand-ported three times: canonical insrc/signals/test-evidence.ts+src/signals/path-matchers.ts, plus independent copies inpackages/gittensory-mcp/lib/local-branch.jsandpackages/gittensory-mcp/scripts/gittensor-score-preview.mjs. Commit history has multiple "re-sync isTestFile with the server" fixes for exactly this drift (e.g. fix(mcp): re-sync isTestFile with the server isTestPath (pytest prefix + JVM/C#/Swift) #2753, fix(signals): exclude generated Dart part files from code scoring #3724).packages/gittensory-engine/src/signals/test-evidence.ts— orphaned from feat(miner-foundation): move buildPredictedGateVerdict into gittensory-engine (#2283) #3882 (35 lines, 2 exports), stale relative to the current root file (missingisSourcePath,hasLocalTestEvidence,classifyTestCoverage,TEST_FRAMEWORKS,detectTestConvention), not wired into the package'sexportsmap, not imported anywhere.isCodeFilealongsideisTestPath/isSourcePath), and turnssrc/signals/test-evidence.tsinto a thin re-export shim — same pattern already used forsrc/scoring/preview.tsandsrc/signals/focus-manifest.ts.path-matchers.tsnow delegatesisCodeFileto the same source instead of composing its own copy.isTestPath/hasLocalTestEvidence/etc. fromtest-evidence.ts) keeps importing from the exact same paths — zero blast-radius rename.packages/gittensory-mcphand-ports are not touched yet — they can't depend on@jsonbored/gittensory-engineuntil it's actually published to npm (currently only resolves via the workspace symlink). That needs a one-time manual bootstrap outside CI/this PR; follow-up once that's done.Test plan
npm run typecheck— cleannpm run test:engine-parity— passesnpx vitest run test/unit/path-matchers.test.ts test/unit/test-evidence.test.ts test/unit/slop.test.ts test/unit/boundary-test-generation.test.ts— 175 tests pass unchanged