fix(ci-insights): Use base branch presence as PR indicator for mode selection#392
Conversation
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 ApprovalWonderful, this rule succeeded.
🟢 Continuous IntegrationWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 ReviewsWonderful, this rule succeeded.
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
0667906 to
aaa2d58
Compare
There was a problem hiding this comment.
Pull request overview
Fixes CI Insights “mode” selection so flaky detection uses new mode only in PR contexts and unhealthy mode for push/scheduled runs, avoiding incorrect new mode selection when only HEAD refs are available.
Changes:
- Update
MergifyCIInsightsto select flaky-detector mode based on presence of a PR base ref attribute. - Refactor
_load_flaky_detector()to accept an explicitmodeargument. - Adjust CI Insights tests to model PR vs push/scheduled environments using
GITHUB_BASE_REFandGITHUB_REF_NAME.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
pytest_mergify/ci_insights.py |
Passes an explicit flaky-detector mode chosen from resource attributes rather than relying on branch_name presence. |
tests/test_ci_insights.py |
Updates test env setup to simulate PR vs non-PR contexts via GitHub Actions ref env vars. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…election The mode selection between 'new' and 'unhealthy' was using branch_name presence, which derived from BASE with HEAD fallback. Since HEAD is almost always available (via GITHUB_REF_NAME), scheduled/push runs incorrectly selected 'new' mode. Fixes: MRGFY-6820 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Change-Id: I25975a8cfe61b7d51aa28ec9a5ade3701dcc8aac
aaa2d58 to
1c0965b
Compare
JulianMaurin
left a comment
There was a problem hiding this comment.
For push/schedule runs where GITHUB_BASE_REF="" is present in the environment, get_attributes will include VCS_REF_BASE_NAME="" in the resource. The branch_name derivation:
branch_name = resource.attributes.get(VCS_REF_BASE_NAME, resource.attributes.get(VCS_REF_HEAD_NAME))
would return "" instead of falling through to HEAD. This makes self.branch_name = "" (falsy), which means quarantine won't load for push runs even when a HEAD ref is available. This is out of scope for this PR
but worth a follow-up if quarantine is expected to work on push/schedule.
Nice catch! I'll push another fix. |
Merge Queue Status
This pull request spent 24 seconds in the queue, including 1 second running CI. Required conditions to merge
|
The mode selection between 'new' and 'unhealthy' was using branch_name
presence, which derived from BASE with HEAD fallback. Since HEAD is
almost always available (via GITHUB_REF_NAME), scheduled/push runs
incorrectly selected 'new' mode.
Fixes: MRGFY-6820
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com