Switch to semantic versioning, add --version - #56
Merged
Conversation
The binary had no idea what version it was: no --version flag and no version constant anywhere in src/. The release number was invented inside CI from the build date and github.run_number, so it existed only in the git tag and the asset names, and a bug reporter could not say which build they were running. That scheme was also unsound. github.run_number resets when a workflow is recreated, which already happened here: 2026.01.31.204 was published before 2026.01.31.3, so a newer release carries a lower number and no ordering comparison can work. - src/version.py holds VERSION as the single source of truth - pyproject.toml declares the version dynamic instead of duplicating it - --version prints it, and works with no subcommand and outside a game directory - CI reads the version from src/version.py, uses it for the tag, the release name and the asset names, and skips the release entirely when that tag already exists The last point also fixes releases being cut on every push to master, including commits that change nothing a user can see. Existing tags are left alone. Reconstructing the history against the nine published releases puts the current state at 1.3.2, so this ships as 1.4.0 for the new flag. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #56 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 5 6 +1
Lines 584 587 +3
Branches 98 98
=========================================
+ Hits 584 587 +3 ☔ View full report in Codecov by Harness. |
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.
The binary had no idea what version it was — no
--versionflag, no version constant anywhere insrc/. The release number was invented inside CI from the build date andgithub.run_number, so it lived only in the git tag and the asset names, and a bug reporter had no way to tell you which build they were on.The date scheme was also unsound:
github.run_numberresets when a workflow is recreated, and that already happened here.No ordering comparison can work against that history.
Changes
src/version.pyholdsVERSIONas the single source of truth.pyproject.tomldeclaresdynamic = ["version"]rather than keeping a second copy that drifts — it still said1.0.--versionprintssnapjaw <VERSION>, and works both with no subcommand (despitesubparsers(required=True)) and outside a game directory, since argparse's version action exits during parsing, beforegameversion.resolveruns. All three properties are pinned by tests.src/version.pyand uses it for the tag, the release name and the asset names.VERSIONbuilds but publishes nothing. Today every push to master cuts a release, including commits that change nothing a user can see — three of the nine existing releases are CI-only changes.Version number
Existing tags are left alone; rewriting nine published releases would break the
/releases/latestredirect and any saved links. The number below is reconstructed only to pick a sane starting point.2026.01.31.2042026.01.31.32026.01.31.52026.02.14.92026.02.14.112026.04.25.14--game-version2026.08.30.162026.08.30.182026.08.30.20Hence 1.4.0 for the new flag.
What merging this does
It publishes release
1.4.0. The release job cannot be exercised by PR CI — it is gated onif: github.event_name == 'push'— so the tag lookup and the new naming first run on merge. The lookup usesgit ls-remote --exit-codeand distinguishes "no such tag" (exit 2) from a genuine failure, so a network or auth problem fails the job rather than silently skipping the release. Barepythonis used to read the version and is present on the runner image viapython-is-python3.🤖 Generated with Claude Code