Skip to content

[deckhouse-cli] fix sequential download when 0 major#412

Merged
ldmonster merged 2 commits into
mainfrom
fix/sequential-download
Jul 22, 2026
Merged

[deckhouse-cli] fix sequential download when 0 major#412
ldmonster merged 2 commits into
mainfrom
fix/sequential-download

Conversation

@ldmonster

@ldmonster ldmonster commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

What

d8 mirror pull silently skipped intermediate minor versions of 0.x modules when a bare (operator-less) version was passed to --include-module.

For a module on the 0.x line:

--include-module alb@0.4.0

only 0.4.4 (plus whatever the release channels currently point at, e.g. 0.7.2) was pulled — 0.5.* and 0.6.* were dropped, leaving gaps that block Deckhouse's one-minor-at-a-time upgrades. Modules on >=1.0 (console, gpu) were unaffected, which made the behaviour look random.

Why

A bare version was expanded by prepending a caret (0.4.0^0.4.0). Masterminds/semver special-cases the 0.x major line for caret:

Input Caret expands to Captures
^1.52.0 >=1.52.0 <2.0.0 whole 1.x
^0.4.0 >=0.4.0 <0.5.0 only 0.4.x ⚠️

So for a 0.x module the caret locked the minor, not the major, and every intermediate minor fell outside the constraint. >=1.0 modules happened to work because there the caret locks the major.

Fix

Bare versions are now expanded to an explicit range >=X.Y.Z <(major+1).0.0, treating major 0 like any other major line:

Input Now expands to Captures
alb@0.4.0 >=0.4.0 <1.0.0 whole 0.x from 0.4 up ✅
console@1.52.0 >=1.52.0 <2.0.0 whole 1.x (byte-identical to old caret)

The synthesized >= lower bound is deliberately not registered as an inclusive anchor — a bare version is not an explicit boundary, so the "latest-patch-per-minor" collapse still applies (preserves the issue #220 behaviour). --include-platform shares the same parser; since platform versions are always >=1.0, its behaviour is unchanged.

Changes

  • internal/mirror/modules/constraints.go — new NewImplicitVersionConstraint that builds the caret-free range and clears anchors.
  • internal/mirror/modules/filter.goparseVersionConstraint routes bare versions through the new helper instead of prepending ^; updated ParseVersionConstraint doc.
  • internal/mirror/cmd/pull/flags/flags.go — corrected the --include-module / --include-platform help (the old text claimed "implicit caret"), added a 0.x example and a shell-quoting note for >=/<= (the shell eats the >/< redirection metacharacters, so those operators must be quoted; the bare-version form needs no quoting).
  • internal/mirror/modules/filter_test.go — regression test TestFilter_BareVersionConstraint covering the 0.x fix and confirming the 1.x path is unchanged.

Behaviour change / compatibility

  • 0.x modules: bare version now spans the whole 0.x line (the bug fix).
  • >=1.0 modules: no change — bare version resolves to the same set as before.
  • Explicit ^, ~, >=, <=, = constraints are untouched. Users who still want the old "single 0.x minor" behaviour can pass alb@~0.4.0.

Testing

  • go test ./internal/mirror/modules/ ./internal/mirror/cmd/pull/ — pass (new regression test + all existing caret/tilde/range/anchor cases green).
  • go build ./internal/mirror/... and go vet — clean.

Reproduction / verification

Available alb versions: v0.4.2, v0.4.4, v0.5.3, v0.6.1, v0.7.2

Command Before After
--include-module alb@0.4.0 0.4.4 (+ channel snapshots) 0.4.4, 0.5.3, 0.6.1, 0.7.2

Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
@ldmonster ldmonster self-assigned this Jul 21, 2026
@ldmonster ldmonster added the bug Something isn't working label Jul 21, 2026
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
@ldmonster
ldmonster merged commit 5bc2085 into main Jul 22, 2026
5 checks passed
@ldmonster
ldmonster deleted the fix/sequential-download branch July 22, 2026 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants