Skip to content

fix(lint): accept current composable channels, and warn on newer versions - #325

Open
pjcdawkins wants to merge 6 commits into
mainfrom
claude/cli-composable-version-support-9f0367
Open

pjcdawkins wants to merge 6 commits into
mainfrom
claude/cli-composable-version-support-9f0367

Conversation

@pjcdawkins

@pjcdawkins pjcdawkins commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

lint only accepted composable:25.11, which was hardcoded because meta.upsun.com/images does not list the composable image. It rejected the current channel, 26.05.

  • Composable channels are now generated from meta.upsun.com/composable by make update-registry, with the other images. The hardcoded fallback and registry.ChannelStable are removed. The registry now lists 26.05 as supported, and 25.11 and earlier as retired (a warning).
  • A version that could be newer than all known versions of a type is a warning ("unknown version '26.11' of type 'composable' (the newest known is 26.05)") instead of an error, so a CLI built before a version is added to the registry still accepts it. To keep typos as errors (e.g. php:84, php:8.44 or php:8.06 for 8.4), the version must have the same number of numeric parts as the newest known one, zero-padded parts as wide as its parts, and, at the first part that differs, be at most 1 higher for the major part or 12 higher for others (enough for month-numbered versions such as clickhouse:26.10). Types without supported versions are unchanged.
  • compareVersions moved from gen.go to registry.CompareVersions.

🤖 Generated with Claude Code

…ions

The composable image's only accepted channel was hardcoded (25.11), as
meta.upsun.com/images does not list it, so lint rejected the current
channel, 26.05.

- Generate the composable channels from meta.upsun.com/composable, with
  the other images, and remove the hardcoded fallback and ChannelStable.
- Report a version newer than all known versions of a type as a warning
  instead of an error, so that a CLI built before a new version is added
  to the registry still accepts it. To keep typos as errors (e.g. "84"
  for "8.4"), the version must have the same number of parts as the
  newest known one, and a major version at most one higher.
- Move compareVersions from gen.go to registry.CompareVersions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@upsun-dispatch upsun-dispatch Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Reviewed — No blocking findings · 🔵 1 minor point

🔍 Full review · 13 files reviewed · 37b2b68

Verification
  • No Go code in the merged tree still references the removed registry.ChannelStable. The remaining composable:25.11 uses in integration-tests feed list/xdebug detection, not the linter.
  • isNextVersion checks CompareVersions(v, newest) > 0, so an older unknown channel (composable:25.08) is still an error and does not become a warning.
  • The new warning branch runs only when Versions.Supported is non-empty, so types like elasticsearch that have only retired versions keep the 'not supported' error.
  • gen.go sortVersionsDescending calls CompareVersions(b, a), which sorts newest-first just like the old sort.Slice with compare(i, j) > 0.

New table tests cover the newer-version warning and the error cases (TestCheckTypes_NewerVersion), plus TestCompareVersions and TestRegistry_Composable. The lint fixtures were updated to 26.05. These run in the Go test job (make test-go). No test checks that gen.go parses the meta.upsun.com/composable response correctly.


Review 1 of 10 for this pull request · View the full run

Comment thread pkg/lint/types.go Resolved
A version newer than the known ones was a warning if only its major part
was close, so typos such as php:8.44 or composable:26.055, and
zero-padded parts such as php:08.6, were warnings instead of errors.
Parts after the first must now have as many digits as in the newest
known version, and the major part no leading zero. A version such as
php:8.10 after 8.5 is an error again, until the registry is updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@upsun-dispatch upsun-dispatch Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Changes suggested — 🟡 1 warning

🔁 Incremental · 2 files reviewed · 37b2b68..f9e26d8

Verification
  • In line 159, && binds tighter than ||, so the two clauses group as intended. The leading-zero check applies only to the major part, and the digit-count check only to later parts.
  • The new test cases hold under the new rule: php:8.44, php:8.06, php:08.6, composable:26.055 and composable:26.5 fail the digit or leading-zero checks, while php:8.6, php:9.0 and composable:26.11 still pass.
  • newestParts[i] cannot go out of range, because the earlier length check guarantees len(vParts) == len(newestParts).

This change adds table cases to TestCheckTypes_NewerVersion in pkg/lint/types_test.go for the digit and leading-zero typos, and they run under make test-go. No test covers a major bump after a two-digit minor (e.g. python:4.0 after 3.14), or a minor that gains a digit.


Review 2 of 10 for this pull request · View the full run

Comment thread pkg/lint/types.go Resolved
Requiring parts after the first to have as many digits as the newest
known version rejected real next releases, such as python:4.0 after
3.14, or clickhouse:26.10 after 26.8.

Instead, at the first part that differs from the newest known version,
the version must be at most one higher for the major part, and at most
12 higher for others (enough for month-numbered versions). Leading zeros
are only allowed where the newest version has them. Typos such as
php:8.44, php:8.06 and composable:26.055 are still errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@upsun-dispatch

upsun-dispatch Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

📋 PR Summary

This PR makes lint accept the current composable channel (26.05). Composable channels are now generated from meta.upsun.com/composable instead of being hardcoded, and the hardcoded fallback and registry.ChannelStable are removed. A version newer than every known version of a type is now a warning rather than an error, but only if it looks like a plausible next version, so typos are still errors. The latest push shortens that warning to "unknown version 'X' of type 'T' (the newest known is N)".

