feat(review): deterministic changed-file classifier (#2143) - #3547
Conversation
Add a pure `classifyChangedFile(path)` that maps a changed file to one of five review buckets — source / test / docs / config / generated — so the changed-files summary (and future analytics) group deterministically. Pure + path-only (no diff content, no IO); composes the existing hardened path-matchers. - src/review/changed-files-classify.ts: fixed precedence generated > test > docs > config > source (documented), so a file matching several buckets — a generated test file, a lockfile, a vendored fixture — always resolves to the higher-precedence class. Reuses isGeneratedFile/isVendoredFile/isLockfile/isMinifiedFile, isTestFile/isTestPath, isDocsFile, isConfigFile. - Distinct from path-matchers' 10-way `classifyChangedFile` (different category set AND precedence: that one ranks config above test), so it can't just fold it. - test/unit/changed-files-classify.test.ts: one file per class, precedence conflict (vendored test file → generated), lockfile/vendored/minified/generated → generated, unknown → source; asserts the underlying matcher for each path. Part of JSONbored#1957. Pure function + tests only — no rendering.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-05 16:44:18 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.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3547 +/- ##
=======================================
Coverage 93.10% 93.10%
=======================================
Files 302 303 +1
Lines 31496 31501 +5
Branches 11502 11506 +4
=======================================
+ Hits 29325 29330 +5
Misses 1517 1517
Partials 654 654
🚀 New features to boost your workflow:
|
Closes #2143 (part of #1957).
Adds a pure
classifyChangedFile(path)that maps a changed file to one of five review buckets — source / test / docs / config / generated — so the changed-files summary table (and future analytics) group deterministically. Pure + path-only — no diff content, no IO — composing the existing hardenedpath-matchers.Design
generated > test > docs > config > source(documented), so a file matching several buckets — a generated test file, a lockfile, a vendored fixture — always resolves to the higher-precedence class.isGeneratedFile/isVendoredFile/isLockfile/isMinifiedFile(→ generated),isTestFile/isTestPath,isDocsFile,isConfigFile.path-matchers.ts's existing 10-wayclassifyChangedFile: that one has a different category set and precedence (it ranksconfigabovetest), so this review classifier composes its own precedence rather than folding it.Tests
One file per class, the precedence conflict (a vendored test file →
generated), lockfile/vendored/minified/generated →generated, and unknown →source. Each path also asserts its underlying matcher (covering both arms).Typecheck clean. Pure function + tests only — no rendering (keeps the #1957 render slice small).