Repository navigation
fix(scanDiff): read commitConfig per push so --config block rules apply - #1891
Merged
Merged
Conversation
scanDiff read getCommitConfig() and getPrivateOrganizations() at module import time, before index.ts applies --config. It therefore kept the empty default block lists and never enforced the configured diff block rules. Move the two reads into combineMatches so they run per push, matching the pattern already used by checkMessages and checkAuthorEmails (which were unaffected by this bug). Add a regression test that imports scanDiff, then loads a config containing a blocked literal, and asserts the push is blocked. It fails against the old code and passes with this fix.
✅ Deploy Preview for endearing-brigadeiros-63f9d0 canceled.
|
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1891 +/- ##
=======================================
Coverage 88.87% 88.87%
=======================================
Files 127 127
Lines 7092 7092
Branches 1318 1318
=======================================
Hits 6303 6303
Misses 493 493
Partials 296 296 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jescalada
requested changes
Nov 14, 2026
jescalada
left a comment
Contributor
There was a problem hiding this comment.
Code changes LGTM, I would just remove all of the comments since clarification isn't needed 🙂
Contributor
Author
|
Thanks for the review @jescalada. I've removed the comments I added. The license headers and the existing comments in scanDiff.ts are untouched 🙂 |
jescalada
approved these changes
Nov 19, 2026
Contributor
|
@goldensyntax Thanks for fixing it up! |
jescalada
enabled auto-merge
November 19, 2026 05:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
scanDiffread its configuration at module import time:index.tsimports the proxy (and thereforescanDiff) before it applies--config, soscanDiffcaptured only the empty defaultcommitConfig.diff.blocklists and never sawthe configured rules. Pushes that should have been blocked were sent to approval instead,
with no error.
This PR moves the two reads into
combineMatches, so they run per push, after the confighas been loaded:
As suggested by @kriswest, I also checked
checkMessagesandcheckAuthorEmailswhilediagnosing this issue. They do not have this problem, as both already read config inside
their per-push functions. This change only changes the config read timing in
scanDiff,ensuring it reads the config per push.
Test
This PR introduces a regression test (
test/processors/scanDiff.configTiming.test.ts) thatchecks a block rule from a config loaded after
scanDiffis imported is still enforced,which is the exact scenario that was failing.
It configures a blocked literal, runs
scanDiffover a diff that adds that literal, andexpects the push to be blocked. The config is loaded after the import on purpose, to mirror
--configbeing applied after the module loads. The test fails on the old code and passeswith this fix.
Related Issue
Resolves #1874
Checklist
General
Documentation
Configuration
config.schema.json) was modified:npm run generate-config-types)npm run gen-schema-doc)Tests
npm test)npm run lintandnpm run format:check)npm run check-types)