Changes
Layer / File(s) Summary
Lint version checks
pkg/lint/types.go Shows a warning instead of an error for a plausible next version, decided by isNextVersion against the newest known version. The latest push shortens the warning text to 'unknown version ... (the newest known is ...)'.
pkg/lint/types_test.go Adds cases for newer versions, typos, zero-padding and month-numbered versions, all using the new warning text.
pkg/lint/fixed_test.go Updates the tests for the new composable channels.
pkg/lint/linter_test.go Updates the tests for the new composable channels.
pkg/lint/testdata/registry.json Updates the test registry data to the new channels and versions.
Registry
pkg/registry/gen.go Generates composable channels from meta.upsun.com/composable. compareVersions moves out of this file.
pkg/registry/registry.go Removes the hardcoded composable fallback and ChannelStable. This is a breaking change for projects that import the package.
pkg/registry/registry.json Adds composable 26.05 as supported and 25.11 and earlier as retired.
pkg/registry/version.go New file with the exported CompareVersions function.
pkg/registry/version_test.go New tests for CompareVersions.
pkg/registry/registry_test.go Adds tests for the composable entries.
pkg/registry/model_test.go Removes the use of ChannelStable.
Docs
CLAUDE.md Updates the notes on the registry.

@upsun-dispatch upsun-dispatch Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Changes suggested — 🟡 2 warnings

🔁 Incremental · 2 files reviewed · f9e26d8..e891010

Verification
  • python:4.0 against newest 3.14 now returns true: the major part differs by 1 and is decided before the minor part is compared.
  • php:8.44 and php:8.18 against 8.5 still fail, because the step is greater than 12; php:8.06 and php:08.6 still fail the leading-zero check.
  • composable:26.055 against 26.05 fails: the leading zero is allowed because newest has one, but 55 - 5 is greater than 12.
  • strconv.Atoi overflow on 99999999999999999999.0 returns false, so that input is still an error.

TestCheckTypes_NewerVersion gains cases for a two-digit minor, a major after a two-digit minor, month-numbered versions, a two-digit patch, and a minor too far ahead. No case covers a malformed part after the part that differs (e.g. php:9.x), or a missing leading zero ahead of newest (e.g. composable:26.6). The repository's Go test job (make test-go) runs these tests.


Review 3 of 10 for this pull request · View the full run

Comment thread pkg/lint/types.go Resolved
Comment thread pkg/lint/types.go Resolved
isNextVersion returned at the first part that differed, so later parts
were not checked: php:9.x and composable:27.abc were warnings. It also
accepted unpadded or wider parts where the newest version is
zero-padded, such as composable:26.6 or 26.011 against 26.05.

All parts are now checked first: they must be numeric, and as wide as
the newest version's part where that is zero-padded, or else have no
leading zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@upsun-dispatch upsun-dispatch Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Changes suggested — 🟡 1 warning

🔁 Incremental · 2 files reviewed · e891010..9f19377

Verification
  • The validation loop now runs over every part before the comparison loop, so php:9.x, php:9., php:9.latest and php:9.0000 are rejected even though the major part differs.
  • When newest is 26.05, the new len(p) != len(n) check rejects 26.6 and 26.011 but still accepts 26.08 and 26.11.
  • A newest part of exactly "0" (length 1) falls into the else branch, so 00 is still rejected and 1 is still accepted.

This increment adds eight table cases to TestCheckTypes_NewerVersion in pkg/lint/types_test.go, which the make test-go step in .github/workflows/ci.yml runs. No case covers a newest version whose later part has no leading zero followed by a zero-padded next major, such as 26.11 → 27.05.


Review 4 of 10 for this pull request · View the full run

Comment thread pkg/lint/types.go Resolved
A zero-padded part was rejected when the newest version's part was not
padded, so after a registry update to composable 26.11, 27.05 would be
an error. A zero-padded part, in either version, must now be as wide as
the newest version's part.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@upsun-dispatch upsun-dispatch Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Changes suggested — 🟡 1 warning

🔁 Incremental · 2 files reviewed · 9f19377..7b2e61d

Verification
  • With newest 26.11, 27.05 now passes, because 05 and 11 have the same width; the new nixos:27.05 case covers this.
  • With newest 26.05, 26.6 and 26.011 are still rejected, because 05 is padded and the widths differ.
  • With newest 8.5, 8.06 and 08.6 are still rejected, because the padded part in v is wider than newest's one-digit part.
  • python:4.0 and php:8.10 are still accepted, because neither single-digit 0 nor 10 counts as zero-padded.

The new zero_padded_after_rollover case in TestCheckTypes_NewerVersion covers the rollover fix, and the existing padding cases still cover the rejections. No test covers a one-digit part when newest's part has two digits and no leading zero (e.g. 27.5 against 26.11). Go tests run through make test-go in CI.


Review 5 of 10 for this pull request · View the full run

Comment thread pkg/lint/types.go Resolved
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

CLI builds

Built from 33e9ed5 (merged into the base branch). Downloads need a GitHub login, and expire after 7 days.

Platform Download
linux-amd64 cli-linux-amd64
linux-arm64 cli-linux-arm64
darwin-amd64 cli-darwin-amd64
darwin-arm64 cli-darwin-arm64
windows-amd64 cli-windows-amd64

Or download one with the GitHub CLI, e.g.:

gh run download 44732770829 -R upsun/cli -n cli-linux-amd64
chmod +x upsun
./upsun --version

On macOS, if you downloaded it with a browser, remove the quarantine attribute before running it: xattr -d com.apple.quarantine upsun.

The warning for a version that could be newer than the known versions
said it was newer, which is wrong for a typo that passes the check (e.g.
composable:27.5 after 26.11). It now says the version is unknown, and
shows the newest known one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant