altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

test(release): integration tests for release-preflight.ts live-check functions

Open sahrizvi opened this issue 4 months ago • 0 comments

Deferred from the v0.9.3 pre-release review.

Current behavior

script/release-preflight.ts has 41 unit tests covering the pure helper functions: normalizeVersion, parseSemver, compareSemver, isStableTagName, selectPrevTag, prereleaseLineTags.

Gap

The main() function's nine live gates — which shell out to run(), git(), and gh — are untested. A regression in the npm reachability branch or the gh release-blocker query logic would not surface until an actual release attempt fails on it, at which point the release is already halted and every second of debug time is on the wire.

Proposal

Add integration tests that mock the run() shim at the test-harness boundary and exercise each of the nine gates. Coverage targets:

  • Tag-collision paths — local exists, remote exists, both exist, neither exists.
  • Version-sanity failures — npm-view reachable but version already published; npm-view unreachable; malformed SemVer.
  • Prerelease-line ancestry — prerelease tag on the same minor line not an ancestor of origin/main.
  • Release-blocker query — open PR with the label; API failure; empty result.
  • PREV_TAG selection dry-run against a rigged tag graph.

Why deferred

Requires building the run() mocking harness. Test infrastructure work worth its own follow-up.

sahrizvi avatar Jul 23 '26 20:07 sahrizvi