semver validator parity: vv1.2.3 accepted by Go DetermineVersion, rejected by bash semver_validate #617
Labels
No labels
bump
major
bump
minor
bump
patch
kind/bug
kind/chore
kind/docs
kind/feature
priority/critical
priority/high
priority/low
priority/medium
size/L
size/M
size/S
size/XL
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
frankenbit/release-toolkit#617
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
The bash and Go
--target-versionvalidators disagree on a doubledvprefix.Why
internal/semver's parser strips a leadingvitself:DetermineVersion(internal/prep/version.go:53) then appliesstrings.TrimPrefix(in.TargetVersion, "v")before calling it, so the two strips compose andvv1.2.3survives. bash'ssemver_parse(scripts/lib/semver.sh:36) does a single${input#v}followed by a strict anchored regex, so it rejects.Consequence:
rt prep --target-version vv1.2.3proceeds and cuts1.2.3;release-prep.sh --target-version vv1.2.3exits 1 withinvalid --target-version. Same input, one implementation cuts a release and the other refuses.How it surfaced
Found during review of #616 (site 4a), in a differential sweep of 12,221 generated version strings through both sides' predicates. It was the only accept/reject divergence in the corpus — and there were zero divergences on the prerelease-vs-stable mode question that #616 introduced.
This is pre-existing and was correctly out of scope for #616 —
internal/prep/version.go,internal/semver/*.goandscripts/lib/semver.share all untouched by that diff. Filing rather than leaving it in a review comment because #616 makes the version-string predicate load-bearing in a new place (isPrereleaseCutnow reads it too), so the next person working this area should find it already written down.Reproduce
Acceptance criteria
vv1.2.3is not a version anyone means to typevv-prefixed input so the parity cannot silently re-openTrimPrefixat the call site is redundant given the parser already strips (removing it would fix this by construction rather than by a second check)Not in scope
Whether the parser should accept a bare leading
vat all. That is established behaviour with other callers; this issue is only about the two strips composing.Found by Surveyor during review of #616.
Implementation closeout
The doubled-prefix validator fix landed in rt#1016 at merge commit
59dc767229ac0712188130128691ef2ea0c403d6on current main. The implementation passes the established semver parser through unchanged, accepts one leadingv, rejectsvv, and carries the differential and TrimPrefix-removal controls. Lookout review 6077 was exact-head-bound and official; Forgejo CI was 25/25 successful.Refs
frankenbit/release-toolkit#1016.git commit -qmfalse-positives on the QM vocabulary entry #897Pullings sequencing note: rt#617 is priority/low and follows rt#897 (priority/medium) on the Carpenter lane. Do not start parallel edits; return here after #897 is complete. The earlier direct dispatch is held by this ordering.
Closeout
All four acceptance criteria are discharged by merged rt#1016: reject doubled prefixes, preserve single-v behavior, exercise the differential
vvarm, and remove the redundant caller normalization. No bare ACs remain.