Skip to content

test(workflows): name a step that runs an unknown script or subcommand - #525

Merged
Vivswan merged 1 commit into
mainfrom
test/workflows-unknown-script-step
Oct 7, 2026
Merged

Vivswan merged 1 commit into
mainfrom
test/workflows-unknown-script-step

Conversation

@Vivswan

@Vivswan Vivswan commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Before

step run: bun .github/scripts/release-pipeline.ts package-commits
wiringProblems(post-green.yml) -> ""

step run: bun .github/scripts/post-gren-steps.ts probe
wiringProblems(post-green.yml) -> six downstream faults ("reads steps.token.outputs.proceed, which no
                                  earlier step writes" ...), none naming the script

After

build: "Package this commit under its build tag, prune the window, and point latest at the newest main source" runs release-pipeline package-commits, a subcommand .github/scripts/release-pipeline.ts does not dispatch

build: "Check the token can push" runs .github/scripts/post-gren-steps.ts, a script this relation does not know

How

  • One registry of steps scripts in the test: each script's exported COMMANDS table (what it dispatches) beside its STEP_OUTPUTS (what those write).
  • A script step naming a script or subcommand outside it is a wiring fault naming the step.
  • A broad detector and a strict reader: any line handing bun a steps script is detected; a detected step the reader cannot parse fails the control.
  • post-green-steps exports its table, as release-pipeline already does.
  • CONTRIBUTING.md names release-pipeline/tags.ts as where the git topology lives, where the split moved it.

Proof

  • Red then green: the typo rows failed against the old relation (received "" and the six-line list above), then passed; the doubled-space row went red again under a single-space regex.
  • Tests: test/workflows 84 green (4 new rows), test/scripts/entry.test.ts 4 green; typecheck, biome, knip green.
Technical details
  • Built on refactor(scripts): dispatch subcommands and run mains through one lib #523: the known-subcommand set is the handler table that PR introduced; STEP_OUTPUTS alone lists only the subcommands that write outputs (release-pipeline declares 1 of 11), so it cannot judge a subcommand.
  • Steps the wider regex newly reads: the GITHUB_SHA="$SOURCE_SHA" bun ... package-commit|package|retag-major|npm-publish next|npm-publish stable steps; their declared outputs are unchanged (none), so isProbe and the gate chain read as before.
  • Inherited keys are not entries: the registry is a Map and the outputs lookup is an own-key read, so constructor.ts and a constructor subcommand are named as unknown instead of throwing in outputsWritten; a row pins each.
  • One more cross-file pin: every subcommand a script declares outputs for is one it dispatches.
  • Shapes the reader refuses, loudly: a newline between tokens, a bun flag, bun run, a line continuation, a prefix bash reads as a command (1PAT_SET="true"), single-quoted assignments, multi-command blocks; each is detected and fails the control rather than passing unjudged, and the control pins the first five. Any run text with bun ahead of .github/scripts/ is detected.
  • Library: none applies; the relation is a regex over yaml the test already parses.
  • Files: test/workflows/post-green-workflow.test.ts, .github/scripts/post-green-steps.ts (the export), CONTRIBUTING.md (line 60).
  • Accounting: 3 files, +129 / -22.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 23:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The validation is consistent with the dispatcher contract and covers the relevant failure modes.

Review effort: Balanced
Findings: None

What changed in this PR

Adds workflow wiring checks that identify unknown scripts and subcommands before post-green hooks run.

Changes:

  • Exports the post-green command registry.
  • Validates workflow script invocations against registered commands.
  • Corrects the release topology documentation path.
File Description
.github/​scripts/​post-green-steps.ts Exports and reuses the command table.
test/​workflows/​post-green-workflow.test.ts Adds script parsing, validation, and negative controls.
CONTRIBUTING.md Updates the topology source path.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The wiring relation in test/workflows/post-green-workflow.test.ts judged a `bun .github/scripts/<script>.ts <subcommand>` step only by the outputs it declares, so a step naming a script that does not exist, or a known script with a mistyped subcommand, raised no problem: the typo passed until the hook ran on main. A SCRIPTS registry now pairs each steps script's exported COMMANDS table (what it dispatches) with its STEP_OUTPUTS (what those write), and the relation names a step whose script is not registered or whose subcommand the script does not dispatch.

A broad detector (any run text with bun ahead of a steps script path) and a strict reader (the hooks' shapes: bash-identifier assignments ahead of bun, arguments after the subcommand, spaces or tabs between tokens) sit side by side, with a control that a detected step the reader cannot parse fails loudly; the control's own control pins a newline between tokens, a bun flag, `bun run`, a line continuation, and a digit-leading prefix as detected and unread. The registry is a Map and the outputs lookup is an own-key read, so `constructor` as a script or subcommand is named as unknown instead of throwing.

post-green-steps.ts exports its COMMANDS table as release-pipeline.ts does. CONTRIBUTING.md names .github/scripts/release-pipeline/tags.ts as where the git topology lives, where the split moved it.
Copilot AI balanced review requested due to automatic review settings October 6, 2026 23:17
@Vivswan
Vivswan force-pushed the test/workflows-unknown-script-step branch from 6fb43c3 to 311bc62 Compare October 6, 2026 23:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused test and documentation changes consistently implement the described workflow validation.

Review effort: Balanced
Findings: None

@Vivswan
Vivswan marked this pull request as ready for review October 6, 2026 23:23
@Vivswan
Vivswan merged commit 29a31b1 into main Oct 7, 2026
27 checks passed
@Vivswan
Vivswan deleted the test/workflows-unknown-script-step branch October 7, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants