-
Notifications
You must be signed in to change notification settings - Fork 58
fix(ci): Get release commit from tag instead of stale last_commit #945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #945 +/- ##
==========================================
+ Coverage 86.98% 87.02% +0.04%
==========================================
Files 35 35
Lines 3780 3816 +36
Branches 774 783 +9
==========================================
+ Hits 3288 3321 +33
- Misses 354 356 +2
- Partials 138 139 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This fixes an issue where release webhooks would create test entries with invalid or incorrect commit hashes. The previous code used `last_commit` from GeneralData, which represents the HEAD of master at the time of the last push event - not necessarily the commit the release tag points to. Changes: - Add `is_valid_commit_hash()` helper function to validate commit hashes - Modify release webhook to fetch commit directly from tag via GitHub API - Handle both lightweight and annotated tags correctly - Fall back to last_commit only if tag lookup fails - Add validation in `add_test_entry()` to reject invalid commits - Handle case where no test exists for the commit (prevents crash) - Add comprehensive unit tests for all scenarios This prevents: - Test entries with null SHA (0000000...) - Test entries with stale/wrong commit hashes - Crashes when test is None during baseline update Credit: Based on issue identified by NexionisJake in PR #937 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Update existing tests to mock get_git_ref for release webhooks - Replace invalid commit hash strings with valid 40-char hex strings - 'customizedcommitcheck' -> valid hex (not valid hex chars) - 'abcdefgh' -> valid 40-char hex (was only 8 chars) - Mock commit hashes in new tests must be valid hex 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add missing test cases to increase patch coverage: - Test whitespace stripping in is_valid_commit_hash() - Test rejection of hashes > 40 characters - Test release webhook with existing test entry (covers baseline update path) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
84d6105 to
c47a101
Compare
c47a101 to
6fe88f0
Compare
|



Summary
This PR fixes an issue where release webhooks would create test entries with invalid or incorrect commit hashes (such as
0000000000000000000000000000000000000000).The Problem
The previous code used
last_commitfrom GeneralData to get the commit hash for releases. This is problematic because:last_commitrepresents HEAD of master at the time of the last push eventThe Solution
New
is_valid_commit_hash()helper function - Validates that a commit hash is:Release webhook now fetches commit from tag - Uses GitHub API to get the actual commit:
last_commitonly if tag lookup failsValidation in
add_test_entry()- Rejects invalid commit hashes before creating test entriesNull-safe baseline update - Checks if test exists before trying to update baseline (prevents AttributeError crash)
Credit
Based on issue and approach identified by @NexionisJake in PR #937. This PR provides an improved implementation with:
Test Plan
is_valid_commit_hash()function🤖 Generated with Claude Code