Repository navigation
ci: adopt Gremlins mutation testing (advisory) - #291
Conversation
Add pinned Gremlins targets, advisory pull-request and scheduled mutation jobs, and the recorded baseline guidance. The full suite runs Sundays at 02:00 Costa Rica with five hours of runner time.
david-santacruz-backblaze
left a comment
There was a problem hiding this comment.
Mate, let's check this before merging.
.github/workflows/mutation.yml: thechanged-codejob should haveif: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.user.login != 'dependabot[bot]' }}. It has apull_requesttrigger, and #97 R8 asks for the guard. It could be combined with the existingifusing&&..gremlins.yaml: it should probably haveexclude-files(#97 R6), or the PR should say why it isn't needed because only./b2and./baseare mutated.changed-code: it should write killed/lived/not-covered counts to the job summary and uploadmutation-*.jsonlikefull-suitedoes (#97 R5).docs/testing.md: it should include the Gremlins vs go-mutesting vs Ooze comparison, why Gremlins was chosen, and how to accept or suppress a surviving mutant (#97 R7).
Note: let's not forget to update the PR description once these land, so it matches the final diff.
david-santacruz-backblaze
left a comment
There was a problem hiding this comment.
Requesting changes. Reviewed together with #293, which depends on this PR. I read the diffs and did not run Gremlins or make ci.
Blocking
- Does not close #97. Change "Closes #97" to "Part of #97". Missing against the issue:
- the Dependabot guard (
github.actor != 'dependabot[bot]') on every job in apull_requestworkflow, aschangelog.ymlandrequire-area-approvals.ymlhave; - a job summary with killed/lived/not-covered counts and a downloadable list of survivors (today it is
tail -n 40of the log, andchanged-codeuploads no artifact); - exclusion of generated and non-library code;
- docs for the tool choice, how to suppress or accept a survivor, and thresholds near the baseline (both are 0 here).
- the Dependabot guard (
timeout-coefficientandworkersare repeated as CLI flags in the Makefile (2x) and the workflow (2x), and.gremlins.yamlsets them too. CLI flags override the YAML, so #293's coefficient of 40 would have no effect on CI. Keep the values only in.gremlins.yaml.--diffmode is unproven. #293'sdocs/mutation-testing.mdsays Gremlins v0.6.0 builds package-relative paths that do not match Git'sb2/...paths, and that grouped hunks can omit later changed lines. If that is right,changed-codemutates little or nothing and still shows green. Please show it mutating a known changed line, or document the limitation.- Baseline is not reproducible on main. It is measured at coefficient 20, which gives 17 timeouts. Settle on one coefficient (#293 uses 40) and re-measure once.
Should fix
- Add the
make citail to the PR (AGENTS.md "Verifying your work"), and say why no changelog fragment is needed. - Have the workflow call
make mutation/make mutation-diffinstead of repeating the package loop and install step.MUTATION_PACKAGESexists but the workflow hardcodesb2 base. continue-on-erroris on both the job and the step, which is redundant and hides failures. Drop one and surface the result in the summary.- Remove the unused
GREMLINS ?=override and the comment-onlyGREMLINS_VERSION, or use it in an install target. - Use one term:
mutant-coveragein the YAML vs "Mutator coverage" in the docs. docs/README.mddoes not mention the new section.
Merge order: this PR first, then #293 rebased onto it (both add .gremlins.yaml, and a trial merge conflicts).
Guard PR mutation runs against Dependabot and upload their reports. Explain the package scope and document tool selection and survivor triage. Part of #97
|
Thanks for the review. All four are addressed in
The PR description is updated to match the final diff. The broader #97 follow-ups (CLI/config tuning consolidation, the v0.6.0 diff-filter limitation, a timeout-free baseline) remain listed there as open, out of scope for this revision. |
Context
Adopt Gremlins as an advisory signal for test integrity in
b2andbase, without adding library dependencies. This revision addresses the four requested workflow and documentation items from David's review. It does not complete every evaluation task in #97.Changes
go.modandgo.sumunchanged.-raceduring mutation runs.changed-codeagainst both a Dependabot actor and a Dependabot PR author.full-suiteexplicitly excludes pull requests and runs only on the weekly schedule or manual dispatch.mutation-*.jsonandmutation.logfrom both jobs, always, with missing-file warnings and 30-day retention. Both jobs also write log summaries../b2and./baseare mutation targets; neither contains generated non-test files.internal/b2assets,examplesandbinare outside that scope, and Gremlins skips_test.go, so no unusedexclude-filesentry was added.make mutationandmake mutation-diff, with one package per Gremlins invocation.The previously measured baseline at
c3b00f1, with coefficient 20 and two workers, is retained. This review revision did not rerun a full mutation pass:baseb2Survivor triage is tracked in #290. David's broader follow-up requests, including consolidating CLI/config tuning, validating the known v0.6.0 diff-filter limitations and settling a timeout-free baseline, remain open; this revision is limited to the four requested review items.
Verification
actionlintv1.7.7: exit 0, no findings.zizmor: exit 0, no findings under the repository's existing configuration (offline mode, one suppressed audit).Gremlins v0.6.0 dry-run discovery, with all four B2 credential variables unset:
Both supported single-package invocations exited 0 and listed individual runnable mutants. These are discovery results, not a new efficacy measurement.
git diff origin/main -- go.mod go.sum: empty.gofmt -l .: no output.go vet ./...: clean as part ofmake ci.make ci: exit 0 with all four B2 credential variables unset. Build, vet, formatting, module hygiene, lint, race tests, b2keys, cross-compilation, changelog check and script tests passed. Tail:CI/tooling and docs only, with no user-visible library behavior change:
skip-changelog, no fragment. Live B2 and simulator checks were not run because no B2 request behavior changes. A human code owner must review the workflow changes.Part of #97