Skip to content

[Fix] Mutation scope changes when main advances - #1655

Merged
edelauna merged 1 commit into
mainfrom
fix/mutation-diff-merge-base-0i9xkg3qnqf1s
Sep 17, 2026
Merged

edelauna merged 1 commit into
mainfrom
fix/mutation-diff-merge-base-0i9xkg3qnqf1s

Conversation

@zoomote

@zoomote zoomote Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

​Created by Roomote. Follow up by mentioning @roomote, in the web UI, or in Discord.

What changed

The mutation-diff workflow now compares a pull request's synthetic merge result with that merge commit's first parent, the exact main snapshot GitHub used to create it. A regression test models a stale pull-request base followed by an unrelated executable change on main and verifies only the pull-request file is selected.

Why this change was made

PR #1505 changed from 499 to 624 reported executable lines after main advanced even though its latest source commit added only 6 executable lines. The stale event base caused 119 executable lines from the already-merged coverage cache verifier to be charged to the PR.

Impact

Mutation scope remains stable when main advances and still uses merge-result line coordinates. The 500-line limit is unchanged: #1505's corrected scope is 505 executable lines, so it remains legitimately blocked by 5 lines rather than the erroneous 124-line overage.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: a9eb8cb0-35cb-465c-a34e-818734e9b994

📥 Commits

Reviewing files that changed from the base of the PR and between 9973630 and b7177b2.

📒 Files selected for processing (2)
  • .github/workflows/mutation-testing.yml
  • scripts/stryker-diff.test.mjs

Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: platform-unit-test (windows-latest)
  • GitHub Check: e2e-mock
🧰 Additional context used
📓 Path-based instructions (3)
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths.

⚙️ CodeRabbit configuration file

Files:

  • scripts/stryker-diff.test.mjs
Require full commit SHA pins, least-privilege permissions, safe expression and shell interpolation, and trusted metadata handling.

⚙️ CodeRabbit configuration file

Files:

  • .github/workflows/mutation-testing.yml
Act as an adversarial second-opinion reviewer.

⚙️ CodeRabbit configuration file

Files:

  • scripts/stryker-diff.test.mjs
🔇 Additional comments (2)
.github/workflows/mutation-testing.yml (1)

53-55: LGTM!

scripts/stryker-diff.test.mjs (1)

60-61: LGTM!

Also applies to: 450-491


📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Mutation testing now compares changes against the pull request’s actual base parent, improving accuracy when the target branch has advanced.
    • Prevented unrelated target-branch changes from being included in pull request mutation testing.
  • Tests

    • Added coverage to verify correct base commit selection and change isolation.

Walkthrough

The mutation-testing workflow now derives BASE_SHA from the first parent of HEAD_SHA. Tests verify this workflow configuration and confirm that stale base references do not include unrelated base-branch changes.

Changes

Mutation testing base selection

Layer / File(s) Summary
Derive the base commit from HEAD_SHA
.github/workflows/mutation-testing.yml
The workflow removes the remote base-fetch step and computes BASE_SHA with git rev-parse "$HEAD_SHA^1".
Validate stale base behavior
scripts/stryker-diff.test.mjs
Tests require first-parent base resolution and verify that selecting from the merge result's first parent reports only the pull request change.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: edelauna

Merge Risk: ⚪ Minimal · up to b7177

The mutation scope now compares the merge result against its actual base snapshot, preventing unrelated main-branch changes from being included. No merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 7 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains what changed, why it changed, and the expected impact, but it omits the required Related GitHub Issue, Test Procedure, Pre-Submission Checklist, Documentation Updates, and Add… Use the repository template. Add an approved issue reference, explicit test steps and environment details, complete the pre-submission checklist, state whether documentation updates are required, and include any relevant additional notes.
✅ Passed checks (7 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Regression Evidence ✅ Passed The changed mutation-scope behavior has focused coverage. The regression test builds a synthetic merge history with an advanced base branch, verifies the stale base selects both files, and verifies th…
Security Boundaries ✅ Passed No changed path meets the stated security failure conditions. The workflow change only derives BASE_SHA from the platform-provided github.sha in HEAD_SHA using quoted shell parameters (`.github/…
Persistence Integrity ✅ Passed No changed persistence path exists. The workflow change only derives BASE_SHA with git rev-parse and passes it to selectFromGit; selectFromGit reads files and runs Git diffs without writing ap…
Lifecycle Resource Cleanup ✅ Passed PASS: The changed workflow path only computes BASE_SHA with git rev-parse and invokes the existing mutation command. It does not add a listener, watcher, timer, provider, or long-lived task. The a…
Title check ✅ Passed The title clearly identifies the main change: fixing mutation scope when the main branch advances.
Full details: Description check

Explanation

The description explains what changed, why it changed, and the expected impact, but it omits the required Related GitHub Issue, Test Procedure, Pre-Submission Checklist, Documentation Updates, and Additional Notes sections.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/mutation-diff-merge-base-0i9xkg3qnqf1s

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review status

This PR was opened by an automated account. A human maintainer must verify the change intent, provenance, and validation before merging.

Current step: The required review sequence passed. Remaining merge requirements apply.

Review-state labels are managed by this workflow; do not edit them manually.

@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot added the awaiting-ready CodeRabbit approved; waiting for the draft to be marked ready label Sep 16, 2026
@edelauna
edelauna marked this pull request as ready for review September 16, 2026 03:43
@github-actions github-actions Bot removed the awaiting-ready CodeRabbit approved; waiting for the draft to be marked ready label Sep 16, 2026
@edelauna
edelauna added this pull request to the merge queue Sep 17, 2026
Merged via the queue into main with commit 10b45ab Sep 17, 2026
29 checks passed
@edelauna
edelauna deleted the fix/mutation-diff-merge-base-0i9xkg3qnqf1s branch September 17, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants