fix(lexver): parsePrefix output should always be a string-prefix of parseVersion#22
Merged
Merged
Conversation
…arseVersion
When the input has a release suffix (e.g. '1.0.0-beta',
'2025.11.15-15.42.45'), parsePrefix was skipping zero-padding the digit
components even though parseVersion pads. The result was a string that
didn't string-prefix-match the corresponding lexver:
parseVersion('1.0.0-beta') // '0001.0000.0000.0000-beta'
parsePrefix('1.0.0-beta') // '0001.0000.0000-beta' (mismatch)
This broke matchSorted's prefix-search for any user-supplied complete
version with a prerelease or build suffix — e.g.
'webi <pkg>@2025.11.15-15.42.45' would silently return no matches.
Fix: when there's a release suffix, treat the input as a complete
reference and pad digits to 4 components before appending the suffix.
Partial inputs without a suffix (e.g. '1.0' to match '0001.0000.x.y')
still skip padding as before.
c2ecf80 to
44a9a89
Compare
coolaj86
added a commit
to webinstall/webi-installers
that referenced
this pull request
May 8, 2026
Brings in webinstall/webi-build-classifier#22 — Lexver.parsePrefix now produces a true string-prefix of parseVersion when the input has a release suffix (e.g. '1.0.0-beta', '2025.11.15-15.42.45'). Effect: '/api/installers/<pkg>@<exact-prerelease-or-date-version>.sh' queries now resolve correctly. Unblocks the zig.vim alias chain, which redirects through 'vim-zig@2025.11.15-15.42.45' at install time.
coolaj86
added a commit
to webinstall/webi-installers
that referenced
this pull request
May 8, 2026
Lexver.parsePrefix now produces a true string-prefix of parseVersion when the input has a release suffix (e.g. '1.0.0-beta', '2025.11.15-15.42.45'). Unblocks pinned-version queries with a non-trivial release suffix, including the 'webi zig.vim' alias chain which redirects through 'vim-zig@2025.11.15-15.42.45' at install time. See webinstall/webi-build-classifier#22.
coolaj86
added a commit
to webinstall/webi-installers
that referenced
this pull request
May 8, 2026
Lexver.parsePrefix now produces a true string-prefix of parseVersion when the input has a release suffix (e.g. '1.0.0-beta', '2025.11.15-15.42.45'). Unblocks pinned-version queries with a non-trivial release suffix, including the 'webi zig.vim' alias chain which redirects through 'vim-zig@2025.11.15-15.42.45' at install time. See webinstall/webi-build-classifier#22.
coolaj86
added a commit
to webinstall/webi-installers
that referenced
this pull request
May 8, 2026
Lexver.parsePrefix now produces a true string-prefix of parseVersion when the input has a release suffix (e.g. '1.0.0-beta', '2025.11.15-15.42.45'). Unblocks pinned-version queries with a non-trivial release suffix, including the 'webi zig.vim' alias chain which redirects through 'vim-zig@2025.11.15-15.42.45' at install time. See webinstall/webi-build-classifier#22.
coolaj86
added a commit
to webinstall/webi-installers
that referenced
this pull request
May 8, 2026
Lexver.parsePrefix now produces a true string-prefix of parseVersion when the input has a release suffix (e.g. '1.0.0-beta', '2025.11.15-15.42.45'). Unblocks pinned-version queries with a non-trivial release suffix, including the 'webi zig.vim' alias chain which redirects through 'vim-zig@2025.11.15-15.42.45' at install time. See webinstall/webi-build-classifier#22.
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.
parsePrefix(v)must always be a string-prefix ofparseVersion(v)—matchSortedusesstartsWith. The invariant breaks when the input has a release suffix becauseparsePrefixskips zero-padding whileparseVersionpads:Fix: when there's a release suffix, treat the input as a complete version (not a partial prefix) — pad to 4 digit components before appending the suffix. Partial inputs like
1.0still skip padding.Verified for
1.0.0-beta,2025.11.15-15.42.45,1.991,1.0,v1.991.1+hotfix1— all satisfy the invariant. Existinglexver-test.jsstill passes.