Skip to content

Commit bc1d34f

Browse files
os-steveclaude
andauthored
test(scripts): give sync-template-versions a --self-test wired into Lint & Repo Gates (#9880)
* test(scripts): give sync-template-versions a --self-test covering the red paths and the CLEAN control Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja * fix(scripts): make the self-test's stamp-coverage control report before it can crash Control G asserts every TEXT_STAMPS row has a fixture body, but it ran INSIDE the fixture block. `buildFixture` indexes SELF_TEST_BODIES by key, so an uncovered row threw `TypeError: SELF_TEST_BODIES[stamp.key] is not a function` out of Control A and killed the process before the failure list was printed. Measured by adding a fourth TEXT_STAMPS row with no body: exit 1 either way — the gate held — but the one message written for this exact case never reached the log in the exact case it was written for. Ordering is the whole fix: the control moves ahead of the scratch dir (it needs no fixture) and reports through a shared reportFailures(), which also replaces the duplicated tail block. No case is added, removed or reworded. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4b99386 commit bc1d34f

3 files changed

Lines changed: 411 additions & 2 deletions

File tree

‎.github/workflows/lint.yml‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,42 @@ jobs:
501501
- name: Docs image-tag version-time rewriter self-test
502502
run: pnpm check:docs-image-tag-sync
503503

504+
# #9348 — the same treatment for the OTHER version-time rewriter, and the
505+
# scheduling gap that made it necessary after #9648 already added a vitest
506+
# file which runs the CLI. `create-objectstack#test` is reachable only from
507+
# ci.yml's `test` job, which is gated on the `core` paths-filter; `core` is
508+
# `packages/**`, `examples/**`, `apps/!(docs)/**`, `package.json`,
509+
# `pnpm-lock.yaml`, `tsconfig.json`, `.github/workflows/ci.yml` and matches
510+
# no path under `scripts/`. Measured with picomatch 4.0.5 (the matcher
511+
# dorny/paths-filter uses): a diff confined to
512+
# scripts/sync-template-versions.mjs yields core=false, so Test Core is
513+
# skipped ENTIRELY on the PR that changes the rewriter, and with it the
514+
# vitest. The two layers that look like they cover it do not: `turbo ls
515+
# --affected` returns ZERO packages for that diff (a package-local edit
516+
# returns 1, so the probe is live) — turbo.json's `$TURBO_ROOT$` entry
517+
# moves the task HASH, which is what stops a cached green on the merge
518+
# queue, not what schedules the job — and the `--union-into` step that DOES
519+
# pull create-objectstack back in is a step inside the skipped job. The
520+
# queue build catches it, one merge late, as batch collateral; that is the
521+
# failure shape check-cross-package-test-inputs.mjs's own ledger records
522+
# twice.
523+
#
524+
# This workflow carries no paths filter and no filter job, so this step
525+
# runs on every pull request, push and merge-queue build. That is the whole
526+
# reason the flag exists rather than more cases in the vitest file.
527+
#
528+
# Only the --self-test runs here, for the same reason as the step above:
529+
# the rewriter has nothing to do on a green corpus. The cases are scoped to
530+
# what the vitest does NOT assert — a CLEAN corpus left byte-identical and
531+
# UNWRITTEN, and every red path (missing stamp, missing file, unparseable
532+
# package.json, a template with no @objectstack/* dependency, the empty
533+
# templates directory) observed exiting 1 and naming the file. The STALE ->
534+
# rewritten direction and the discovery walk stay in
535+
# packages/create-objectstack/src/template-version-stamps.test.ts; two
536+
# harnesses asserting the same thing would be worse than one.
537+
- name: Template version-time rewriter self-test
538+
run: pnpm check:template-version-sync
539+
504540
# #4851: the docs-accuracy-audit workflow carries its default scope inline
505541
# (a workflow script runs in a vm with no filesystem, so it cannot enumerate
506542
# content/docs/ itself). Hand-kept, that list rotted in BOTH directions —

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"check:docs-redirects": "node scripts/check-docs-redirects.mjs --self-test && node scripts/check-docs-redirects.mjs",
4242
"check:docs-image-tag": "node scripts/check-docs-image-tag.mjs --self-test && node scripts/check-docs-image-tag.mjs",
4343
"check:docs-image-tag-sync": "node scripts/sync-docs-image-tags.mjs --self-test",
44+
"check:template-version-sync": "node scripts/sync-template-versions.mjs --self-test",
4445
"check:role-word": "node scripts/check-role-word.mjs --self-test && node scripts/check-role-word.mjs",
4546
"check:quick-reference-counts": "node scripts/check-quick-reference-counts.mjs --self-test && node scripts/check-quick-reference-counts.mjs",
4647
"check:runtime-services-index": "node scripts/check-runtime-services-index.mjs --self-test && node scripts/check-runtime-services-index.mjs",

0 commit comments

Comments
 (0)