Repository navigation
π fix(tag): stop suggesting prerelease tags that coerce to stable versions (#473) - #482
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. π βΉοΈ Recent review infoβοΈ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: β Files ignored due to path filters (1)
π Files selected for processing (5)
π§ Files skipped from review as they are similar to previous changes (5)
π WalkthroughWalkthrough
Changes
Sequence Diagram(s)sequenceDiagram
participant ContainersGroupedViews
participant SuggestedTagBadge
ContainersGroupedViews->>SuggestedTagBadge: pass tag=c.suggestedTag, current-tag=c.currentTag
SuggestedTagBadge-->>ContainersGroupedViews: render "Suggested" badge with tooltip
Compact metadata π₯ Pre-merge checks | β 2β Passed checks (2 passed)
β¨ Finishing Touchesπ Generate docstrings
π§ͺ Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
π§Ή Nitpick comments (1)
app/tag/suggest.ts (1)
106-128: π Maintainability & Code Quality | π΅ Trivial | β‘ Quick winDuplicated coercion-detection logic relies on an undocumented invariant.
requiredCoercionFallbackre-implements only thesemver.clean+semver.parseportion ofparse()'s fallback chain inapp/tag/index.ts, but omits thenormalizeNumericMultiSegmentTagbranch. This is currently safe only because any tag matching that branch always gets a non-emptyprereleasearray and is already rejected earlier at Line 121-124 β but that coupling isn't documented here, and ifnormalizeNumericMultiSegmentTag's pattern or behavior changes inindex.tslater, this file won't automatically stay in sync, risking reintroducing the exact class of bug (#473) this PR fixes.Consider deriving "did coercion happen" directly from the shared parsing pipeline instead of re-deriving it independently, or at minimum add a comment noting why the multi-segment branch doesn't need to be replicated here.
β»οΈ Example: expose coercion info from the shared parser instead of duplicating logic
-function requiredCoercionFallback(tag: string): boolean { - const cleaned = semver.clean(tag, { loose: true }); - return semver.parse(cleaned ?? tag) === null; -} +// NOTE: parseSemver's underlying parse() also has a `normalizeNumericMultiSegmentTag` +// branch; any tag hitting it always produces a non-empty `prerelease`, so it is +// already excluded above at the `prerelease.length > 0` check. If that branch's +// behavior changes upstream, re-verify this invariant still holds. +function requiredCoercionFallback(tag: string): boolean { + const cleaned = semver.clean(tag, { loose: true }); + return semver.parse(cleaned ?? tag) === null; +}π€ Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/tag/suggest.ts` around lines 106 - 128, The coercion check in requiredCoercionFallback duplicates part of parse()βs fallback logic and depends on an implicit prerelease invariant from isStableSemverCandidate. Update requiredCoercionFallback and isStableSemverCandidate to use the shared parsing pipeline from app/tag/index.ts (or another shared helper) so coercion detection stays in sync with parseSemver/normalizeNumericMultiSegmentTag. If you keep the current approach, add a brief comment near requiredCoercionFallback explaining why the normalizeNumericMultiSegmentTag branch does not need to be mirrored here.
π€ Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@app/tag/suggest.ts`:
- Around line 106-128: The coercion check in requiredCoercionFallback duplicates
part of parse()βs fallback logic and depends on an implicit prerelease invariant
from isStableSemverCandidate. Update requiredCoercionFallback and
isStableSemverCandidate to use the shared parsing pipeline from app/tag/index.ts
(or another shared helper) so coercion detection stays in sync with
parseSemver/normalizeNumericMultiSegmentTag. If you keep the current approach,
add a brief comment near requiredCoercionFallback explaining why the
normalizeNumericMultiSegmentTag branch does not need to be mirrored here.
βΉοΈ Review info
βοΈ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 89aaa60b-e1f0-4cd5-bb4a-646e646b079f
β Files ignored due to path filters (1)
CHANGELOG.mdis excluded by!CHANGELOG.md
π Files selected for processing (5)
app/tag/suggest.test.tsapp/tag/suggest.tsapp/watchers/providers/docker/image-comparison.test.tsui/src/components/containers/ContainersGroupedViews.vueui/tests/components/containers/ContainersGroupedViews.spec.ts
d1a7297 to
23f57d1
Compare
|
Added the invariant comment on requiredCoercionFallback explaining why the normalizeNumericMultiSegmentTag branch doesn't need mirroring here (any tag it rewrites comes back with a non-empty prerelease array and dies at the prerelease check first). |
biggest-littlest
left a comment
There was a problem hiding this comment.
LGTM. Round-trip coercion guard is the right shape β keeps bare 2-part stables while killing keyword-glued prereleases.
ALARGECOMPANY
left a comment
There was a problem hiding this comment.
Approving β verified against the reporter's registry data, digest behavior unchanged.
β¦sions (#473) - π fix(tag): reject suggest() candidates that needed lossy semver coercion unless the raw tag is bare-numeric β PEP 440 nightlies (e.g. HA 2026.8.0.devYYYYMMDDHHMM) no longer masquerade as stable pin hints - π fix(ui): render the containers-table suggested-tag hint through SuggestedTagBadge (labeled + tooltip) instead of a raw unlabeled string beside the Digest/NEW badges - β test: #473 regression coverage (HA nightly scheme, PEP 440 post/dev, CalVer and OS-suffix rejection, badge rendering)
c21d7df
23f57d1 to
c21d7df
Compare
biggest-littlest
left a comment
There was a problem hiding this comment.
Re-approving after the rebase onto the merged #481 β CHANGELOG resolution only, code unchanged.
ALARGECOMPANY
left a comment
There was a problem hiding this comment.
Re-approving post-rebase, gate green.
Fixes the suggested-tag mislabel from discussion #473.
A Home Assistant
latestcontainer with a digest update showed the digest correctly but labeled it with an unrelated dev tag (2026.8.0.dev202607050315). Root cause:suggest()accepted any tag thatsemver.coerce()could mangle into a version β PEP 440-style tags like2026.8.0.dev202607050315coerce to a "stable"2026.8.0, sail past the prerelease check, and win the sort. The oldPRERELEASE_LABEL_PATTERNguard missed them because PEP 440 glues thedevkeyword straight onto the digits with no separator.The fix replaces the pattern denylist with a structural guard: if a candidate tag only parses via the lossy
coerce()fallback, it's rejected unless the raw tag is a bare numeric version (v?X,v?X.Y,v?X.Y.Z). That keeps legitimate 1- and 2-part stable tags (13.4,v2) suggestible while shutting out every keyword-glued prerelease format, not just a hard-coded list.UI side: the grouped containers view rendered the suggested tag as a raw span; it now uses
SuggestedTagBadgelike the other views, so suggested tags get consistent treatment there.Gate: app + UI suites green at 100% coverage, build/typecheck/biome clean, e2e + playwright via pre-push hook. Verified against the real registry data from the report (Docker Hub + ghcr digest tables are byte-identical β the digest shown was always correct; only the label was wrong).
π Fixed
2026.8.0.dev...) no longer get mis-ranked ahead of the real stable tag (discussion#473).semver.coerce()βs lossy fallback (requiredCoercionFallback), unless the raw tag matches a bare numeric form (v?X,v?X.Y, orv?X.Y.Z).normalizeNumericMultiSegmentTagbranch does not need a mirrored guard inrequiredCoercionFallback.SuggestedTagBadge, not as unlabeled text.π§ Changed
app/tag/suggeststability eligibility: removed the prerelease denylist approach and replaced it with structural checks tied to whether coercion fallback was required, while still requiringparse()to produce no prerelease parts.ui/src/components/containers/ContainersGroupedViews.vueto render suggested tags usingSuggestedTagBadgein the βUpdate stateβ cell.β¨ Added
app/tag/suggest.test.tswith regression/edge-case coverage for#473and additional tag-format handling (rejections for dev/post-release suffixes, CalVer-like formats, coercion-lossy OS-variants; acceptances for bare numeric formats and stable build metadata; and semver tie-breaking behavior).app/watchers/providers/docker/image-comparison.test.tscoverage ensuring the digest-watch flow proposes the correct stable tag alongside a PEP 440 nightly/dev tag without disrupting digest comparison logic.ui/tests/components/containers/ContainersGroupedViews.spec.tsto:suggested-tag-badgerenders when fixtures have nosuggestedTag.#473regression validating the badge presence and that the raw suggested tag string is not shown as plain text.