fix: run the unmocked commit-check test on the CLI's defaults, not the checkout's - #286
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe integration test now pins configuration, git identity, and environment variables. CLI checks use the explicit temporary configuration instead of ambient repository or organization settings. ChangesDeterministic integration tests
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Other · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to The test-only change isolates temporary state correctly and explicitly controls CLI configuration, with no established production or merge-blocking risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Commit Check✅ All 5 checks passed Show all 5 checkscommit-check 2.18.0 · Rules reference |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #286 +/- ##
=======================================
Coverage 95.11% 95.11%
=======================================
Files 1 1
Lines 614 614
=======================================
Hits 584 584
Misses 30 30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…e checkout's TestRealCommitCheckBinary pipes a message to the real commit-check and asserts the verdict. It ran from this repo's checkout, so the CLI read commit-check.toml -- which inherits the org config over the network -- and, on a runner with no git identity, weighed ignore_authors against the author of HEAD. On a Dependabot PR that author is dependabot[bot], which the org config ignores, so every message check skipped and the test saw "skip" where it asserted "pass" or "fail" (#284, on every OS and Python in the matrix, plus coverage). The same on 2.17.0 and 2.18.0: the bump is not the cause, the test just had never met a bot commit since #279 added it. A piped message describes no commit. Pin everything the verdict was picking up from the surroundings: an explicit, empty --config so no repo or org config applies and ignore_authors names nobody; a known identity at git's global and system levels so the author lookup never falls through to HEAD; and no inherited CCHK_* variable, which would override the file. commit-check's own suite pins the same two lookups for the same reason (its pinned_author fixture); this is that pin from outside the process. No change to main.py.
1250436 to
2822b24
Compare
Why #284 went red
main_test.py::TestRealCommitCheckBinarypipes a message to the real, unmockedcommit-checkand asserts the verdict. It ran from this repo's checkout, so the CLI readcommit-check.toml(which inherits the org config over the network), and — on a runner with no git identity — weighedignore_authorsagainst the author ofHEAD. On a Dependabot PR that author isdependabot[bot], which the org config ignores, so every message check skipped and the test sawskipwhere it assertedpass/fail. That is what failed all sixtestjobs andcoverageon #284.Reproduced identically on commit-check 2.17.0 and 2.18.0: the version bump is not the cause. The test was added in #279 and #284 is simply the first Dependabot PR since.
The
HEAD-author fallback in commit-check is intentional (commit-check#461, covered by itsengine_test.py), and commit-check's own suite guards against exactly this with apinned_authorfixture. So the fix belongs here, in the test.Fix (test only,
main.pyuntouched)Pin everything the verdict was picking up from the surroundings:
--config, so no repo or org config applies andignore_authorsnames nobody (also: no network fetch in the test suite);GIT_CONFIG_GLOBAL/GIT_CONFIG_SYSTEM, so the author lookup never falls through toHEAD;CCHK_*variable, since the environment overrides the file.Verified
HEADauthoreddependabot[bot], no git identity anywhere): unfixed test fails as on chore(deps): bump commit-check from 2.17.0 to 2.18.0 #284; fixed test passes.CCHK_IGNORE_AUTHORSnaming the pinned identity, outer git config nulled: fixed test passes.pre-commit: clean.Supersedes #285 (closed) — same diagnosis, but this is the complete isolation CodeRabbit asked for there, as a single test-only change.
#284
Nothing wrong with the bump itself. Once this merges,
@dependabot rebase(or re-running its checks) should turn it green.Summary by CodeRabbit