Skip to content

fix(signals): move isTestFile/isCodeFile out of local-branch.ts to unbreak ui:typecheck - #3709

Merged
JSONbored merged 1 commit into
mainfrom
fix/focus-manifest-docs-file-import-boundary
Jul 6, 2026
Merged

fix(signals): move isTestFile/isCodeFile out of local-branch.ts to unbreak ui:typecheck#3709
JSONbored merged 1 commit into
mainfrom
fix/focus-manifest-docs-file-import-boundary

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • PR feat(review): skip auto-review of docs-only PRs via review.auto_review.skip_docs_only #3690 (`review.auto_review.skip_docs_only`) added `import { classifyChangedFile } from "./path-matchers";` to `src/signals/focus-manifest.ts`. `path-matchers.ts` itself imports `isCodeFile`/`isTestFile` from `./local-branch` — a large module pulling in the whole review-scoring/Gittensor-API subsystem.
  • `focus-manifest.ts` is reachable from `apps/gittensory-ui/src/lib/registration-workspace.ts` via a long-standing cross-boundary import (present since feat(control-panel): add repo owner registration workspace #390). This means `npm run ui:typecheck` started transitively type-checking the entire `local-branch.ts` import graph, including files using Cloudflare Workers ambient types (`Env`, `D1Database`) the UI's tsconfig has no way to resolve.
  • Confirmed via direct bisection (checkout + fresh reproduction at each commit, not just CI timestamp order, which can be misleading when runs complete out of sequence): broke exactly at commit `525be40a`, persists on every subsequent main commit, ~35 files' worth of `Cannot find name 'Env'`/`'D1Database'` errors.
  • `isTestFile`/`isCodeFile` were only ever thin, self-contained path-matching helpers incidentally defined in `local-branch.ts` (`isTestFile` is a 1-line wrapper around the already-dependency-free `isTestPath`; `isCodeFile` is a pure regex check). Moved both into `path-matchers.ts`, with `local-branch.ts` importing them back and re-exporting for its ~9 existing importers. `path-matchers.ts` now has zero dependency on `local-branch.ts` — permanently, not just for this one feature.
  • Added a structural regression test asserting `path-matchers.ts`'s source never contains an import from `./local-branch`, so this exact regression class fails fast locally instead of silently breaking `ui:typecheck`.

Closes #3708

Scope

  • `src/signals/path-matchers.ts` — gains `isTestFile`/`isCodeFile`, loses the `local-branch` import
  • `src/signals/local-branch.ts` — imports + re-exports both from `path-matchers.ts` instead of defining them
  • `test/unit/path-matchers.test.ts` — new structural guard test

No behavior change: both functions' bodies are byte-identical, just relocated.

Validation

  • `npm run typecheck` — clean
  • `npm run ui:typecheck` — clean (was failing with ~35 files of Env/D1Database errors before this fix)
  • `npx vitest run test/unit/path-matchers.test.ts test/unit/local-branch.test.ts test/unit/local-branch-file-classifiers.test.ts test/unit/changed-files-classify.test.ts test/unit/focus-manifest.test.ts test/unit/auto-review-wiring.test.ts test/unit/auto-review-config-matrix.test.ts test/unit/queue.test.ts test/unit/signals-coverage.test.ts test/unit/finding-category-classify.test.ts test/unit/slop.test.ts test/unit/local-scorer.test.ts test/unit/engine.test.ts test/unit/contributor-open-pr-monitor.test.ts` (every existing importer of `isCodeFile`/`isTestFile`, plus everything downstream of `focus-manifest.ts`'s `skip_docs_only`) — 1333/1333 passing
  • Diffed my changed hunk (`git diff main -- src/signals/path-matchers.ts`) against the coverage report to confirm 100% of the actual diff is covered; the only file-level "uncovered" lines reported are pre-existing, untouched helper functions outside my diff range

Safety

  • No secrets, wallet/hotkey/trust-score/reward terms introduced
  • No behavior change to any classifier's output — confirmed by the full existing test suite for every consumer passing unchanged

…break ui:typecheck

path-matchers.ts importing isCodeFile/isTestFile from local-branch.ts pulled
the whole review-scoring/Gittensor-API subsystem into any caller's import
graph. focus-manifest.ts (which PR #3690 made import classifyChangedFile
from path-matchers.ts) is reachable from the UI via a long-standing
cross-boundary import, so ui:typecheck started failing repo-wide with
Env/D1Database ambient-type errors it has no way to resolve.

Both functions were only ever thin, self-contained path-matching helpers
incidentally defined in local-branch.ts. Move them into path-matchers.ts
(zero remaining dependency on local-branch.ts), with local-branch.ts
importing them back and re-exporting for its existing importers. Add a
structural test asserting path-matchers.ts never imports from local-branch.ts
again.
@superagent-security

Copy link
Copy Markdown
Contributor

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

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

loopover-orb Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Warning

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

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-06 05:29:30 UTC

3 files · 1 AI reviewer · no blockers · readiness 100/100 · CI pending · blocked

⏸️ Suggested Action - Manual Review

Review summary
This PR moves the self-contained `isTestFile`/`isCodeFile` path matchers from `local-branch.ts` into `path-matchers.ts` (which now implements them directly via the already-dependency-free `isTestPath`), then has `local-branch.ts` import and re-export them for its existing ~9 consumers. This correctly breaks the reachability of `local-branch.ts`'s heavy review-scoring/Workers-typed subsystem from `path-matchers.ts` -> `focus-manifest.ts` -> the UI's `registration-workspace.ts`, which was causing `ui:typecheck` to fail on ~35 files. The added structural test (asserting `path-matchers.ts`'s source never imports from `./local-branch`) is a good regression guard for exactly this failure class, and the fix targets the root cause (the import graph) rather than patching a symptom.

Nits — 5 non-blocking
  • local-branch.ts:26-29 (diff) swaps its `import { isTestPath } from "./test-evidence"` for `import { isCodeFile, isTestFile } from "./path-matchers"` — confirm `isTestPath` isn't used anywhere else in this 1272-line file (e.g. in coverage-classification logic) beyond the moved `isTestFile` definition, since the diff only shows the two functions being relocated and the rest of the file wasn't included to verify.
  • The large explanatory comment block duplicated verbatim between the old and new location in path-matchers.ts/local-branch.ts (language-extension rationale) could be trimmed to a single reference comment plus a pointer, but this is purely cosmetic since it was moved, not newly authored.
  • Double-check with a full-file view of local-branch.ts that no other reference to `isTestPath` remains dangling after the import swap.
  • Consider whether the regression test in test/unit/path-matchers.test.ts should also assert path-matchers.ts has zero imports outside a small allowlist (e.g. `./test-evidence`), to catch a future reintroduction via a different heavy module, not just `./local-branch` specifically.
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #3708
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 (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 54 registered-repo PR(s), 46 merged, 439 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 54 PR(s), 439 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: Python, TypeScript, JavaScript, Ruby, Go, Kotlin, MDX, Shell
  • Official Gittensor activity: 54 PR(s), 439 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • No action.
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

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.36%. Comparing base (1c0a636) to head (c8f0b55).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3709   +/-   ##
=======================================
  Coverage   93.36%   93.36%           
=======================================
  Files         315      315           
  Lines       32204    32204           
  Branches    11812    11812           
=======================================
  Hits        30066    30066           
  Misses       1507     1507           
  Partials      631      631           
Files with missing lines Coverage Δ
src/signals/local-branch.ts 97.18% <ø> (-0.03%) ⬇️
src/signals/path-matchers.ts 89.09% <100.00%> (+0.62%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit af0c3c0 into main Jul 6, 2026
10 checks passed
@JSONbored
JSONbored deleted the fix/focus-manifest-docs-file-import-boundary branch July 6, 2026 05:35
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(signals): path-matchers.ts importing local-branch.ts breaks ui:typecheck repo-wide

1 participant