Skip to content

Preserve four-component MySQL versions when unpacking - #156

Merged
renecannao merged 2 commits into
masterfrom
fix/mysql-four-part-unpack
Nov 27, 2026
Merged

renecannao merged 2 commits into
masterfrom
fix/mysql-four-part-unpack

Conversation

@renecannao

@renecannao renecannao commented Nov 27, 2026 •

Copy link
Copy Markdown

Unpacking mysql-8.4.13.1 into a binary directory that already contains 8.4.13 fails because both archives resolve to the same destination.

Detect the version from the archive basename and retain its fourth component. Accept that component when parsing installed versions, and include it in version sorting so a selector such as 8.4 can find the latest installed correction release.

The regression reproduces the directory collision before the fix. With the fix, the CLI unpacks synthetic .tar.xz archives for 8.4.13, 8.4.13.1, 9.7.4.1, and 26.10.0.1 side by side. The common, ops, and cmd unit suites pass with the normal CI skip for live archive downloads.

Closes #155.

Summary by CodeRabbit

  • Bug Fixes
    • Version parsing and ordering now support versions with three or four numeric components, including correct comparisons when versions have different numbers of components.
    • Archive unpacking now recognizes version numbers with three or more components from the archive filename, including archives in versioned download folders.
    • Latest-version selection now handles version names with one or two numeric suffix components and requires an exact numeric version prefix.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

  • Run on-demand review

This review includes 5 billable files and costs up to $1.25.

Or wait 1 minute for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 64a96040-a73e-4118-ad05-3b94339c6b72
Commits

Reviewing files that changed from the base of the PR and between 7c54436 and f653b7d.

Files selected for processing: 5

  • common/checks.go
  • common/strutils.go
  • common/version_test.go
  • ops/unpack.go
  • ops/unpack_test.go

No actionable comments were generated in the recent review.

Walkthrough

Version handling now accepts and compares versions with four numeric components. Latest-version matching supports one or two numeric suffix components. Tarball unpacking detects versions from the basename and validates the complete version.

Changes: Version Handling

Layer / File(s) Summary
Parse and compare version components
common/checks.go, common/strutils.go, common/version_test.go
VersionToList accepts three or four numeric components. SortVersionsSubset compares all parsed components. Tests cover parsing and sorting four-component versions.
Select and unpack full versions
common/strutils.go, ops/unpack.go, ops/unpack_test.go
LatestVersion accepts directories with one or two numeric suffix components after the requested pattern. UnpackTarball detects the version in the tarball basename and validates it with VersionToList. Tests cover extraction of distinct versions and latest-version selection.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: datacharmer

Merge Risk: Minimal · previous review 7c544

The change lets four-component MySQL versions such as 8.4.13.1 unpack into their own directories and be found as the latest release for a selector like 8.4. The new tests cover distinct unpacking, version sorting, and latest-version selection. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states the primary change: four-component MySQL versions are kept distinct when unpacking. The changeset adds four-component parsing in VersionToList, changes tarball version detection in op…
Linked Issues check Passed Issue #155 requires that unpacking MySQL 8.4.13.1, 9.7.4.1, and 26.10.0.1 use destination directories distinct from their three-component counterparts. At the reviewed head, ops/unpack.go (UnpackTarba…
Out of Scope Changes check Passed The changes fall into three groups. (1) ops/unpack.go: version detection from the basename and the VersionToList validation call. These implement the issue's directory-collision requirement directly. …
Full details: Title check

Explanation

The title states the primary change: four-component MySQL versions are kept distinct when unpacking. The changeset adds four-component parsing in VersionToList, changes tarball version detection in ops/unpack.go, updates sorting and LatestVersion, and adds tests for distinct MySQL versions such as 8.4.13 and 8.4.13.1. The title is short, specific, and matches the linked issue #155 and the PR objectives.

Full details: Linked Issues check

Explanation

Issue #155 requires that unpacking MySQL 8.4.13.1, 9.7.4.1, and 26.10.0.1 use destination directories distinct from their three-component counterparts. At the reviewed head, ops/unpack.go (UnpackTarball) detects the version from the tarball basename with the pattern \d+\.\d+\.\d+(?:\.\d+)*. It keeps the fourth component, so an archive named mysql-8.4.13.1-... yields Version 8.4.13.1. The destination is then path.Join(Basedir, Prefix+Version), which is 8.4.13.1, not 8.4.13. The rename step moves the extracted directory to that destination. The validation call now uses common.VersionToList, which the PR summary says accepts four components. The PR summary also reports that ops/unpack_test.go adds TestUnpackDistinctMySQLVersions. That test checks side-by-side unpacking of 8.4.13, 8.4.13.1, 9.7.4.1, and 26.10.0.1, which covers the issue's three affected releases. The PR also makes installed-version parsing and sorting accept the fourth component, so selector 8.4 can find 8.4.13.1. This is a stated PR objective that supports the issue. Limitation: the diff tool was unavailable and the common/checks.go body was truncated, so the VersionToList behavior rests on the PR summary and the test description, not on source I read directly.

Full details: Out of Scope Changes check

Explanation

The changes fall into three groups. (1) ops/unpack.go: version detection from the basename and the VersionToList validation call. These implement the issue's directory-collision requirement directly. (2) common/checks.go and common/strutils.go: VersionToList accepts three or four numeric components, VersionToPort is documented as unchanged by a fourth component, SortVersionsSubset compares all components, and LatestVersion accepts one or two numeric suffixes with an anchored digits.digits pattern. These support the PR objective that installed four-component versions are parsed and sorted, so that selector 8.4 finds 8.4.13.1. Without them, unpacked four-component directories would not be recognized by version lookup. (3) Tests in common/version_test.go and ops/unpack_test.go. These cover the changed behavior. No change was found that is unconnected to unpacking or version handling. Limitation: the diff tool was unavailable, so the changed hunks were assessed from the PR summary and the head file read of ops/unpack.go only.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks each dotted string,
And sorts the parts from small to large.
Four numbers fit in line and name,
Each archive keeps its proper range.
The newest branch is found with care,
Then hops away through springtime air.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4a254418-a918-4eec-9dbd-292d41231804
Commits

Reviewing files that changed from the base of the PR and between 41a43e0 and 7c54436.

Files selected for processing: 5

  • common/checks.go
  • common/strutils.go
  • common/version_test.go
  • ops/unpack.go
  • ops/unpack_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@renecannao
renecannao marked this pull request as ready for review November 27, 2026 06:36
@renecannao
renecannao merged commit 9b8b626 into master Nov 27, 2026
62 checks passed
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.

dbdeployer confuses 8.4.13.1 for 8.4.13 (idem 9.7.4.1 and 26.10.0.1).

1 participant