test(build-label): accept the three-word source-SHA slug in alpha/beta cut labels
All checks were successful
Notify chart dev on beta cut / notify-chart-dev (push) Successful in 7s

`./build alpha|beta` now stamps a date + a three-word slug derived from
the source SHA (e.g. "v0.0.17-beta · 2026-05-12 · candle-mast-pearl")
instead of a raw hex SHA. The build-label spec's channel-label regex
only matched the hex-SHA form (still used by plain dev builds), so it
failed on every release cut. Accept either trailing field.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZDDC 2026-05-12 13:30:06 -05:00
parent ba7e7a3fdd
commit adcf5dedd6

View file

@ -45,11 +45,17 @@ for (const tool of tools) {
expect(match, 'build-timestamp element must have text content').toBeTruthy();
const label = match[1];
// Plain dev builds and --release alpha|beta carry the next-stable
// target as a pre-release suffix:
// "v0.0.3-alpha · 2026-04-29 00:50:17 · 714faf6-dirty" (plain dev)
// "v0.0.3-alpha · 2026-04-29 · 714faf6" (--release alpha)
// "v0.0.3-beta · 2026-04-29 · 714faf6" (--release beta)
const isChannel = /^v\d+\.\d+\.\d+-(alpha|beta) · 20\d\d-\d\d-\d\d( \d\d:\d\d:\d\d)? · [0-9a-f]+(-dirty)?$/.test(label);
// target as a pre-release suffix; the trailing field differs:
// plain dev → full timestamp + short SHA (+ "-dirty"):
// "v0.0.17-alpha · 2026-04-29 00:50:17 · 714faf6-dirty"
// --release alpha|beta → date-only + a three-word source-SHA slug:
// "v0.0.17-beta · 2026-04-29 · candle-mast-pearl"
// stable cut → bare version: "v0.0.17"
const sha = '[0-9a-f]+(?:-dirty)?'; // plain dev build
const slug = '[a-z]+-[a-z]+-[a-z]+'; // --release alpha|beta
const isChannel = new RegExp(
`^v\\d+\\.\\d+\\.\\d+-(?:alpha|beta) · 20\\d\\d-\\d\\d-\\d\\d(?: \\d\\d:\\d\\d:\\d\\d)? · (?:${sha}|${slug})$`
).test(label);
const isVersion = /^v\d+\.\d+\.\d+$/.test(label);
expect(isChannel || isVersion,
`Expected channel or version label, got: "${label}"`