Context
.github/scripts/bump_version.sh is in the hot path of every release. It parses the TOML, performs an atomic rewrite, and is the single point where versions get bumped. One edge-case bug (CRLF line endings, BOM, trailing whitespace, an unusual quote style sneaking into the TOML) wedges every future cut.
The script was smoke-tested by hand during the Stage 7 migration (release happy path, hotfix happy path, malformed versionName rejection with file-unchanged assertion, missing/invalid --mode rejection, trailing-newline preservation), but those tests were never committed. They will silently regress on the next edit.
What's needed
-
Add .github/scripts/bump_version_test.sh (bash or bats) covering at least:
--mode=release happy path (e.g. 1.5.0 / 42 → 1.6.0 / 43).
--mode=hotfix happy path (1.6.0 / 43 → 1.6.1 / 44).
- Missing
--mode and invalid --mode=<other> are rejected with a non-zero exit and a usage message.
- Malformed
versionName (e.g. "1.5") is rejected and the input file is left byte-identical.
- Trailing-newline preservation: file ending with
\n retains the \n; file ending without \n retains no \n.
- (Stretch) CRLF line endings are tolerated, or are explicitly rejected with a clear error.
-
Wire the test into CI so it runs on every PR that touches .github/scripts/**. Easiest path: add a job (or a step in pr_guard.yml) gated by a paths: filter on .github/scripts/**.
References
.github/scripts/bump_version.sh.
documentation/release-flow.md §4.1, §4.2 — TOML format and bump rules the script implements.
Context
.github/scripts/bump_version.shis in the hot path of every release. It parses the TOML, performs an atomic rewrite, and is the single point where versions get bumped. One edge-case bug (CRLF line endings, BOM, trailing whitespace, an unusual quote style sneaking into the TOML) wedges every future cut.The script was smoke-tested by hand during the Stage 7 migration (release happy path, hotfix happy path, malformed
versionNamerejection with file-unchanged assertion, missing/invalid--moderejection, trailing-newline preservation), but those tests were never committed. They will silently regress on the next edit.What's needed
Add
.github/scripts/bump_version_test.sh(bash or bats) covering at least:--mode=releasehappy path (e.g.1.5.0 / 42 → 1.6.0 / 43).--mode=hotfixhappy path (1.6.0 / 43 → 1.6.1 / 44).--modeand invalid--mode=<other>are rejected with a non-zero exit and a usage message.versionName(e.g."1.5") is rejected and the input file is left byte-identical.\nretains the\n; file ending without\nretains no\n.Wire the test into CI so it runs on every PR that touches
.github/scripts/**. Easiest path: add a job (or a step inpr_guard.yml) gated by apaths:filter on.github/scripts/**.References
.github/scripts/bump_version.sh.documentation/release-flow.md§4.1, §4.2 — TOML format and bump rules the script implements.