Skip to content

feat(signals): classify build and CI configuration files in path-matchers (#561) - #1045

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
jason020818:feat/pr1-1782142284
Jun 23, 2026
Merged

feat(signals): classify build and CI configuration files in path-matchers (#561)#1045
JSONbored merged 2 commits into
JSONbored:mainfrom
jason020818:feat/pr1-1782142284

Conversation

@jason020818

Copy link
Copy Markdown
Contributor

Add isConfigFile() to distinguish build, lint, test-runner, and environment config files from source code and non-substantive padding. Expand ChangedFileCategory with a "config" bucket and wire it into classifyChangedFile after dependency manifests so config-only diffs are no longer lumped with source effort.

Recognised patterns: exact basenames (Dockerfile, Makefile, .editorconfig …), known prefixes (tsconfig, vitest.config, .env, .eslint …), the generic .config.ext / .rc.ext form, and dot-prefixed bare-rc files (.stylelintrc, .huskyrc). Lockfiles and dependency manifests still rank above config in the classifier, preserving the existing priority order.

Relates to the #561 slop-classification family of matchers.

…hers (JSONbored#561)

Add `isConfigFile()` to distinguish build, lint, test-runner, and environment
config files from source code and non-substantive padding. Expand
`ChangedFileCategory` with a `"config"` bucket and wire it into
`classifyChangedFile` after dependency manifests so config-only diffs are
no longer lumped with source effort.

Recognised patterns: exact basenames (Dockerfile, Makefile, .editorconfig …),
known prefixes (tsconfig, vitest.config, .env, .eslint …), the generic
`.config.ext` / `.rc.ext` form, and dot-prefixed bare-rc files (.stylelintrc,
.huskyrc). Lockfiles and dependency manifests still rank above config in the
classifier, preserving the existing priority order.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jason020818
jason020818 requested a review from JSONbored as a code owner June 22, 2026 15:46
@dosubot dosubot Bot added the size:M label Jun 22, 2026
@ghost ghost added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jun 22, 2026
@ghost

ghost commented Jun 22, 2026

Copy link
Copy Markdown

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

🛠️ Maintainer review — Held for maintainer review

Reviewed 2 changed file(s) — two independent AI reviewers, synthesized. ✅ Safe to merge — both reviewers found no blocking issues.

ℹ️ Correct and all CI green — held for maintainer review.

Merge readiness: ✅ Mergeable · all CI checks green/neutral/skipped.

Summary

The change adds comprehensive detection for build and CI configuration files, updates the file classification logic, and expands the ChangedFileCategory enum. All new functions are pure, deterministic, and have thorough unit tests covering typical and edge cases. TypeScript passes, CI is green, and no security concerns are introduced.

💡 Nits — non-blocking, optional

  • Consider adding documentation for the new config detection logic in the module header.
  • If other parts of the codebase switch on ChangedFileCategory, ensure they handle the new "config" case or have a default fallback.
  • Consider adding a comment explaining the rationale behind the specific config file names and prefixes chosen.
  • Consider adding a test case for edge cases, such as empty strings or paths with unusual characters.

@ghost ghost added the reviewbot-review label Jun 22, 2026
@ghost

ghost commented Jun 22, 2026

Copy link
Copy Markdown

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review — safe to merge

2 files · 2 AI reviewers · no blockers · readiness 93/100 · CI green · clean

✅ Approved — safe to merge

Review summary
The change introduces a new `isConfigFile` matcher and a corresponding "config" category in `ChangedFileCategory`. The implementation normalizes paths, checks exact basenames, known prefixes, generic `.config.ext` / `.rc.ext` patterns, and bare `.rc` suffixes. Tests cover positive and negative cases, and the classification order respects existing precedence (vendored > lockfile > dependency manifest > config). All existing CI checks pass, indicating no type errors or broken imports. The logic appears sound, handling null/undefined inputs gracefully via `normalize`. The only notable consideration is that other parts of the codebase that switch on `ChangedFileCategory` may now need to handle the new "config" value, but this does not affect current tests.

Suggestions

  • Add a unit test for edge cases like a filename ending with "rc" but not a config (e.g., "myrc") to confirm it is not falsely classified.
  • Document in the module header that the new "config" category is introduced and that downstream consumers should consider updating any exhaustive switches or weight mappings.
  • Consider adding a small comment explaining why the regex `/^\.[^.]+rc$/i` is used (to match dot‑prefixed rc files without an extension).
  • In `src/signals/path-matchers.ts`, consider adding a comment to explain the regex patterns used in `isConfigFile` for better maintainability.
  • In `test/unit/path-matchers.test.ts`, add tests for edge cases such as empty strings, paths with special characters, and mixed-case filenames to ensure robustness.

Risks

  • Any existing code that performs exhaustive pattern matching on `ChangedFileCategory` (e.g., switch statements without a default) may now encounter an unhandled "config" case, potentially leading to runtime errors or incorrect weighting in slop signals.
  • If other modules rely on the ordering of categories for priority, the insertion of "config" after dependency manifests could subtly change behavior; review any priority tables or scoring logic.
  • The new `isConfigFile` function relies on regex patterns and string matching, which could potentially miss edge cases or false positives. Thorough testing is crucial to ensure accuracy.
  • The addition of a new category in `ChangedFileCategory` could affect existing logic that relies on the previous categories. Ensure all relevant parts of the codebase are updated accordingly.
Signal Result Evidence
Code review ✅ No blockers 2 reviewers, synthesized
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.
Review load ✅ 20/20 Readiness component derived from cached public PR metadata and labels; size label size:M.
Validation evidence ✅ 25/25 PR body includes validation/test evidence.
Open PR queue ✅ 10/10 0 open PR(s), 0 likely reviewable.
Contributor context ✅ Confirmed Gittensor contributor jaso0n0818; Gittensor profile; 1360 PR(s), 5 issue(s).
Gate result ✅ Passing No configured blocker found.
Nits — 1 non-blocking
  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
Review context
  • Author: jaso0n0818
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, Rust, Shell, C++, Dart, Ruby, Scala, TypeScript
  • Official Gittensor activity: 1360 PR(s), 5 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • 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.
  • Review load = cached public PR metadata such as size labels, changed paths, and preflight status.
  • Open PR queue = repo-wide review pressure; it is not a PR quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
Review details

Generated from public PR metadata and the diff. Advisory only; deterministic signals remain authoritative.

The change introduces a new `isConfigFile` matcher and a corresponding "config" category in `ChangedFileCategory`. The implementation normalizes paths, checks exact basenames, known prefixes, generic `.config.ext` / `.rc.ext` patterns, and bare `.rc` suffixes. Tests cover positive and negative cases, and the classification order respects existing precedence (vendored > lockfile > dependency manifest > config). All existing CI checks pass, indicating no type errors or broken imports. The logic appears sound, handling null/undefined inputs gracefully via `normalize`. The only notable consideration is that other parts of the codebase that switch on `ChangedFileCategory` may now need to handle the new "config" value, but this does not affect current tests.

Suggestions

  • Add a unit test for edge cases like a filename ending with "rc" but not a config (e.g., "myrc") to confirm it is not falsely classified.
  • Document in the module header that the new "config" category is introduced and that downstream consumers should consider updating any exhaustive switches or weight mappings.
  • Consider adding a small comment explaining why the regex `/^\.[^.]+rc$/i` is used (to match dot‑prefixed rc files without an extension).
  • In `src/signals/path-matchers.ts`, consider adding a comment to explain the regex patterns used in `isConfigFile` for better maintainability.
  • In `test/unit/path-matchers.test.ts`, add tests for edge cases such as empty strings, paths with special characters, and mixed-case filenames to ensure robustness.

Risks

  • Any existing code that performs exhaustive pattern matching on `ChangedFileCategory` (e.g., switch statements without a default) may now encounter an unhandled "config" case, potentially leading to runtime errors or incorrect weighting in slop signals.
  • If other modules rely on the ordering of categories for priority, the insertion of "config" after dependency manifests could subtly change behavior; review any priority tables or scoring logic.
  • The new `isConfigFile` function relies on regex patterns and string matching, which could potentially miss edge cases or false positives. Thorough testing is crucial to ensure accuracy.
  • The addition of a new category in `ChangedFileCategory` could affect existing logic that relies on the previous categories. Ensure all relevant parts of the codebase are updated accordingly.

🟩 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

@ghost ghost added the gittensory:reviewed label Jun 22, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.28%. Comparing base (d7f4ccf) to head (85e5f33).
⚠️ Report is 24 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1045   +/-   ##
=======================================
  Coverage   95.28%   95.28%           
=======================================
  Files         149      149           
  Lines       18053    18061    +8     
  Branches     6535     6539    +4     
=======================================
+ Hits        17202    17210    +8     
  Misses        363      363           
  Partials      488      488           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Held for maintainer (guardrail_area) — correct + CI green

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants