Fix mutation diff source mismatch#75
Conversation
What's good
FindingsF1 (low) — Validation only covers the empty-diff path. F2 (suggestion) — Sanity check (looks fine) — VerdictCorrect fix, minimal blast radius, well-locked by the catalog test. I'd land it after a real-PR smoke run on the workflow itself; if that's already implicit in your merge process, this is good to approve as-is. |
Signed-off-by: lucarlig <luca.carlig@ibm.com>
427af75 to
4d26983
Compare
|
Addressed both points from Pratik's comment.
Also updated the PR body validation section with that evidence. |
msureshkumar88
left a comment
There was a problem hiding this comment.
Review
Clean fix for the mutation diff source mismatch.
What this does: Changes the git diff command from a range diff (BASE_SHA..HEAD_SHA) to a single-commit diff (BASE_SHA against the checked-out tree). This is the correct approach for cargo mutants --in-diff — on GitHub Actions, the checked-out tree already reflects the PR changes (via the merge commit), so HEAD_SHA is redundant and the range diff was comparing wrong refs.
Changes verified:
.github/workflows/:HEAD_SHAenv var removed, diff command simplified togit diff $BASE_SHA- Tests updated to assert new command shape and absence of
HEAD_SHA - DCO sign-off present on commit
- No version bumps needed (infra-only change)
Logic is sound. Test coverage accurate. No issues found.
Approved.
Summary
HEAD_SHAenvironment value from the mutation diff step.Root cause
cargo mutants --in-diffvalidates that the new side of the diff matches the source tree under test. In pull request CI,actions/checkoutmay test the merge ref, while the generated diff usedbase.sha..head.sha. That can make the diff's new-side context differ from the checked-out files and fail with exit code 5 before mutation testing starts.Validation
python3 -m unittest tests.test_plugin_catalog.PluginCatalogTests.test_ci_workflow_includes_parity_jobs_for_rust_plugin_checkspython3 -m unittest tests.test_plugin_catalogsecrets_detection/src/object_model.rs, generatedgit diff "${BASE_SHA}" -- '*.rs', then rancargo mutants -p secrets_detection --in-diff /tmp/cargo-mutants-real-diff.diff; result:Found 5 mutants to test, baseline passed,5 mutants tested in 27s: 1 caught, 4 unviable.Note: standard detailed code review workflow has not been run yet.