ci icon indicating copy to clipboard operation
ci copied to clipboard

fix: use semantic versioning for version comparisons in check-images-internal.ts

Open Copilot opened this issue 3 months ago • 3 comments

String-based version comparison is unreliable for semantic versions. For example, "v8.5.10" <= "v8.5.3" incorrectly returns true because "1" < "3" lexicographically.

Changes

  • Import @std/semver (already used elsewhere in this repo)
  • Add normalizeVersion() to strip v prefix and -enterprise suffix
  • Add versionGreaterOrEqual() and versionLessThanOrEqual() helper functions
  • Replace all three string comparisons with semver-based comparisons

Example

// Before (buggy)
if (version <= "v8.5.3" && gitRepo === "pingcap/ticdc") { ... }

// After (correct)
if (versionLessThanOrEqual(version, "v8.5.3") && gitRepo === "pingcap/ticdc") { ... }

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Nov 27 '25 07:11 Copilot