Repository navigation
ci(mutation): mutmut pilot over the stats, gates and cache key #178
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
Open
napetrov
wants to merge
12
commits into
intel:main
Choose a base branch
from
napetrov:ci/mutation-pilot
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
432f037
ci(mutation): mutmut pilot over the stats, gates and cache key
napetrov d57ed0e
docs: name the gates the mutation pilot covers in CONTRIBUTING
antonwolfy c5c6715
ci(mutation): lock mutmut apart from the tools lock; time out the run…
napetrov e54316b
test(mutation): pin the regression defaults, score flags, both-arms f…
napetrov c6f1bfe
ci(pip-audit): audit requirements-mutation.lock.txt with the other locks
napetrov 91d9ae6
Merge remote-tracking branch 'intel/main' into ci/mutation-pilot
napetrov b5785d6
docs(security): name requirements-mutation.lock.txt in the audited locks
antonwolfy 60a99b6
test(locks): check the pip-audit command, not the workflow text
xaleryb 55b32d8
test(stats): pin bootstrap_ci's default seed and resample count
xaleryb 60eb92b
Merge intel/main into ci/mutation-pilot
napetrov 705e015
test(stats, gates): kill the surviving tail-index, seed, flag and ren…
napetrov d27b2e3
ci(mutation): flag a partial run in the step summary
napetrov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Copyright (C) 2026 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| name: mutation | ||
|
|
||
| # Mutation pilot: mutmut over the measurement core (the statistics, the gate | ||
| # decisions and the response-cache key; [tool.mutmut] in dokimi/pyproject.toml | ||
| # lists the modules and the tests run against them). A surviving mutant is a | ||
| # change to that code no test notices, so a wrong number would ship silently. | ||
| # Informational: the job reports the score per module and the survivors in the | ||
| # step summary and never fails on them. Weekly and on demand, not per PR: a full | ||
| # run takes tens of minutes. Diff-only runs on PRs are a follow-up. | ||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: '17 5 * * 1' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: dokimi | ||
|
|
||
| jobs: | ||
| mutmut: | ||
| name: mutmut (pilot modules) | ||
| runs-on: ${{ github.repository_owner == 'intel' && 'intel-ubuntu-latest' || 'ubuntu-latest' }} | ||
| timeout-minutes: 90 | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | ||
| with: | ||
| python-version: '3.13' | ||
| # The runtime lock for the tests, and mutmut's own lock (requirements-mutation.txt), | ||
| # which no other workflow installs. | ||
| - name: Install deps | ||
| run: pip install --require-hashes -r requirements.lock.txt -r requirements-mutation.lock.txt | ||
| - name: Run mutmut | ||
| # A crash of the run is reported below, not failed on. The step's own timeout | ||
| # sits inside the job's 90 minutes: a run that outlives the step is cancelled | ||
| # as a failed step, which continue-on-error absorbs, and the summary step | ||
| # still gets its time. A job-level timeout would fail the whole job instead. | ||
| timeout-minutes: 75 | ||
| continue-on-error: true | ||
| run: mutmut run --max-children "$(nproc)" | ||
| - name: Score and survivors | ||
| if: always() | ||
| run: | | ||
| mutmut results --all true > mutmut-results.txt || true | ||
| python - <<'EOF' >> "$GITHUB_STEP_SUMMARY" | ||
| import collections | ||
|
|
||
| counts = collections.defaultdict(collections.Counter) | ||
| survivors = collections.defaultdict(list) | ||
| with open("mutmut-results.txt", encoding="utf-8") as fh: | ||
| for line in fh: | ||
| name, sep, status = line.strip().rpartition(": ") | ||
| if not sep: | ||
| continue | ||
| # <module>.x_<function>__mutmut_<n>, or x<sep><class><sep><method> | ||
| module = name.rsplit(".", 1)[0] | ||
| counts[module][status] += 1 | ||
| if status == "survived": | ||
| survivors[module].append(name) | ||
|
|
||
| print("## Mutation pilot\n") | ||
| if not counts: | ||
| print("No results: see the `Run mutmut` step log.") | ||
| else: | ||
| print("| Module | Killed | Survived | Other | Score |") | ||
| print("|---|---:|---:|---:|---:|") | ||
| for module in sorted(counts): | ||
| c = counts[module] | ||
| killed, survived = c["killed"], c["survived"] | ||
| other = sum(c.values()) - killed - survived | ||
| scored = killed + survived | ||
| score = f"{100 * killed / scored:.1f}%" if scored else "n/a" | ||
| print(f"| `{module}` | {killed} | {survived} | {other} | {score} |") | ||
| unchecked = sum(c["not checked"] for c in counts.values()) | ||
| unscored = sorted(m for m, c in counts.items() if not c["killed"] + c["survived"]) | ||
| if unchecked or unscored: | ||
| print(f"\n> **Incomplete run: do not read the scores as final.** {unchecked} mutants were " | ||
| "not checked (a step timeout or a crash cut the run short)" | ||
| + (f"; nothing was scored in {', '.join(f'`{m}`' for m in unscored)}" if unscored else "") | ||
| + ". See the `Run mutmut` step log.") | ||
| print("\nOther: no tests, timeout, suspicious or not checked.") | ||
| print("`mutmut show <name>` prints a mutant's diff.\n") | ||
| for module in sorted(survivors): | ||
| print(f"<details><summary>{module}: {len(survivors[module])} survivors</summary>\n") | ||
| print("```") | ||
| print("\n".join(survivors[module])) | ||
| print("```\n</details>\n") | ||
| EOF | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
dokimi/changelog.d/20261021_160000_napetrov_mutation-pilot.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| ### Added | ||
|
|
||
| - **Mutation pilot over the measurement core** — `.github/workflows/mutation.yml` | ||
| runs mutmut 3.8.0 (hash-pinned in its own `requirements-mutation.lock.txt`, installed by that workflow alone) weekly and on demand over | ||
| `eval/stats.py`, `eval/binary_stats.py`, the score, regression, critical-band and | ||
| trust gates and `caching.py`, and writes the score per module and the surviving | ||
| mutants to the job summary. It never fails a build. New tests kill the survivors | ||
| that were real gaps (inclusive thresholds, the Wilcoxon veto, per-condition metric | ||
| keys, the bootstrap tail index, the cache key's role and sampling parameters), which | ||
| takes the pilot from 75.3% to 92.0% of mutants killed. Configuration: | ||
| `[tool.mutmut]` in `pyproject.toml`; usage: CONTRIBUTING.md. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.