Skip to content

Add an opt-in strict SemVer constructor - #215

Closed
sb123sb123 wants to merge 1 commit into
hashicorp:mainfrom
sb123sb123:codex/issue-106-strict-semver
Closed

sb123sb123 wants to merge 1 commit into
hashicorp:mainfrom
sb123sb123:codex/issue-106-strict-semver

Conversation

@sb123sb123

Copy link
Copy Markdown

Description

Issue #106 documents that the existing compatibility-oriented parsers accept strings that are not valid SemVer 2.0.0, including leading-zero numeric identifiers, missing or extra numeric components, and malformed prerelease or build metadata.

This adds an opt-in NewStrictSemver constructor that validates the SemVer 2.0.0 grammar before using the existing parser. NewVersion and NewSemver remain unchanged, so callers that depend on their broader acceptance set are unaffected.

Related Issue

Closes #106

How Has This Been Tested?

  • git diff --check — passed.
  • gofmt -d on the changed Go files, streamed from the SSH checkout — passed with no diff.
  • The new table-driven tests cover valid SemVer examples, all issue Invalid semver versions are treated as "valid" #106 invalid examples, and preservation of legacy NewVersion acceptance.
  • go test ./... — not run on the remote checkout: Go and gofmt are unavailable there, and the remote G: volume has under 300 MB free. No toolchain or module download was attempted. The repository GitHub Actions workflow will provide the Go test matrix for this PR.

Contributor Checklist

  • LLM Usage I reviewed the change and followed the project's AI usage guide.

AI assistance: OpenAI Codex (GPT-5.6 Luna)

@sb123sb123
sb123sb123 requested a review from a team as a code owner September 22, 2026 05:08
@hashicorp-cla-app

Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

1 similar comment
@hashicorp-cla-app

Copy link
Copy Markdown

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@sb123sb123
sb123sb123 force-pushed the codex/issue-106-strict-semver branch from 7a5feee to b2b3bc1 Compare September 22, 2026 05:11
@jrasell

jrasell commented Sep 22, 2026

Copy link
Copy Markdown
Member

I'm closing this PR as it's coming from an account that looks highly automated and the PR description itself looks LLM generated.

@jrasell jrasell closed this Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid semver versions are treated as "valid"

2 participants