refactor(#2724): delete the committed golden fixtures and size baselines (#2767)

* test(#2724): delete golden-install-parity fixtures, test, and generator

Removes the 19 committed path->hash manifests, the two per-file size
baselines, tests/golden-install-parity.test.cjs, and
scripts/gen-golden-install-parity-zcode.cjs. These were pure functions
of the source tree (ADR-2719); the differential attribution check
(tests/emitted-attribution.test.cjs + tests/emitted-provenance.test.cjs)
is now the sole gate for emitted-artifact propagation.

tests/fixtures/install-tree/*.json and tests/golden-install-tree.test.cjs
are unchanged (ADR-2719 section 7 exception).

Follow-up commits fix the resulting bookkeeping: scripts/ci-test-scope.cjs's
existence guard, .gitattributes, package.json scripts, the emitted-provenance
totality guard's IO, the differential check's baseline acquisition, CI
wiring to publish/restore the baseline artifact, and docs.

* refactor(#2724): make the differential attribution check self-sufficient

Three fixes required to delete the golden fixtures without breaking CI:

- scripts/ci-test-scope.cjs: remove tests/golden-install-parity.test.cjs
  from the three rules that named it. #2759's missingRuleTestFiles guard
  hard-throws at module load if a rule names a test file absent from
  disk, which would break the changes job on every PR the moment the
  fixture-deletion commit landed.

- tests/helpers/emitted-provenance.cjs: loadManifests() read the
  committed golden fixture directory. With that directory deleted at
  every future ref, this would throw at module load forever, taking
  the Phase 2 totality guard down with it. Rebuilt from real installer
  spawns (MANIFEST_FAMILIES + runMinimalInstall + buildParityManifest),
  the same shape emitted-runtime.cjs's currentManifests() already uses.

- tests/emitted-attribution.test.cjs / tests/helpers/emitted-runtime.cjs:
  the real-tree test's baseline acquisition swaps from
  baselineManifestsAtRef(base) (git show at a ref that no longer carries
  fixtures) to resolveBaseline()'s documented precedence: env, then the
  on-disk cache, then an in-job build. The build fallback
  (buildBaselineAtRef, new) checks out base into a throwaway git
  worktree and runs the new scripts/gen-emitted-baseline.cjs there --
  no npm ci needed, since bin/install.js and the test helper shells are
  Node-builtins-only. That script also publishes the baseline artifact
  from CI's push-to-next job (wired in a follow-up commit).

* refactor(#2724): retire the merge-driver bridge and per-file size baselines

The Phase 1 bridge (#2721) is retired now that the artifacts it guarded
are deleted: scripts/git-merge-regen-driver.cjs, its test, and the
'setup:merge-driver' npm script are removed, and the .gitattributes
merge=gsd-regen/linguist-generated block for the three deleted-path
globs is dropped. tests/fixtures/install-tree/*.json keeps its normal
merge behavior, unchanged (ADR-2719 section 7).

scripts/update-size-baseline.cjs and its test are removed: their sole
purpose was regenerating tests/workflow-size-baseline.json and
tests/agent-size-baseline.json, both deleted. The 'size:baseline' npm
script and its step in 'regen:derived' go with it. The per-file
baseline describe blocks in tests/workflow-size-budget.test.cjs and
tests/agent-size-budget.test.cjs are removed for the same reason; the
independent loose-tier hard caps are untouched. The differential
attribution check's size ratchet (tests/emitted-diff.cjs, already
shipped in #2723) is the replacement anti-creep mechanism.

'npm run gen:golden' is replaced by 'npm run gen:install-tree', which
keeps regenerating tests/fixtures/install-tree/*.json (the one artifact
family ADR-2719 section 7 keeps committed); tests/golden-install-tree.test.cjs's
error messages point at the new command name.

tests/golden-parity-single-source.test.cjs's anti-divergence guard
(#2266) is retargeted from the two deleted golden-parity consumers to
their two replacements (tests/helpers/emitted-runtime.cjs and
tests/helpers/emitted-provenance.cjs), which import buildParityManifest
the same way — the divergence risk the guard exists for is unchanged.

Also wires CI: a new publish-emitted-baseline job runs
scripts/gen-emitted-baseline.cjs after a push to next and caches the
result keyed on the sha; the test and test-full jobs restore that cache
on pull_request events, keyed on the PR's base sha, and export
GSD_EMITTED_BASELINE for tests/emitted-attribution.test.cjs's real-tree
test to pick up.

* docs(#2724): flip ADR-2719 to Accepted and update contributor docs

Status: Proposed -> Accepted. Regenerated docs/adr/README.md index.

CONTRIBUTING.md, docs/TESTING-SUITES.md, and CONTEXT.md (RULESET.
EMITTED_ATTRIBUTION, RULESET.WORKFLOW_SIZE_BUDGET, RULESET.
AGENT_SIZE_BUDGET, and the Emitted Artifact Provenance glossary entry)
no longer point at the deleted golden-install-parity fixtures, size
baselines, gen:golden, UPDATE_GOLDEN, or the setup:merge-driver /
git-merge-regen-driver.cjs bridge. Editing shipped content now
requires zero manual fixture regeneration, documented against the
differential attribution check instead of the deleted commands.

* docs(#2724): add changeset for removed golden-parity commands

* fix(#2724): drop stale scripts/update-size-baseline.cjs glossary ref

check-glossary-refs.cjs verifies every backtick-wrapped scripts/*.cjs
token in CONTEXT.md resolves to a real file. The RULESET.
EMITTED_ATTRIBUTION rewrite named the deleted script inside backticks,
which the checker reads as a live reference, not historical prose.

* test(#2724): retarget ci-test-scope tests off the deleted golden test

tests/ci-test-scope.test.cjs asserted specific RULES entries select
tests/golden-install-parity.test.cjs, and that every rule selecting it
also selects both emitted gates. Both premises broke when the golden
test was deleted (#2724): the deleted filename never re-appears in
targeted_tests, and there was no longer a third file for the gates to
travel alongside. Retargeted the two selection describe blocks to
assert tests/emitted-provenance.test.cjs directly (the drift guard the
golden gate's rules were retargeted to), and simplified the third block
to assert the two emitted gates always travel together, without
reference to the golden filename.

* docs(#2724): repoint two contributor how-to guides at the differential check

Both guides told contributors to regenerate a baseline against
tests/golden-install-parity.test.cjs, which #2724 deletes. Repointed
at the differential attribution check (tests/emitted-attribution.test.cjs,
ADR-2719), which needs no manual regeneration step.

* fix(#2724): repair phase6-capstone-conformance's deleted-baseline read

An independent orthogonal review caught a real regression this branch
introduced into a test file the branch's diff never touched:
tests/phase6-capstone-conformance.test.cjs read
tests/workflow-size-baseline.json (deleted earlier in this branch) with
no fallback, so the whole suite would throw ENOENT the moment this
branch landed. The test's actual intent — prove the host-loop workflow
files are real, tracked, non-empty docs — is preserved by asserting the
live byte count via the same shared counter (scripts/workflow-size.cjs)
the size guards already use, instead of a committed snapshot.

Also, from the same review: a stale doc comment in
scripts/workflow-size.cjs still named the deleted
scripts/update-size-baseline.cjs as a consumer, and
buildBaselineAtRef's cleanup in tests/helpers/emitted-runtime.cjs left
two fs.rmSync calls unguarded against masking the primary result/error,
inconsistent with the try/catch already wrapping the git cleanup beside
them. Both fixed. A doc comment was added to baselineFamilyNamesAtRef
explaining why it (and its siblings) are kept despite having no
production caller post-cutover — they still answer real questions
about refs that predate the cutover.

* fix(#2724): repair three real regressions found by remote verification

1. tests/emitted-provenance.test.cjs's two hostile-input tests
   (non-object manifest, unreadable fixture) drove loadManifests(tmp)
   and monkeypatched fs.readFileSync, both premised on the deleted
   fixture-directory read this branch already replaced with real
   installer spawns -- the negative assertions silently stopped firing.
   loadManifests() now accepts injected {families, install, build,
   clean} (defaulting to production values), giving the tests a real
   seam to drive a bad build result and a build failure through the
   ACTUAL loader instead of a reimplementation, and added coverage that
   clean() still runs on both paths.

2. .github/workflows/test.yml's two 'Export GSD_EMITTED_BASELINE'
   steps hardcoded shell: bash, which is wrong on windows-latest (native
   pwsh) and on test-full's macos-latest legs (native zsh per that job's
   own matrix) -- the repo's H1 shell policy (tests/policy-shell-pinning
   .test.cjs) caught it. Replaced the inline bash script with
   scripts/ci-export-emitted-baseline-env.cjs, a plain Node script: a
   bare 'node <path>' command line has no shell-specific syntax, so it
   runs correctly under bash, zsh, and pwsh without a shell override.

tests/phase6-capstone-conformance.test.cjs's deleted-baseline read
(caught by the same remote run, at a commit prior to this one) was
already fixed in d0c3b1242 and is not touched here; verified still
passing after these changes.

* fix(#2724): revive ADR-1610's new-file size cap inside the differential

An isolated review caught a real regression: deleting
tests/workflow-size-baseline.json silently dropped NEW_FILE_CAP
(ADR-1610 Decision point 3, the Codex project_doc_max_bytes anchor)
with no successor. tests/helpers/emitted-diff.cjs's size ratchet
already 'continue's past any file absent from sizeBaseline -- exactly
the files this cap exists to bound -- so a brand-new workflow file
sized 32,769-40,960 bytes passed CI clean and shipped, then risked
silent truncation at the Codex anchor at runtime. ADR-1610 is Accepted
and never referenced anywhere in this branch.

Fix: NEW_FILE_CAP=32768 revived inside emitted-diff.cjs's own
size-ratchet loop, keyed off the SAME hasOwnProperty(sizeBaseline,
name) signal the growth check already computes -- 'new' is exactly
'present in sizeCurrent, absent from sizeBaseline'. Not ack-able,
matching the tier hard caps it sits beside: the fix is extraction, not
an acknowledgment entry. Documented, disclosed narrowing: the pure
differential module cannot see XL_WORKFLOWS/LARGE_WORKFLOWS tiering
(tests/workflow-size-budget.test.cjs's classification), so a
legitimately large new file must extract rather than tier in, one
release earlier than an existing file would need to. ADR-1610 itself is
left unamended -- this restores its decision rather than re-litigating
it.

Also fixes a stale comment plus a redundant real 19-installer-spawn
assertion left over from the pre-injection-seam version of
tests/emitted-provenance.test.cjs's build-failure test, and annotates
3 of 4 stale golden-fixture citations in
docs/reference/host-integration-capability-matrix.md as superseded
(the 4th is an accurate historical PR narrative, left alone).

* fix(#2724): repair three red CI defects on the golden-fixture cutover

Windows-only provenance false attribution (defect A): the `hooks-built`
provenance rule attributed `hooks/<name>.cmd` to itself. Those shims are
Windows-only installer output (ensureCodexHooksJsonSessionStart /
ensureCodexHooksJsonEvent, both in src/runtime-hooks-surface.cts) wrapping
the same-named `.js` hook — no `.cmd` file is ever tracked in the repo, so
the self-attribution resolved to a path that exists on no platform. Only
windows-latest ever emits the key, so this only failed there. Fixed by
special-casing `.cmd` inside the SAME `hooks-built` rule (not a dedicated
rule) — a dedicated rule would match zero paths, and therefore report as a
dead rule, on every non-Windows lane of the same totality guard. `sources`
already supported per-match functions; `transforms` is extended to support
the same shape so the attribution can vary by match within one rule.

Baseline bootstrap was structurally impossible (defect B): `buildBaselineAtRef`
ran `scripts/gen-emitted-baseline.cjs` from INSIDE the base-ref worktree, but
that script is new in this PR and therefore absent at any base ref that
predates it — every call failed closed with "Cannot find module". Fixed by
running the PR checkout's own generator against the worktree via a new `--dir`
parameter, decoupling "which copy of the script runs" from "which tree it
measures" (`currentManifests`/`currentSizes` gained a `repoRoot` override,
threaded down to `runMinimalInstall`'s new `installScript` override). This is
not just a bootstrap fix: a differential needs ONE measurement schema applied
to both sides, or the two stop being comparable the moment that schema
evolves — running each side's own copy would silently reintroduce that risk.
Verified locally end-to-end against real origin/next: resolves a valid
{version, sha, manifests, sizes} artifact with the correct sha and no leaked
worktree.

Changeset placeholder (defect C): `pr: 0` -> `pr: 2767`, which is what let
docs-lint evaluate the fragment for the first time; it already passes
(docs/TESTING-SUITES.md and friends already document the removed scripts).

Also fixed while in this file: an eslint no-unused-vars warning surfaced by
the changed lint run (unused `cleanup` import in
tests/emitted-provenance.test.cjs).

Added regression coverage for both A and B: a cross-platform spot-check that
drives the real hooks-built rule against `.cmd` keys directly (not through a
real Windows install), and a real-tree test that drives buildBaselineAtRef
against a base ref verified (via git cat-file) to lack the generator, both
skipping honestly rather than false-passing when their precondition does not
hold.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W5kQs6ZufZDySC6zDJfYP6

* fix(#2724): repair false .cmd byte-provenance and a permanently-skipping regression test

Two isolated-review findings on PR #2767:

- `hooks-built`'s `.cmd` branch attributed the Windows shim's bytes to the
  wrapped `hooks/<name>.js` script, asserting a byte-provenance link that
  does not exist — traced against buildCodexHookWindowsShimIR
  (src/runtime-hooks-surface.cts), only the script's NAME (a literal in that
  same file) flows into the .cmd bytes, never its content. Point `sources`
  at HOOKS_WINDOWS_SHIM_SRC instead, matching the code-derived convention
  used elsewhere in the table. Since `sources` is checked before
  `transforms` in the differential, the wrong mapping silently excused any
  .cmd byte movement caused by editing the wrapped .js file.

- The `buildBaselineAtRef` regression test skipped unless a resolvable base
  ref still lacked scripts/gen-emitted-baseline.cjs — true only until this
  PR merges, after which every base ref carries the file and the test skips
  forever with zero ongoing coverage. Rebuilt hermetically: synthesize the
  missing-generator condition in-place via git plumbing (a throwaway commit,
  child of HEAD, with just that one file removed from a scratch index),
  never touching the real working tree, HEAD, or index, and never depending
  on ambient history or remotes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W5kQs6ZufZDySC6zDJfYP6

* fix(#2724): tolerate the remote runner's dubious-ownership git mount in the emitted baseline path

The runner container mounts the repo at a path owned by a different uid than
the process running the suite, so git's dubious-ownership protection refuses
every git operation there. GitHub Actions never hits this because
actions/checkout registers the workspace as safe automatically; this
runner's container does not.

buildBaselineAtRef is the production build-fallback the sole remaining
emitted gate depends on (resolveBaseline's in-job-build leg), not just a
test helper, so the fix is in the shared git() wrapper (emitted-runtime.cjs)
that every caller — resolveChangedPaths, resolveBase, buildBaselineAtRef's
worktree add/remove/prune, and the hermetic regression test added in the
prior commit — funnels through, plus gen-emitted-baseline.cjs's own
rev-parse (now reusing that same wrapper instead of a second execFileSync,
so the fix has one source of truth). Each call declares -c
safe.directory=<the exact directory it already operates on>, never the *
wildcard.

Audited every other helper on this surface (emitted-diff.cjs,
emitted-baseline.cjs, install-shared.cjs) for the same gap: none of them
shell out to git at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W5kQs6ZufZDySC6zDJfYP6

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-07-28 15:41:43 -04:00
committed by GitHub
parent d04592de58
commit 1c1af70a4b
56 changed files with 1244 additions and 10805 deletions

View File

@@ -0,0 +1,44 @@
#!/usr/bin/env node
'use strict';
/**
* ci-export-emitted-baseline-env.cjs — exports GSD_EMITTED_BASELINE for the
* differential attribution check when its baseline cache was restored (#2724,
* ADR-2719 §5).
*
* A plain `node <script>` invocation on purpose, not a shell script. The repo's H1
* shell policy (scripts/workflow-policy.cjs) requires every CI step to run under its
* job/matrix-declared NATIVE shell — pwsh on Windows, zsh on macOS (test-full's own
* `shell: 'zsh {0}'`), bash on Linux — and a step that hardcodes `shell: bash`
* violates that on the other two. A cross-platform Node script run via a bare
* `node scripts/...` command line has no shell-specific syntax at all, so it is
* valid unmodified under bash, zsh, AND pwsh — sidestepping the conflict instead of
* picking one shell and being wrong on the other two.
*/
const fs = require('node:fs');
const path = require('node:path');
const REPO_ROOT = path.join(__dirname, '..');
const CACHE_PATH = path.join(REPO_ROOT, '.gsd-cache', 'emitted-baseline.json');
function main() {
const githubEnv = process.env.GITHUB_ENV;
if (!fs.existsSync(CACHE_PATH)) {
console.log(`ci-export-emitted-baseline-env: ${CACHE_PATH} absent (cache miss) — nothing to export`);
return 0;
}
if (!githubEnv) {
// Not fatal: running this locally or outside Actions should not break anything.
console.log('ci-export-emitted-baseline-env: GITHUB_ENV not set — skipping export (not running under Actions?)');
return 0;
}
fs.appendFileSync(githubEnv, `GSD_EMITTED_BASELINE=${CACHE_PATH}\n`, 'utf8');
console.log(`ci-export-emitted-baseline-env: exported GSD_EMITTED_BASELINE=${CACHE_PATH}`);
return 0;
}
process.exitCode = main();

View File

@@ -117,8 +117,7 @@ const RULES = [
match: path => path.startsWith('src/') || path === 'tsconfig.build.json',
tests: [
'tests/semver-compare.test.cjs', // #2758: absorbs the former tests/bug-10-semver-policy-consolidation.test.cjs (folded into it by consolidation epic #1969 B3 #1972; the stale filename here was a silent coverage hole this rule never actually re-selected)
'tests/golden-install-parity.test.cjs', // any src/installer change can alter emitted install artifacts → re-verify golden install parity (drift guard)
'tests/emitted-provenance.test.cjs', // #2758: the differential travels with the golden — ADR-2719 dual-run
'tests/emitted-provenance.test.cjs', // any src/installer change can alter emitted install artifacts → re-verify provenance totality (#2724: golden-install-parity retired, this is the sole gate)
'tests/emitted-attribution.test.cjs',
],
},
@@ -143,25 +142,23 @@ const RULES = [
// SCOPED_LANE_EXCLUDE guard below, which also drops it when it is itself a
// changed test file.
'tests/runtime-artifact-layout.test.cjs',
'tests/golden-install-parity.test.cjs', // any src/installer change can alter emitted install artifacts → re-verify golden install parity (drift guard)
'tests/emitted-provenance.test.cjs', // #2758: the differential travels with the golden — ADR-2719 dual-run
'tests/emitted-provenance.test.cjs', // any src/installer change can alter emitted install artifacts → re-verify provenance totality (#2724: golden-install-parity retired, this is the sole gate)
'tests/emitted-attribution.test.cjs',
],
},
{
name: 'shipped install content (golden-parity drift guard, #2267)',
name: 'shipped install content (emitted-attribution drift guard, #2267/#2724)',
// Every source file the installer EMITS into a runtime layout is captured by
// golden-install-parity + the install-tree snapshot. A source edit here that
// changes emitted output MUST re-verify the fixtures — otherwise stale golden
// fixtures merge silently (#2266: a hooks/gsd-statusline.js edit changed
// installed output but no rule selected golden-parity, so stale fixtures
// shipped to next undetected). Union semantics: this ADDS the parity guard on
// top of each path's existing content-specific tests. Targeted lane only (the
// golden test skips win32 by design), no fullMatrix.
// #2758: the Phase 2/3 emitted differential (ADR-2719) travels alongside the
// golden here too — a PR editing only shipped content is the archetypal
// emitted ripple, and until this fix no rule selected the differential at
// all. Both green, fixtures untouched, is the dual-run premise.
// the emitted-attribution differential + the install-tree snapshot. A source
// edit here that changes emitted output MUST re-verify (#2266: a
// hooks/gsd-statusline.js edit changed installed output but no rule selected
// the drift guard, so a stale emitted state shipped to next undetected).
// Union semantics: this ADDS the drift guard on top of each path's existing
// content-specific tests. Targeted lane only (the real-tree test skips win32
// by design), no fullMatrix.
// #2724: golden-install-parity.test.cjs is retired (ADR-2719 Phase 4); the
// emitted differential (ADR-2719 Phase 2/3) is now the sole gate for a PR
// editing only shipped content, the archetypal emitted-ripple case.
// NOTE: intentionally NOT a blanket 'gsd-core/' prefix, for two reasons:
// (1) gsd-core/bin/** is tsc-compiled runtime output — EXCLUDED_PREFIXES-
// excluded from both manifests, and already covered by the 'installer and
@@ -179,7 +176,6 @@ const RULES = [
(path.startsWith('gsd-core/bin/shared/') && path.endsWith('.json')) ||
['scripts/fix-slash-commands.cjs', 'scripts/gen-capability-registry.cjs', 'scripts/gen-loop-host-contract.cjs'].includes(path),
tests: [
'tests/golden-install-parity.test.cjs',
'tests/golden-install-tree.test.cjs',
'tests/emitted-provenance.test.cjs',
'tests/emitted-attribution.test.cjs',

View File

@@ -0,0 +1,145 @@
#!/usr/bin/env node
'use strict';
/**
* gen-emitted-baseline.cjs — publishes the emitted-baseline artifact the
* differential attribution check reads via `resolveBaseline()` (#2724, ADR-2719 §5).
*
* ## Why this exists
*
* Phase 3 (#2723) built `resolveBaseline()` (tests/helpers/emitted-baseline.cjs) and its
* cache-key staleness discipline, but nothing produced the artifact it reads — the
* dual-run window instead read the baseline straight off the committed golden fixtures
* at the base ref (`baselineManifestsAtRef`). Phase 4 deletes those fixtures, so
* something has to build and publish `{version, sha, manifests, sizes}` for real.
*
* ## What it does
*
* Builds the emitted manifest set (19 real installer spawns) and the workflow/agent size
* maps for the tree at `--dir <path>` (default: THIS script's own checkout — i.e.
* whatever commit is currently checked out where `gen-emitted-baseline.cjs` itself
* lives). Writes the result to `--out <path>` (default `.gsd-cache/emitted-baseline.json`).
*
* `--dir` decouples "which copy of this script runs" from "which tree gets measured"
* (#2767). The MEASUREMENT SCHEMA — this script, and the `currentManifests`/
* `currentSizes`/`buildParityManifest` functions it calls — always comes from wherever
* `gen-emitted-baseline.cjs` itself is being run from (relative `require`s resolve
* there); only the tree being measured (which `bin/install.js` gets spawned, which
* `hooks/`/`gsd-core/workflows/`/`agents/` get read) moves to `--dir`. That is what lets
* a differential apply ONE definition of "the emitted manifest" to two different
* commits and stay comparable even as that definition evolves — see
* `tests/helpers/emitted-runtime.cjs`'s `buildBaselineAtRef` for the caller that
* exercises this for real, and why it must NOT run the `--dir` tree's own copy of this
* script (which may be an older version, or — for any base ref that predates the PR
* that added this script at all — may not exist there yet).
*
* ## Callers
*
* 1. CI's push-to-`next` job runs this straight after `next` advances (no `--dir`,
* measuring its own checkout), then uploads `.gsd-cache/emitted-baseline.json` as a
* cache entry keyed on the merge sha (.github/workflows/test.yml,
* `publish-emitted-baseline` job).
* 2. `tests/emitted-attribution.test.cjs`'s real-tree test passes
* `buildBaselineAtRef` (tests/helpers/emitted-runtime.cjs) to `resolveBaseline()`
* as the `buildFallback` for a cache miss: it checks out `base` into a throwaway
* `git worktree`, symlinks in `node_modules` and runs `npm run build:lib` there
* (this script and the test helpers are Node-builtins-only per CONTRIBUTING.md's
* "No external dependencies in core", but `tests/helpers/install-shared.cjs`
* requires the TSC-compiled, gitignored `gsd-core/bin/lib/*.cjs`, so that one build
* step is unavoidable), then spawns THIS repo's OWN `gen-emitted-baseline.cjs`
* with `--dir <worktree> --out <tmp>` and reads the artifact back.
*
* Every git subprocess is bounded (CLAUDE.md → KNOWN DEFECTS: unbounded subprocesses
* hang CI silently).
*/
const fs = require('node:fs');
const path = require('node:path');
const { execFileSync } = require('node:child_process');
const { runMain, ExitError } = require('./lib/cli-exit.cjs');
const { BUILD_SCRIPT } = require('../tests/helpers/install-shared.cjs');
const { currentManifests, currentSizes, git } = require('../tests/helpers/emitted-runtime.cjs');
const { BASELINE_VERSION } = require('../tests/helpers/emitted-baseline.cjs');
const REPO_ROOT = path.join(__dirname, '..');
const DEFAULT_OUT = path.join(REPO_ROOT, '.gsd-cache', 'emitted-baseline.json');
// Reuses emitted-runtime.cjs's `git()` (not a local execFileSync) so the
// `-c safe.directory=<dir>` fix for the remote runner's dubious-ownership
// mount (#2767) has exactly one source of truth — see that module's
// `safeDirArgs` doc comment.
function resolveHeadSha(cwd) {
return git(['rev-parse', 'HEAD'], { cwd }).trim();
}
function parseArgs(argv) {
let out = DEFAULT_OUT;
let dir = REPO_ROOT;
for (let i = 0; i < argv.length; i++) {
if (argv[i] === '--out') {
out = argv[i + 1];
i++;
} else if (argv[i] === '--dir') {
dir = argv[i + 1];
i++;
} else {
throw new ExitError(2, `gen-emitted-baseline: unknown argument "${argv[i]}"`);
}
}
if (!out || typeof out !== 'string') {
throw new ExitError(2, 'gen-emitted-baseline: --out requires a path');
}
if (!dir || typeof dir !== 'string') {
throw new ExitError(2, 'gen-emitted-baseline: --dir requires a path');
}
return {
out: path.isAbsolute(out) ? out : path.join(process.cwd(), out),
dir: path.isAbsolute(dir) ? dir : path.join(process.cwd(), dir),
};
}
async function main() {
const { out, dir } = parseArgs(process.argv.slice(2));
if (!fs.existsSync(dir)) {
throw new ExitError(1, `gen-emitted-baseline: --dir "${dir}" does not exist`);
}
const sha = resolveHeadSha(dir);
if (!/^[0-9a-f]{40}$/.test(sha)) {
throw new ExitError(1, `gen-emitted-baseline: HEAD of "${dir}" did not resolve to a 40-hex sha: ${sha}`);
}
// hooks/dist is gitignored and built; a scoped CI checkout may not have run
// build:hooks yet. Idempotent, mirrors the real-tree test. Built INSIDE `dir` — the
// MEASURED tree's own hooks/ source, not this script's — so a `--dir` pointed at a
// different checkout (e.g. a base-ref worktree) reflects that checkout's hooks, not
// the caller's. `dir === REPO_ROOT` (the default, no `--dir`) collapses to the
// pre-#2767 behavior of building this own repo's hooks/dist.
const buildScript = dir === REPO_ROOT ? BUILD_SCRIPT : path.join(dir, 'scripts', 'build-hooks.js');
execFileSync(process.execPath, [buildScript], { cwd: dir, encoding: 'utf-8', stdio: 'pipe', timeout: 120_000 });
// The measurement SCHEMA (currentManifests/currentSizes/buildParityManifest) is
// always THIS script's own — only the tree being measured moves with `repoRoot`.
const manifests = currentManifests({ repoRoot: dir });
const sizes = currentSizes({ repoRoot: dir });
const artifact = { version: BASELINE_VERSION, sha, manifests, sizes };
fs.mkdirSync(path.dirname(out), { recursive: true });
fs.writeFileSync(out, `${JSON.stringify(artifact, null, 2)}\n`, 'utf8');
const familyCount = Object.keys(manifests).length;
const sizeCount = Object.keys(sizes).length;
process.stdout.write(
`gen-emitted-baseline: wrote ${out} (dir=${dir}, sha=${sha.slice(0, 12)}, ${familyCount} families, ${sizeCount} sized files)\n`,
);
return 0;
}
if (require.main === module) {
runMain(main);
}
module.exports = { parseArgs, resolveHeadSha, DEFAULT_OUT, REPO_ROOT };

View File

@@ -1,77 +0,0 @@
#!/usr/bin/env node
'use strict';
/**
* Standalone golden-fixture generator for tests/golden-install-parity.
*
* This is a BUILD-TIME generation script — NOT a test run. It imports the
* canonical buildParityManifest builder from tests/helpers/install-shared.cjs
* (issue #2266 — single source of truth shared with
* tests/golden-install-parity.test.cjs) and captures the zcode fixture so the
* parity test (which the gsd-test gate runs) has a committed artifact to
* compare against. The authoritative test gate remains `gsd-test run`, never
* a local `node --test`.
*
* Usage: node scripts/gen-golden-install-parity-zcode.cjs
*/
const fs = require('node:fs');
const path = require('node:path');
const { execFileSync } = require('node:child_process');
const ROOT = path.resolve(__dirname, '..');
// buildParityManifest (and its exclusion constants) is the canonical single
// source of truth in tests/helpers/install-shared.cjs (issue #2266) — the
// generator no longer keeps its own inline copy, which had drifted from the
// test harness's copy (missing the realpath/`<HOME>` normalization) and
// mis-generated the claude-local fixture (#2100).
const { runMinimalInstall, RUNTIME_META, buildParityManifest, BUILD_SCRIPT } = require(path.join(ROOT, 'tests', 'helpers', 'install-shared.cjs'));
const FIXTURE_DIR = path.join(ROOT, 'tests', 'fixtures', 'golden-install-parity');
function cleanup(root) {
try { fs.rmSync(root, { recursive: true, force: true }); } catch { /* best effort */ }
}
// Regenerate the fixture for every runtime in RUNTIME_META. Needed when a
// SHARED gsd-core payload file (e.g. model-catalog.json, capability-registry)
// changes content — its hash appears in every runtime's manifest, so all
// fixtures must be recaptured together. Usage:
// node scripts/gen-golden-install-parity-zcode.cjs [runtime ...]
// With no args, regenerates ALL runtimes. With args, only the named runtimes.
const targets = process.argv.slice(2).length > 0 ? process.argv.slice(2) : Object.keys(RUNTIME_META);
fs.mkdirSync(FIXTURE_DIR, { recursive: true });
// Build hooks/dist before capturing so fixtures are complete even in a clean
// checkout (hooks/dist is gitignored + built; DEFECT.HOOKS-DIST-SCOPED-CI). The
// test harness's before() hook does the same; without it a fresh checkout omits
// every hooks/* path and this generator silently writes short fixtures.
execFileSync(process.execPath, [BUILD_SCRIPT], { stdio: 'pipe' });
for (const runtime of targets) {
if (!Object.prototype.hasOwnProperty.call(RUNTIME_META, runtime)) {
process.stderr.write(`[gen] unknown runtime '${runtime}' (not in RUNTIME_META) — skipping\n`);
continue;
}
const { configDir, root } = runMinimalInstall({ runtime, scope: 'global' });
let actual;
try {
actual = buildParityManifest(configDir, root);
} finally {
cleanup(root);
}
const fixturePath = path.join(FIXTURE_DIR, `${runtime}.json`);
fs.writeFileSync(fixturePath, JSON.stringify(actual, null, 2) + '\n', 'utf8');
process.stdout.write(`[gen] ${runtime}: wrote ${Object.keys(actual).length} file hashes -> ${fixturePath}\n`);
}
// Also regenerate the claude LOCAL legacy-layout fixture (claude-local.json).
// This layout is distinct from the global install (commands/gsd-*.md +
// agents/gsd-*.md) and has its own parity assertion in the test harness.
const { configDir: localConfigDir, root: localRoot } = runMinimalInstall({ runtime: 'claude', scope: 'local' });
let localActual;
try {
localActual = buildParityManifest(localConfigDir, localRoot);
} finally {
cleanup(localRoot);
}
const localFixturePath = path.join(FIXTURE_DIR, 'claude-local.json');
fs.writeFileSync(localFixturePath, JSON.stringify(localActual, null, 2) + '\n', 'utf8');
process.stdout.write(`[gen] claude-local: wrote ${Object.keys(localActual).length} file hashes -> ${localFixturePath}\n`);

View File

@@ -1,367 +0,0 @@
#!/usr/bin/env node
'use strict';
/**
* git-merge-regen-driver.cjs — the `gsd-regen` git merge driver (#2721, ADR-2719 Phase 1).
*
* ## Why
*
* `tests/fixtures/golden-install-parity/*.json` and the two size baselines are pure
* functions of the source tree. Git offers ours or theirs; both are wrong, because the
* only correct value is recomputed from the merged tree. 140 of 143 conflicted-file
* instances across the open PR queue are these artifacts (ADR-2719).
*
* ## What this driver does — and deliberately does NOT do
*
* It does **not** regenerate. That is not implementable, and the constraint is git's, not
* a design preference: at the moment git invokes a merge driver, **neither the working
* tree nor the index reflects the merge**. Both hold the ours side; a file added by
* theirs does not exist yet; `.git/MERGE_HEAD` has not been written. A driver that shelled
* out to the generators there would read the ours-side tree and write a
* plausible-but-wrong hash manifest — strictly worse than a conflict, because a conflict
* is visible and a wrong manifest is not. Git also invokes the driver once **per
* conflicted path** (20 in this repo), so a regenerating driver would run the full build
* plus 19 installer spawns up to twenty times per merge.
*
* So it resolves deterministically and without content knowledge: it accepts `%A` (which
* already holds ours verbatim), runs **zero subprocesses**, records the resolved paths
* under the git dir, and prints **one** notice per operation pointing at
* `npm run regen:derived`. Staleness is caught where it already was — by
* `tests/golden-install-parity.test.cjs` in CI.
*
* Every failure path degrades toward *today's* behavior (a normal conflict), never toward
* a silent wrong resolution.
*
* ## Bridge, not a destination
*
* This driver is explicitly temporary. #2724 deletes the artifacts it guards and retires
* it. Keeping it past that point would preserve the problem it exists to relieve.
*
* node scripts/git-merge-regen-driver.cjs --install # register in .git/config
* node scripts/git-merge-regen-driver.cjs --uninstall
* node scripts/git-merge-regen-driver.cjs --status
*/
const fs = require('node:fs');
const path = require('node:path');
const cp = require('node:child_process');
const { runMain, ExitError } = require('./lib/cli-exit.cjs');
const REPO_ROOT = path.join(__dirname, '..');
const MARKER_NAME = 'gsd-regen-pending.json';
/** Bounded per the repo's unbounded-subprocess rule (5-30s for git). */
const GIT_TIMEOUT_MS = 15_000;
/**
* A single git operation's driver invocations land milliseconds apart, so this window is
* ~4 orders of magnitude wider than it needs to be. It exists only so a *later* operation
* does not inherit the previous one's silence.
*/
const NOTICE_WINDOW_MS = 60_000;
const ACTION = Object.freeze({
ACCEPT_OURS: 'accept_ours',
DECLINE: 'decline',
});
const REASON = Object.freeze({
OK_RESOLVED: 'ok_resolved',
FAIL_BAD_ARGV: 'fail_bad_argv',
FAIL_OURS_UNREADABLE: 'fail_ours_unreadable',
});
const GITDIR_SOURCE = Object.freeze({
DIRECTORY: 'directory',
GITFILE: 'gitfile',
UNRESOLVED: 'unresolved',
});
/**
* Locate the git dir from `cwd` without spawning git — the driver runs up to twenty times
* per merge, so a subprocess per invocation is not affordable.
*
* Handles both shapes: `.git` as a directory, and `.git` as a pointer file
* (`gitdir: <path>`) in a linked worktree or submodule. Never throws; an unresolvable git
* dir is a degraded-but-correct state, not an error.
*
* @param {string} cwd
* @returns {{gitDir: string|null, source: string}}
*/
function resolveGitDir(cwd) {
const unresolved = { gitDir: null, source: GITDIR_SOURCE.UNRESOLVED };
const dotGit = path.join(cwd, '.git');
let stat;
try {
stat = fs.statSync(dotGit);
} catch {
return unresolved;
}
if (stat.isDirectory()) return { gitDir: dotGit, source: GITDIR_SOURCE.DIRECTORY };
let raw;
try {
raw = fs.readFileSync(dotGit, 'utf8');
} catch {
return unresolved;
}
// Anchored /m with an explicit trailing-whitespace eat: `$` under /m sits before the
// \n, so a CRLF checkout would otherwise carry the \r into the path.
const match = /^gitdir:\s*(.*?)\s*$/m.exec(raw);
if (!match || match[1] === '') return unresolved;
return { gitDir: path.resolve(cwd, match[1]), source: GITDIR_SOURCE.GITFILE };
}
/**
* Read the pending-resolution marker, treating anything unusable as absent.
*
* Valid JSON is not the same as a usable marker: `0`, `"str"`, `[]`, `null` and `true` all
* parse. So does an object whose `startedAt` or `count` is a string. Every one of those
* means "no previous invocation I can trust" — reset, do not throw.
*
* @returns {{startedAt: number, count: number}|null}
*/
function readMarker(markerPath) {
let parsed;
try {
parsed = JSON.parse(fs.readFileSync(markerPath, 'utf8'));
} catch {
return null;
}
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return null;
if (!Number.isFinite(parsed.startedAt)) return null;
if (!Number.isFinite(parsed.count) || parsed.count < 0) return null;
return { startedAt: parsed.startedAt, count: parsed.count };
}
function decline(reason) {
return {
action: ACTION.DECLINE,
reason,
exitCode: 1,
notice: false,
pendingCount: 0,
};
}
/**
* Decide how to resolve one conflicted path, and record it.
*
* Deliberately NOT named `plan*` like `planInstall`: that prefix promises purity, and this
* function reads and writes the marker file. The name says both halves out loud.
*
* @param {object} opts
* @param {string[]} opts.argv exactly what git supplies: [%O, %A, %B, %L]. Any further
* entry is ignored — see planInstall on why `%P` is deliberately not registered.
* @param {string|null} opts.gitDir from resolveGitDir; null means marker-less (degraded)
* @param {number} opts.now injected clock — never Date.now() inline, so tests are
* deterministic and never assert on elapsed wall-clock
* @returns {{action: string, reason: string, exitCode: number, notice: boolean,
* pendingCount: number}}
*/
function resolveAndRecord({ argv, gitDir, now }) {
if (!Array.isArray(argv) || argv.length < 3) return decline(REASON.FAIL_BAD_ARGV);
const oursPath = argv[1];
if (typeof oursPath !== 'string' || oursPath.trim() === '') {
return decline(REASON.FAIL_BAD_ARGV);
}
// %A is the one input the driver's contract depends on. If it is not there, we do not
// know what "ours" is, so we hand the conflict back to git rather than inventing one.
try {
fs.statSync(oursPath);
} catch {
return decline(REASON.FAIL_OURS_UNREADABLE);
}
const markerPath = gitDir ? path.join(gitDir, MARKER_NAME) : null;
const previous = markerPath ? readMarker(markerPath) : null;
const sameOperation = previous !== null && now - previous.startedAt <= NOTICE_WINDOW_MS;
const startedAt = sameOperation ? previous.startedAt : now;
const pendingCount = sameOperation ? previous.count + 1 : 1;
if (markerPath) {
// A diagnostic must never fail a merge: a read-only .git degrades to a repeated
// notice, which is noisy but correct.
try {
fs.writeFileSync(markerPath, `${JSON.stringify({ startedAt, count: pendingCount })}\n`);
} catch {
/* degraded, not failed */
}
}
return {
action: ACTION.ACCEPT_OURS,
reason: REASON.OK_RESOLVED,
exitCode: 0,
notice: !sameOperation,
pendingCount,
};
}
/**
* The `.git/config` entries that register this driver.
*
* ## Why `%P` is NOT passed — do not "helpfully" add it back
*
* Git does **not** invoke a merge driver with an argv array. It substitutes `%O %A %B %L
* %P` textually into this string and runs the whole thing through a shell. Quoting a
* placeholder does not make it safe: inside POSIX double quotes `$(…)` and backticks still
* execute, and a `"` in the value ends the quoting outright.
*
* `%O`, `%A` and `%B` are git-generated temp names (`.merge_file_XXXXXX`) and `%L` is an
* integer, so none of them are attacker-controlled. **`%P` is the file's own path**, which
* any contributor chooses freely. A branch that renames a covered fixture to
* `evil$(touch PWNED).json` would execute that command on the machine of every maintainer
* who merges it — silently, since the merge still reports success. Verified by reproduction
* against a real `git merge`, not by inspection.
*
* So the driver takes no attacker-controlled argument at all, and records a count rather
* than path names. A filter would have been a guess about shell grammar; passing nothing is
* a property.
*
* Paths are normalized to forward slashes **unconditionally** — a backslash path can reach a
* config value on any platform, and git shells this command everywhere including Windows.
*
* @param {{repoRoot: string}} opts
* @returns {{entries: Array<{key: string, value: string}>}}
*/
function planInstall({ repoRoot }) {
const script = path
.join(repoRoot, 'scripts', 'git-merge-regen-driver.cjs')
.replace(/\\/g, '/');
return {
entries: [
{
key: 'merge.gsd-regen.name',
value: 'gsd-regen — keep ours for generated artifacts; regenerate with npm run regen:derived',
},
{
key: 'merge.gsd-regen.driver',
value: `node "${script}" "%O" "%A" "%B" "%L"`,
},
],
};
}
function gitConfig(args, cwd = REPO_ROOT) {
const r = cp.spawnSync('git', ['config', ...args], {
cwd,
encoding: 'utf8',
timeout: GIT_TIMEOUT_MS,
});
if (r.error && r.error.code === 'ETIMEDOUT') {
throw new ExitError(1, `git config timed out after ${GIT_TIMEOUT_MS}ms`);
}
return r;
}
function runInstall({ repoRoot = REPO_ROOT } = {}) {
const { entries } = planInstall({ repoRoot });
for (const { key, value } of entries) {
const r = gitConfig([key, value], repoRoot);
if (r.status !== 0) throw new ExitError(1, `git config ${key} failed: ${r.stderr}`);
}
process.stdout.write(
'Registered the gsd-regen merge driver in this clone.\n' +
'Conflicts on the generated parity manifests and size baselines now resolve to your\n' +
'branch’s copy; run `npm run regen:derived` afterwards to recompute them.\n' +
'This is a bridge for #2721 and is retired by #2724.\n',
);
return 0;
}
function runUninstall({ repoRoot = REPO_ROOT } = {}) {
for (const key of ['merge.gsd-regen.driver', 'merge.gsd-regen.name']) {
// exit 5 == "was not set"; uninstalling something absent is success here
gitConfig(['--unset-all', key], repoRoot);
}
process.stdout.write('Removed the gsd-regen merge driver from this clone.\n');
return 0;
}
/**
* @returns {{registered: boolean, pendingCount: number}} the same object it prints, so
* callers and tests consume the structure rather than re-parsing the rendered JSON.
* A count, not path names: the driver is never handed the conflicted path, by design
* (see planInstall).
*/
function statusOf({ repoRoot = REPO_ROOT } = {}) {
const registered = gitConfig(['--get', 'merge.gsd-regen.driver'], repoRoot).status === 0;
const { gitDir } = resolveGitDir(repoRoot);
const marker = gitDir ? readMarker(path.join(gitDir, MARKER_NAME)) : null;
return { registered, pendingCount: marker ? marker.count : 0 };
}
function runStatus({ repoRoot = REPO_ROOT } = {}) {
process.stdout.write(JSON.stringify(statusOf({ repoRoot }), null, 2) + '\n');
return 0;
}
function runDriver(argv) {
const { gitDir } = resolveGitDir(process.cwd());
const plan = resolveAndRecord({ argv, gitDir, now: Date.now() });
if (plan.action === ACTION.DECLINE) {
process.stderr.write(
`gsd-regen: declined (${plan.reason}) — leaving this path as a normal conflict.\n`,
);
return plan.exitCode;
}
if (plan.notice) {
process.stderr.write(
'gsd-regen: kept your branch’s copy of the generated parity/size artifacts.\n' +
'gsd-regen: these files cannot be line-merged — their only correct value is recomputed.\n' +
'gsd-regen: run `npm run regen:derived` before committing.\n' +
'gsd-regen: (bridge for #2721; retired by #2724)\n',
);
}
return plan.exitCode;
}
function main() {
const argv = process.argv.slice(2);
const flags = argv.filter((a) => a.startsWith('--'));
if (flags.length > 0) {
if (flags.length > 1 || argv.length > 1) {
throw new ExitError(2, 'usage: git-merge-regen-driver.cjs [--install|--uninstall|--status]');
}
switch (flags[0]) {
case '--install':
return runInstall();
case '--uninstall':
return runUninstall();
case '--status':
return runStatus();
default:
throw new ExitError(
2,
`unknown flag ${flags[0]}\nusage: git-merge-regen-driver.cjs [--install|--uninstall|--status]`,
);
}
}
return runDriver(argv);
}
module.exports = {
ACTION,
REASON,
GITDIR_SOURCE,
NOTICE_WINDOW_MS,
MARKER_NAME,
resolveGitDir,
resolveAndRecord,
planInstall,
runInstall,
runUninstall,
runStatus,
statusOf,
};
if (require.main === module) runMain(main);

View File

@@ -1,68 +0,0 @@
#!/usr/bin/env node
'use strict';
/**
* @file update-size-baseline.cjs
*
* Regenerates the committed per-file workflow size baseline
* (`tests/workflow-size-baseline.json`) from the current workflow files.
*
* Run via `npm run size:baseline` whenever a workflow file legitimately grows
* or shrinks. Growth must still be justified in the PR; this script only
* records the new reality so the CI guard (issue #1074) can diff against it.
*
* Idempotent: running it twice with no file changes produces no diff.
*/
const fs = require('fs');
const path = require('path');
const { measureMdFiles, WORKFLOWS_DIR } = require('./workflow-size.cjs');
const BASELINE_PATH = path.join(__dirname, '..', 'tests', 'workflow-size-baseline.json');
const AGENTS_DIR = path.join(__dirname, '..', 'agents');
const AGENT_BASELINE_PATH = path.join(__dirname, '..', 'tests', 'agent-size-baseline.json');
const isGsdAgent = (f) => f.startsWith('gsd-');
/**
* Serialize a size map to the on-disk baseline format: keys sorted, 2-space
* indent, trailing newline (so the file is a stable, minimal-diff artifact).
*
* @param {Object<string, number>} sizes
* @returns {string}
*/
function serializeBaseline(sizes) {
const sorted = {};
for (const key of Object.keys(sizes).sort()) sorted[key] = sizes[key];
return JSON.stringify(sorted, null, 2) + '\n';
}
/**
* Write a baseline file from the measured `.md` sizes in a directory.
*
* @param {object} [opts]
* @param {string} [opts.dir] - Directory to measure (default: workflows).
* @param {string} [opts.outPath] - Baseline file to write (default: workflow).
* @param {function(string): boolean} [opts.predicate] - Filename filter.
* @returns {{ outPath: string, count: number, content: string }}
*/
function generateBaseline({ dir = WORKFLOWS_DIR, outPath = BASELINE_PATH, predicate } = {}) {
const sizes = measureMdFiles(dir, predicate);
const content = serializeBaseline(sizes);
fs.writeFileSync(outPath, content);
return { outPath, count: Object.keys(sizes).length, content };
}
if (require.main === module) {
const targets = [
{ label: 'workflow', dir: WORKFLOWS_DIR, outPath: BASELINE_PATH },
{ label: 'agent', dir: AGENTS_DIR, outPath: AGENT_BASELINE_PATH, predicate: isGsdAgent },
];
for (const t of targets) {
const { outPath, count } = generateBaseline(t);
process.stdout.write(
`Wrote ${count} ${t.label} sizes to ${path.relative(process.cwd(), outPath)}\n`
);
}
}
module.exports = { generateBaseline, serializeBaseline, BASELINE_PATH, AGENT_BASELINE_PATH };

View File

@@ -5,10 +5,13 @@
*
* Single source of truth for measuring workflow `.md` file sizes in bytes.
*
* Shared by `tests/workflow-size-budget.test.cjs` (the CI guard) and
* `scripts/update-size-baseline.cjs` (the baseline generator) so the two can
* never disagree on HOW a file is measured. A divergence between the generator
* and the guard would silently mis-record the baseline (issue #1074).
* Shared by `tests/workflow-size-budget.test.cjs` / `tests/agent-size-budget.test.cjs`
* (the tier hard-cap guards), `tests/helpers/emitted-runtime.cjs`'s `currentSizes()`
* (the differential attribution check's size ratchet, ADR-2719 Phase 4), and
* `scripts/gen-emitted-baseline.cjs` (the baseline publisher) so none of them can
* disagree on HOW a file is measured (issue #1074). `scripts/update-size-baseline.cjs`,
* the original third consumer, was removed by #2724 along with the per-file baseline
* it generated.
*/
const fs = require('fs');