Repository navigation
fix(lint): accept current composable channels, and warn on newer versions - #325
pjcdawkins wants to merge 6 commits into
Conversation
…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>
There was a problem hiding this comment.
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 remainingcomposable:25.11uses in integration-tests feedlist/xdebug detection, not the linter. isNextVersionchecksCompareVersions(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.Supportedis non-empty, so types like elasticsearch that have only retired versions keep the 'not supported' error. gen.gosortVersionsDescendingcallsCompareVersions(b, a), which sorts newest-first just like the oldsort.Slicewithcompare(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
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>
There was a problem hiding this comment.
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.055andcomposable:26.5fail the digit or leading-zero checks, whilephp:8.6,php:9.0andcomposable:26.11still pass. newestParts[i]cannot go out of range, because the earlier length check guaranteeslen(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
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>
|
📋 PR Summary This PR makes Changes
|
There was a problem hiding this comment.
Warning
Changes suggested — 🟡 2 warnings
🔁 Incremental · 2 files reviewed · f9e26d8..e891010
Verification
python:4.0against newest3.14now returns true: the major part differs by 1 and is decided before the minor part is compared.php:8.44andphp:8.18against8.5still fail, because the step is greater than 12;php:8.06andphp:08.6still fail the leading-zero check.composable:26.055against26.05fails: the leading zero is allowed because newest has one, but 55 - 5 is greater than 12.strconv.Atoioverflow on99999999999999999999.0returns 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
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>
There was a problem hiding this comment.
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.latestandphp:9.0000are rejected even though the major part differs. - When newest is
26.05, the newlen(p) != len(n)check rejects26.6and26.011but still accepts26.08and26.11. - A newest part of exactly
"0"(length 1) falls into the else branch, so00is still rejected and1is 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
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>
There was a problem hiding this comment.
Warning
Changes suggested — 🟡 1 warning
🔁 Incremental · 2 files reviewed · 9f19377..7b2e61d
Verification
- With newest
26.11,27.05now passes, because05and11have the same width; the newnixos:27.05case covers this. - With newest
26.05,26.6and26.011are still rejected, because05is padded and the widths differ. - With newest
8.5,8.06and08.6are still rejected, because the padded part invis wider than newest's one-digit part. python:4.0andphp:8.10are still accepted, because neither single-digit0nor10counts 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
CLI buildsBuilt from 33e9ed5 (merged into the base branch). Downloads need a GitHub login, and expire after 7 days.
Or download one with the GitHub CLI, e.g.: gh run download 44732770829 -R upsun/cli -n cli-linux-amd64
chmod +x upsun
./upsun --versionOn macOS, if you downloaded it with a browser, remove the quarantine attribute before running it: |
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>
lintonly acceptedcomposable:25.11, which was hardcoded because meta.upsun.com/images does not list the composable image. It rejected the current channel, 26.05.make update-registry, with the other images. The hardcoded fallback andregistry.ChannelStableare removed. The registry now lists 26.05 as supported, and 25.11 and earlier as retired (a warning).php:84,php:8.44orphp:8.06for 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 asclickhouse:26.10). Types without supported versions are unchanged.compareVersionsmoved fromgen.gotoregistry.CompareVersions.🤖 Generated with Claude Code