Skip to content

refactor(signals): consolidate isTestFile/isCodeFile into gittensory-engine - #4144

Merged
JSONbored merged 1 commit into
mainfrom
refactor/consolidate-mcp-classifier
Jul 8, 2026
Merged

refactor(signals): consolidate isTestFile/isCodeFile into gittensory-engine#4144
JSONbored merged 1 commit into
mainfrom
refactor/consolidate-mcp-classifier

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • isTestFile/isCodeFile were hand-ported three times: canonical in src/signals/test-evidence.ts + src/signals/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 (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).
  • A fourth, already-half-done copy was found sitting unused in 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 (missing isSourcePath, hasLocalTestEvidence, classifyTestCoverage, TEST_FRAMEWORKS, detectTestConvention), not wired into the package's exports map, not imported anywhere.
  • Makes the engine copy the real, up-to-date canonical source (adds the extended isCodeFile alongside isTestPath/isSourcePath), and turns src/signals/test-evidence.ts into a thin re-export shim — same pattern already used for src/scoring/preview.ts and src/signals/focus-manifest.ts. path-matchers.ts now delegates isCodeFile to the same source instead of composing its own copy.
  • Every existing call site (13+ files import isTestPath/hasLocalTestEvidence/etc. from test-evidence.ts) keeps importing from the exact same paths — zero blast-radius rename.
  • The two packages/gittensory-mcp hand-ports are not touched yet — they can't depend on @jsonbored/gittensory-engine until 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 — clean
  • npm run test:engine-parity — passes
  • npx 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

…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-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.71%. Comparing base (acddda9) to head (62464c5).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

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              
Files with missing lines Coverage Δ
...ges/gittensory-engine/src/signals/test-evidence.ts 100.00% <100.00%> (ø)
src/signals/path-matchers.ts 88.67% <ø> (-0.61%) ⬇️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 8, 2026
@loopover-orb

loopover-orb Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-08 07:59:33 UTC

4 files · 1 AI reviewer · 2 blockers · readiness 93/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.

Review summary
This is a clean, mechanical extraction: the isTestPath/isSourcePath/isCodeFile/hasLocalTestEvidence/hasValidationNote/classifyTestCoverage/detectTestConvention family moves verbatim from src/signals/test-evidence.ts into packages/gittensory-engine/src/signals/test-evidence.ts, with the root file reduced to a re-export shim (`export * from "../../packages/gittensory-engine/src/signals/test-evidence"`) — the same pattern already used for scoring/preview.ts and focus-manifest.ts. Comparing the full post-change content of both files confirms byte-for-byte parity, path-matchers.ts's isCodeFile is now a thin re-export instead of a duplicated implementation with identical semantics (isTestFile(file) and isTestPath(file) are equivalent, so the `!isTestFile` → `!isTestPath` swap changes nothing), and every existing call site keeps its original import path so blast radius is effectively zero. CI is green (typecheck, engine-parity check, and the 175 existing unit tests pass unchanged), which is exactly what a faithful copy-move should produce.

Nits — 6 non-blocking
  • The PR description doesn't cite an issue this closes (only references historical incident PRs 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 for context) — worth adding an explicit issue link per repo convention even though this is clearly justified refactor/de-drift work, not speculative scope.
  • packages/gittensory-engine/package.json adds a `./signals/test-evidence` export pointing at `dist/signals/test-evidence.{d.ts,js}`, but nothing in this diff shows the engine's build being run/verified for that path — worth confirming `npm run build` in packages/gittensory-engine actually emits `dist/signals/test-evidence.js` before this export map is exercised by an external consumer.
  • The two packages/gittensory-mcp hand-ports (local-branch.js, gittensory-score-preview.mjs) are explicitly left un-migrated per the description — that's reasonable given the npm-publish blocker, but it means the three-way drift risk this PR is trying to close only partially closes until the follow-up lands.
  • Zero test lines were added, which is expected for a pure move but will read as 0% coverage on changed lines in some coverage tooling — the `test:engine-parity` + unchanged-175-tests plan is the right verification for a copy, just worth calling out explicitly in the PR body so reviewers don't second-guess the coverage number.
  • Add a 'Closes #NNNN' (or equivalent) link if there's a tracked issue for the repeated isTestFile drift, per this repo's contributor-issue-link convention.
  • Code changes lack test evidence — Add focused regression tests or explain why existing coverage is sufficient.

Concerns raised — review before merging

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
Signal Result Evidence
Code review ❌ 2 blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 52 registered-repo PR(s), 43 merged, 496 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 52 PR(s), 496 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, JavaScript, Ruby, Go, Kotlin, MDX, Shell
  • Official Gittensor activity: 52 PR(s), 496 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 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.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 8, 2026
@JSONbored
JSONbored merged commit cd9b136 into main Jul 8, 2026
12 checks passed
@JSONbored
JSONbored deleted the refactor/consolidate-mcp-classifier branch July 8, 2026 08:02
JSONbored added a commit that referenced this pull request Jul 8, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Development

Successfully merging this pull request may close these issues.

1 participant