mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
423927fdd8
* chore(mutation): shrink the lane to report-only (#1457, #1781 wave 2) The mutation harness's two real catches (#1474, #1475) both came from humans reading the weekly score report. The ratchet half never operated: the baseline was committed exactly twice (8cce0ef6b,60400d04b), both times with `stableRuns: 0, gating: false`, and was never updated after the very fixes it triggered — the weekly job computed a new baseline and then `git checkout --`d it, uploading a proposal nobody applied in 3+ weeks. A gate nobody arms is harness weight; the report is the part that paid. Deletes ratchet.ts + ratchet.test.ts, mutation-baselines/, and every baseline/graduation/gating path in run.ts (`--update`, `mutation:baseline`). run.ts now exits non-zero only on a harness failure, never on a score. The report renders the per-kernel table (kernel, score, killed, survived, total, timeouts) plus the surviving mutants a strengthening PR works from. Kernel scoping stays: stryker.config.json and KERNEL_MODULES are untouched. * fix(mutation): restore denominator coverage and publish the table before judging the shard set Review of #1828: - `report.test.ts` re-asserts that Ignored/CompileError/RuntimeError leave the denominator — the one behaviour `ratchet.test.ts` covered and nothing replaced. A `tally()` edit that counted tool noise would have deflated every published score with a green `mutation:test`. - `assertShardsCoverModules` now runs after `emit()`, so an incomplete shard set still publishes the kernels that completed instead of only an error string. This makes the workflow comments' claim about the job summary true rather than re-wording them down. * chore(mutation): trigger the affected lane on exactly the paths that can select mutants The PR lane returns an empty matrix unless the diff touches the harness, so the kernel-source and `**/*.test.ts` triggers only bought a 1-4 min no-op job on ~96% of PRs. `on.pull_request.paths` is now exactly `LANE_TOOLING` plus the workflow file, asserted in both directions by workflow.test.ts against the exported constant — a missing path would let a harness change merge unproven, an extra one starts a job that can only answer `[]`. Also drops the workflow header's contradictory scope paragraph: it claimed the lane selects on kernel sources and any test reaching one, which has not been true since the ratchet went. * fix(mutation): score and publish a short shard set before failing on the count The expected-count check ran inside readShardedReports, before anything was summarized, so on the weekly's real `--expect-shards 10` one dead shard threw away the nine that had reported — the earlier reorder only moved the zero-mutants check. The merge now returns the shard count, and both verdicts run after emit() with the same exit code and `score` stage. Regression uses the weekly argument shape (`--expect-shards 10`, one shard present) and asserts the reporting kernel's row reaches stdout while the run still fails.
167 lines
6.4 KiB
YAML
167 lines
6.4 KiB
YAML
name: Mutation Weekly
|
|
|
|
# Weekly mutation sweep over the enumerated decision kernels (issue #1415).
|
|
# Mutation score is the mechanical answer to "is this test load-bearing or
|
|
# decorative"; a full-suite sweep is unaffordable, so the scope is the kernel
|
|
# registry in scripts/mutation/modules.ts and nothing else.
|
|
#
|
|
# Sharded one job per module: the whole sweep is ~2,150 mutants, and the selector
|
|
# module alone is ~1,280 of them, so a single job would sit near the 30-minute
|
|
# acceptance budget on an ubuntu runner. The shards' JSON reports are merged into
|
|
# one score table by the report job (`--report-dir`).
|
|
#
|
|
# The lane reports and never gates (#1457): the per-kernel table lands in the job
|
|
# summary and the artifact, and a low score is an input for a human-authored
|
|
# test-strengthening PR (#1474, #1475 were written that way).
|
|
|
|
on:
|
|
schedule:
|
|
# Sundays 05:00 UTC — after the nightly lanes, before the working week.
|
|
- cron: '0 5 * * 0'
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ci-${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
shard:
|
|
name: Mutants (${{ matrix.name }})
|
|
runs-on: ubuntu-latest
|
|
# The acceptance budget is 30 minutes of wall clock for the lane, and shards
|
|
# run in parallel, so the budget is per shard. The observed rate on a 2-core
|
|
# runner is ~3s/mutant, which is why selectors (~1,280 mutants) is sliced.
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
# Kept in step with KERNEL_MODULES by the shard-coverage assertion in
|
|
# scripts/mutation/workflow.test.ts, which also pins --expect-shards to
|
|
# the number of entries here.
|
|
include:
|
|
- { name: kernel-errors, module: kernel-errors }
|
|
- { name: daemon-ref-frame, module: daemon-ref-frame }
|
|
- { name: interaction-settle, module: interaction-settle }
|
|
- { name: scroll-edge-state, module: scroll-edge-state }
|
|
- { name: selectors-1, module: selectors, shard: 1/4 }
|
|
- { name: selectors-2, module: selectors, shard: 2/4 }
|
|
- { name: selectors-3, module: selectors, shard: 3/4 }
|
|
- { name: selectors-4, module: selectors, shard: 4/4 }
|
|
- { name: target-annotation-serde, module: target-annotation-serde }
|
|
- { name: snapshot-occlusion, module: snapshot-occlusion }
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Setup toolchain
|
|
uses: ./.github/actions/setup-node-pnpm
|
|
|
|
- name: Run mutants for ${{ matrix.name }}
|
|
uses: ./.github/actions/run-gate
|
|
with:
|
|
gate: mutation
|
|
args: |
|
|
--modules
|
|
${{ matrix.module }}
|
|
${{ matrix.shard && '--shard' || '' }}
|
|
${{ matrix.shard || '' }}
|
|
|
|
# A shard can die before Stryker writes anything (install, config, crash);
|
|
# without this the artifact is absent and "shard failed" is indistinguishable
|
|
# from "lane never ran". --fail-envelope leaves a real verdict untouched.
|
|
- name: Record a failed shard envelope
|
|
if: failure()
|
|
run: |
|
|
pnpm gate mutation --modules ${{ matrix.module }} --fail-envelope \
|
|
"shard ${{ matrix.name }} failed before producing a report (run ${{ github.run_id }})" || true
|
|
|
|
- name: Upload shard report
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: mutation-shard-${{ matrix.name }}
|
|
path: |
|
|
.tmp/mutation/mutation.json
|
|
.tmp/mutation/lane-envelope.json
|
|
if-no-files-found: warn
|
|
|
|
report:
|
|
name: Mutation score report
|
|
runs-on: ubuntu-latest
|
|
needs: shard
|
|
if: always()
|
|
timeout-minutes: 15
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Setup toolchain
|
|
uses: ./.github/actions/setup-node-pnpm
|
|
|
|
- name: Harness self-test
|
|
uses: ./.github/actions/run-gate
|
|
with: { gate: mutation-model }
|
|
|
|
- name: Download shard reports
|
|
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
|
with:
|
|
pattern: mutation-shard-*
|
|
path: .tmp/mutation/shards
|
|
|
|
# run.ts writes the per-kernel score table to $GITHUB_STEP_SUMMARY when the
|
|
# runner exports it, so the summary and the artifact carry the same numbers.
|
|
# It publishes the table before judging the shard set, so even the one
|
|
# failure it can raise — an incomplete shard set — still reports the kernels
|
|
# that completed. A red lane here always means the sweep did not happen,
|
|
# never a low score.
|
|
- name: Score the merged sweep
|
|
uses: ./.github/actions/run-gate
|
|
with:
|
|
gate: mutation-check
|
|
args: |
|
|
--report-dir
|
|
.tmp/mutation/shards
|
|
--expect-shards
|
|
10
|
|
|
|
# The self-test and the artifact download both run before the scoring step,
|
|
# so a failure there would otherwise leave the aggregate lane with no envelope.
|
|
- name: Record a failed lane envelope
|
|
if: failure()
|
|
run: |
|
|
pnpm gate mutation --fail-envelope \
|
|
"weekly report job failed before producing a score table (run ${{ github.run_id }})" || true
|
|
|
|
# Freshness/drift telemetry (#1430): the envelope states commit, Stryker
|
|
# version, config hash, duration and result, so a lane going dark or a tool
|
|
# bump is visible without reading these logs.
|
|
- name: Lane envelope
|
|
if: always()
|
|
run: |
|
|
if [ ! -f .tmp/mutation/lane-envelope.json ]; then
|
|
echo 'No lane envelope was written — the job died before it could run node.' \
|
|
>> "$GITHUB_STEP_SUMMARY"
|
|
exit 0
|
|
fi
|
|
{
|
|
echo '<details><summary>Lane envelope (schema #1430)</summary>'
|
|
echo
|
|
echo '```json'
|
|
cat .tmp/mutation/lane-envelope.json
|
|
echo '```'
|
|
echo '</details>'
|
|
} >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
- name: Upload mutation report
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: mutation-decision-kernels
|
|
path: |
|
|
.tmp/mutation/shards
|
|
.tmp/mutation/lane-envelope.json
|
|
if-no-files-found: warn
|