Print the raw version string for -dumpversion - #161
Merged
Merged
Conversation
The -dumpversion option exists so that scripts can read Graphtage's version from STDOUT. It built its output by joining over version.__version__, which was once a tuple of version components. That attribute is now the string "0.3.1", so the join walked its characters and separated each one, printing "0 . 3 . 1". Any script parsing that output saw a value it could not use as a version. Print version.VERSION_STRING instead. That is the spelling the --version option already uses, and its name states the type the option needs, so the two stay consistent and a future change to the version's representation cannot silently reintroduce the same failure. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GypKU5KdLfs2Cf8kS2TzJa
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.
Closes #147
-dumpversionwrites Graphtage's version to STDOUT so that scripts can consume it. It built that output with' '.join(map(str, version.__version__)).version.__version__used to be a tuple of version components, but it is now the string"0.3.1", so the join walked the string's characters and printed0 . 3 . 1.The fix prints
version.VERSION_STRING, the same spelling the--versionoption already uses. Its name states the type the option needs, so the two stay consistent and a future change to how the version is represented cannot silently reintroduce the same failure.The regression test lives in
test/test_main.pyalongside the other in-process CLI tests.main()reaches this branch through the builtinexit(), which raisesSystemExitrather than returning an exit status, so the test asserts on the exception's code instead of using the existingrun_graphtagehelper.Before:
After:
Validation
uv run --frozen --extra dev ruff check graphtage test docs bindist— passesuv run --frozen --extra dev pytest— 141 passeduv run --frozen --extra dev make -C docs html SPHINXOPTS="-W --keep-going"— build succeededuv lock --check— fails in my environment because of a localexclude-newersetting; it fails the same way on an unmodified checkout ofmaster, and this change touches no dependencies, souv.lockis unchanged.The test was run against the unfixed code first and failed with
AssertionError: '0.3.1' != '0 . 3 . 1', then passed after the one-line fix.🤖 Generated with Claude Code
https://claude.ai/code/session_01GypKU5KdLfs2Cf8kS2TzJa