mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
perf: mutation-gate builds the bundle only for browser guards, compiles incrementally, shards and diffs (#332)
Four independent cuts into the 2-4 hour full run, none touching the contract "a mutant must turn its guard red": - guardNeedsBundle: rollup runs only for guards that open the built bundle (demo/ smokes, golden captures, bundle:sync) — 68 of 253 registry entries. Unit and backend guards never read dist/ as a build artifact (verified against every test that mentions dist/**: they read the git checkout or synthetic files), so 185 mutants skip the most expensive step entirely. - seedTestBuild + incremental tsc: the mutant worktree starts from the main tree's warm test-build/ and .tsbuildinfo; tsc compares file hashes, not mtimes, so the fresh checkout stays warm and only the mutated delta is recompiled. This also speeds up the long guards that run tsc themselves. - --changed[=range]: run only mutants whose patch files are touched by the diff (origin/dev..HEAD by default). An empty selection is an honest success with an explicit message — the full registry remains the pre-release contract, per the workflow comment. - --shard=i/n: deterministic interleaved slices; the workflow runs a 4-way matrix, and a warm test-build step feeds every shard. Interleaving spreads the expensive browser mutants across shards instead of clumping them. Measured per mutant on this machine: unit 12-13 s (was ~50-70 s), backend 6 s, browser 32 s (unchanged — the bundle is genuinely needed there). Full run estimate drops to ~70 sequential minutes, ~20 on four shards. Unit coverage: guard classification on real registry shapes, a floor on both classes so the split cannot silently collapse, changed-selection semantics, and shard completeness/disjointness with an anti-clumping bound. Issue: #332 User-Visible: no
This commit is contained in:
@@ -5,11 +5,17 @@ name: Мутационный гейт
|
||||
# оставшийся зелёным на сломанном коде, ничего не защищает — он лишь выглядит
|
||||
# защитой, и это хуже его отсутствия.
|
||||
#
|
||||
# Прогон дорогой: пересборка бандла на каждого мутанта. Поэтому он не входит в
|
||||
# Validate и не идёт на каждый push. Его место — перед стабильным релизом
|
||||
# (PROCESS.md §8) и раз в неделю по расписанию, чтобы дрейф тестов не копился
|
||||
# до релиза. Дешёвая половина — «якоря патчей живы, guard-файлы существуют» —
|
||||
# идёт с обычными юнитами: test/mutation-gate.test.mjs.
|
||||
# Прогон дорогой, поэтому он не входит в Validate и не идёт на каждый push.
|
||||
# Его место — перед стабильным релизом (PROCESS.md §8) и раз в неделю по
|
||||
# расписанию, чтобы дрейф тестов не копился до релиза. Дешёвая половина —
|
||||
# «якоря патчей живы, guard-файлы существуют» — идёт с обычными юнитами:
|
||||
# test/mutation-gate.test.mjs.
|
||||
#
|
||||
# #332: бандл собирается только мутантам с браузерным гвардом (guardNeedsBundle),
|
||||
# компиляция тестов в worktree стартует с тёплого test-build (инкрементальный
|
||||
# tsc), а реестр режется на четыре чересполосных шарда — полный прогон
|
||||
# укладывается в десятки минут вместо часов. Локальный дифф-режим:
|
||||
# node scripts/mutation-gate.mjs --changed origin/dev..HEAD
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -31,10 +37,14 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
mutants:
|
||||
name: "Мутанты: каждый обязан красить тесты"
|
||||
name: "Мутанты: каждый обязан красить тесты (шард ${{ matrix.shard }} из 4)"
|
||||
runs-on: ubuntu-latest
|
||||
# Все мутанты × (сборка + свой guard) — это десятки минут, и это нормально:
|
||||
# гейт предрелизный. Час — потолок против зависшего Chromium.
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard: [1, 2, 3, 4]
|
||||
# Шард ~64 мутантов × свой guard; бандл собирают только браузерные гварды.
|
||||
# Час — потолок против зависшего Chromium.
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
@@ -70,5 +80,8 @@ jobs:
|
||||
- name: Реестр применим к текущему коду
|
||||
run: node scripts/mutation-gate.mjs --check
|
||||
|
||||
- name: Тёплый test-build для инкрементальной компиляции мутантов
|
||||
run: npx tsc -p tsconfig.test.json && node scripts/fix-test-build.mjs
|
||||
|
||||
- name: Каждый тест ловит свою поломку
|
||||
run: node scripts/mutation-gate.mjs
|
||||
run: node scripts/mutation-gate.mjs --shard=${{ matrix.shard }}/4
|
||||
|
||||
Reference in New Issue
Block a user