Skip to content

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

Description

@JSONbored

Problem

PR #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 (eligibility plans, scenario summaries, Gittensor API client, etc).

`focus-manifest.ts` is reachable from `apps/gittensory-ui/src/lib/registration-workspace.ts` via a long-standing cross-boundary import (`import { isFocusManifestPublicSafe } from "../../../../src/signals/focus-manifest";`, present since #390). This means the UI's own `tsc --noEmit` now transitively type-checks the ENTIRE `local-branch.ts` import graph, including files that use Cloudflare Workers ambient types (`Env`, `D1Database`) the UI's tsconfig has no way to resolve (it only declares `"types": ["vite/client"]`, no `@cloudflare/workers-types`/`worker-configuration.d.ts`).

Result: `npm run ui:typecheck` fails repo-wide with ~35 files' worth of `Cannot find name 'Env'`/`Cannot find name 'D1Database'` errors, confirmed via bisection to start exactly at commit `525be40a` (PR #3690) and persisting on every subsequent main commit.

Fix

`isTestFile`/`isCodeFile` were only ever thin, self-contained path-matching helpers (`isTestFile` is a 1-line wrapper around `isTestPath` from the already-dependency-free `test-evidence.ts`; `isCodeFile` is a pure regex check) -- their location in `local-branch.ts` was incidental, not load-bearing. Moved both into `path-matchers.ts` (where they conceptually belong, and where `classifyChangedFile` already uses them), with `local-branch.ts` importing them back for its own internal use and re-exporting them so its ~9 existing external importers don't need to change their import path. `path-matchers.ts` now has zero dependency on `local-branch.ts`, fully and permanently severing the transitive path from the UI into the review-scoring subsystem -- not just for this one feature, but for any future `path-matchers.ts` caller.

Added a structural regression test (`test/unit/path-matchers.test.ts`) asserting `path-matchers.ts`'s source never contains an import from `./local-branch`, so this exact class of regression fails fast and locally instead of silently breaking `ui:typecheck` again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions