Skip to content

refactor: remove string versioning support - #85

Merged
dwillson merged 1 commit into
mainfrom
isaacchung/cpp-410-design-proposal-remove-string-versioning-support-only-date
Apr 17, 2026
Merged

dwillson merged 1 commit into
mainfrom
isaacchung/cpp-410-design-proposal-remove-string-versioning-support-only-date

Conversation

@ichung08

@ichung08 ichung08 commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Description

Removes arbitrary string versioning support (VersionTypeString, NewStringVersion()) from Epoch.
Previously, NewVersion() silently fell back to creating a string-typed version for any input that
wasn't a valid date or semver, which enabled ambiguous parsing and lexicographic ordering
comparisons.

Now, NewVersion() returns an error for non-date/non-semver values, enforcing strict version
format validation at parse time. This is a breaking change.

Changes:

  • Removed VersionTypeString from the VersionType enum
  • Removed NewStringVersion(), WithStringVersions(), WithStrings(), and StringVersion() functions
  • Removed VersionFormatString constant
  • NewVersion() now returns an error instead of falling back to string for invalid formats
  • Simplified isValidVersionFormat() to only accept date (YYYY-MM-DD) and semver (X.Y.Z / X.Y)
    formats
  • Removed lexicographic string comparison fallback from Compare()

🎟 Issue(s)

CPP-410: Design proposal: remove string versioning, support only date + semver

🧪 Functional Testing

  • All existing unit and integration tests pass after updating test expectations
  • NewVersion("alpha") now returns an error with message "invalid version format 'alpha': must be
    a date (YYYY-MM-DD) or semver (X.Y.Z or X.Y)"
  • NewVersion("2024-01-01") and NewVersion("1.0.0") continue to work as expected
  • Middleware waterfall logic correctly rejects non-date/non-semver version strings

📸 Screenshots

📋 Checklist

  • Added/updated applicable tests
  • Added/updated examples in the examples/ directory
  • Updated any related documentation

@ichung08 ichung08 self-assigned this Mar 24, 2026
@ichung08
ichung08 requested a review from a team as a code owner March 24, 2026 21:54
@dwillson
dwillson merged commit f5e44bd into main Apr 17, 2026
2 checks passed
@dwillson
dwillson deleted the isaacchung/cpp-410-design-proposal-remove-string-versioning-support-only-date branch April 17, 2026 16:47
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.

2 participants