mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 11:18:48 +00:00
Two-sided ratchets with zero slack made parallel tasks conflict on shared numbers, recompute them after every rebase and hit a ceiling because a neighbour merged first (#689 after #691). - Core lines (test/core-file-budget.test.mjs): a branch may grow up to CORE_BAND = 50 lines over the beta ceiling; shrinking no longer fails it. - Bundle graphs (bundle-budget.mjs): initial View and lazy graphs fail only above ceiling + 2 000 B; below the ceiling is not a branch finding. The absolute INITIAL_VIEW_GZIP_BUDGET stays the wall. - Monolith numbers (monolith-metrics.mjs, unused-locals-gate.mjs): METRIC_BANDS — 5 for delegates, port members and privates, 25 for host. refs, 2 000 B for dist/; a lower number is reported, not failed. - Browser mutation guards: 200 is a guideline — mutation-gate --check warns above it instead of failing; every guard still needs its reason line. - scripts/ratchets.mjs: `report [--warn]` and `tighten` — on the beta candidate the release manager sets every ceiling to the fact in one commit; release:prerelease prints loose ceilings as a warning. Canon: PROCESS.md §3 (browser guards, monolith numbers) and §8 «Храповики»; docs/TESTING.md. Issue: #699 User-Visible: no Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018qZfe7YS4rqEMKoVeS3GKd
38 lines
1.8 KiB
JavaScript
38 lines
1.8 KiB
JavaScript
// Browser mutation witnesses are the expensive part of the registry. This
|
|
// module keeps the cap and the reviewed inventory independent from the CLI so
|
|
// inventory, --check and unit tests ask the same question (#659).
|
|
import { readFileSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
|
|
/**
|
|
* Ориентир, а не стена (#699, решение владельца 2026-09-28). Прежний жёсткий
|
|
* лимит заставлял новую задачу удалять чужой браузерный мутант или уводить свой
|
|
* свидетель в Node только ради числа (#687, #689). Каждый browser guard и так
|
|
* обязан иметь строку обоснования в реестре; сверх ориентира `--check`
|
|
* предупреждает, а не краснеет.
|
|
*/
|
|
export const BROWSER_GUARD_LIMIT = 200;
|
|
export const BROWSER_GUARD_INVENTORY = 'docs/testing-notes/mutation-browser-guards.md';
|
|
|
|
export const isBrowserGuard = (guard) => guard.includes('demo/') || guard.includes('bundle:sync');
|
|
|
|
export function documentedBrowserGuards(markdown) {
|
|
return new Set([...markdown.matchAll(/^- `([^`]+)`$/gm)].map((match) => match[1]));
|
|
}
|
|
|
|
export function readDocumentedBrowserGuards(root = process.cwd()) {
|
|
return documentedBrowserGuards(readFileSync(join(root, BROWSER_GUARD_INVENTORY), 'utf8'));
|
|
}
|
|
|
|
export function browserGuardPolicy(mutants, documented) {
|
|
const browser = mutants.filter((mutant) => isBrowserGuard(mutant.guard));
|
|
const current = new Set(browser.map((mutant) => mutant.id));
|
|
return {
|
|
browser,
|
|
count: browser.length,
|
|
overLimit: browser.length > BROWSER_GUARD_LIMIT,
|
|
missingReasons: browser.filter((mutant) => !documented.has(mutant.id)),
|
|
staleReasons: [...documented].filter((id) => !current.has(id)),
|
|
};
|
|
}
|