Repository navigation
fix(pstack): satisfy strict typecheck in statechart run.ts and CLI tests - #1148
Open
surlymochan wants to merge 1 commit into
Open
surlymochan wants to merge 1 commit into
surlymochan wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1141
Why
tsc -p tsconfig.jsoninpstack/skills/statechart/scripts(strict config, TypeScript 7.0.2, @types/node 26.1.2) reports four errors:run.ts(455)andrun.ts(471): theexitin the sharedcommonobject is inferred asnumber, which is not assignable toCheckResult.exit(0 | 1 | 2).test/cli.test.ts(430)andtest/cli.test.ts(453): two test callbacks returnsignalWhile(...), whose promise resolves to the phase object; Node'sTestFnrequiresvoid | Promise<void>.CI does not run
tsc, so nothing flags this today; anyone typechecking the package locally hits it immediately.What changed
run.ts: annotateexitClasswith the return typeCheckResult["exit"]. The ternary already only ever produces0,1, or2; the annotation stops the literal union from widening tonumberat the source, so bothcheck()return sites typecheck.test/cli.test.ts: the two callbacks nowawait signalWhile(...)in an async block body instead of returning its promise — the same shape the neighbouring signal test in this file already uses.harness/pstack/withscripts/generate-pstack-harness-trees.mjs; the two generated copies carry the same edits.Scope
Type-level only. No runtime behaviour changes:
exitClasscomputes the same values as before, and the test callbacks still await the samesignalWhilepromise — only its resolution value is no longer returned to the test runner. No other files touched;plugin.jsonuntouched.Blast Radius
Confined to the statechart skill's scripts and their generated harness copies. The only consumers of
exitClassare its two call sites insiderun.ts, both internal tocheck().Verification
One combined run on this branch:
node scripts/generate-pstack-harness-trees.mjs --check— "harness/pstack is up to date"node scripts/validate-plugins.mjs— all plugins validated successfullytsc -p tsconfig.jsoninpstack/skills/statechart/scripts(typescript@7.0.2 and @types/node@26.1.2 installed as in pstack statechart: strict typecheck reports four errors in run.ts and CLI tests #1141's repro) — exits 0; before this change it reported exactly the four errors listed abovenode --disable-warning=ExperimentalWarning --test pstack/skills/*/scripts/test/*.test.ts— 334 tests: 267 pass, 0 fail, 67 skipped (the skipped ones shell out to TLC and self-skip whenTLA2TOOLSis unset)