You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ci): derive cut-rc's template release-file allowlist from stampedPaths() (#10569)
The release-file allowlist in `cut-rc.yml`'s "Build the single version commit"
step read its doc half from a declaration and RESTATED its template half: two
literals hard-coding the template name `blank`, once in the `git add -A --`
pathspec and again in the `grep -vE` re-check. The block's own comment recorded
why -- `sync-template-versions.mjs` declared its targets but exported none of
them and ran the sync at module scope, so importing it would have rewritten the
templates instead of answering -- and named the precondition for fixing it.
#9648 landed exactly that: `stampedPaths()` plus the entry-point guard.
The two lists are one list, not two contracts of different width. Measured
against the shipped bytes extracted from the committed YAML and run over a
throwaway tree whose template files are written by the real
`sync-template-versions.mjs`: on a one-template tree the old and new forms
produce a byte-identical exit code, staged path set and error output; on a
two-template tree the old form refuses the cut, naming the second template's
objectstack.config.ts and objectstack.manifest.json as unstaged, and the new
form accepts it. That is the failure #9648's fixture test already predicts,
reproduced against the workflow half.
`stampedPaths()` also reports each template's package.json, which the existing
'*package.json' pathspec already permits, so the resolved list is a superset of
the two literals and never a narrowing. It is not a wildcard over
`templates/**` either: a tracked file in a template directory that the
declaration does not name is still refused.
Nothing here touches the changeset steps, `release.yml`, `pr-automation.yml` or
root package.json -- the `.changeset` pathspec and the `^\.changeset/`
alternation are byte-identical.
Claude-Session: https://claude.ai/code/session_01DdCnBGcHeufjrq7drTD3wt
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
-e 'import { stampedPaths } from "./scripts/sync-template-versions.mjs"; for (const p of stampedPaths()) console.log(p);' \
662
+
> "$TEMPLATE_LIST"; then
663
+
echo "::error::could not resolve stampedPaths() from scripts/sync-template-versions.mjs, so the template half of the release file surface is unknown. Refusing to push."
664
+
exit 1
665
+
fi
666
+
# Same rule as the doc half: unknown is a failure, never an empty
667
+
# allowlist. `stampedPaths()` THROWS rather than returning [] on a moved
668
+
# or empty template directory, so an empty file here means a resolution
669
+
# that reported nothing while still exiting 0 — which would stage no
670
+
# template path at all and then blame the files it left unstaged.
671
+
if [ ! -s "$TEMPLATE_LIST" ]; then
672
+
echo "::error::stampedPaths() in scripts/sync-template-versions.mjs resolved EMPTY, so no template surface would be staged even though the version pass stamps them. Refusing to push."
673
+
exit 1
674
+
fi
675
+
mapfile -t TEMPLATE_SURFACES < "$TEMPLATE_LIST"
676
+
echo "template surfaces declared by stampedPaths() (${#TEMPLATE_SURFACES[@]}):"
echo "::error::the version commit would carry paths outside the release file surface. Refusing to push. Offending paths follow; if the version pass legitimately grew a new output, widen the allowlist in this workflow deliberately."
0 commit comments