fix(clusters): hide overlapping version tags in the version picker#1532
Merged
Conversation
The HarperVersions endpoint can return the same version under more than one tag (e.g. 5.1.21 as both stable and next). The cluster version picker mapped the raw list straight through, so it offered the same version twice — and used the version string as the React key, so the duplicates collided. Dedupe in the query itself so both the create and edit flows are covered (the edit-only memo in upsert/index.tsx skips its own filtering when creating). Versions sharing a version string collapse to a single entry, keeping the most-preferred tag: stable > next > beta > alpha > anything unrecognized. Kept entries retain their original position. Closes #1531 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a deduplication mechanism for Harper versions, prioritizing tags based on a defined preference order (stable > next > beta > alpha). It includes comprehensive unit tests for the new deduplication logic. The feedback suggests removing redundant optional chaining and defensive guards when accessing the response value, as the TypeScript type system already guarantees its presence.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
… (review) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ches Adds tests that drive getHarperVersionsOptions().queryFn against a mocked apiClient (asserting the endpoint, dedupe application, and query config) and a case where a less-preferred tag arrives after a more-preferred one, bringing getHarperVersionsQuery.ts to full coverage. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
kriszyp
approved these changes
Jul 20, 2026
kriszyp
left a comment
Member
There was a problem hiding this comment.
I think I am the guilty party here, I think at some point accidentally published a release as both stable and next. Sorry about that. But thank you for adding a check for that.
…faces (review) The `as HarperVersionsResponse` cast isn't schema-backed (the endpoint's OpenAPI description is broken), so a body missing `value` throws inside the queryFn. Pin that it surfaces the error rather than swallowing it — React Query's onError toasts it and consumers null-check harperVersions?.value, so it fails safely. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Closes #1531.
The
HarperVersionsendpoint can return the same version under more than one release tag — e.g.5.1.21tagged bothstableandnext. The cluster version picker (ClusterVersion.tsx) mapped the raw list straight through, so it offered the same version twice and, because it uses the version string as the Reactkey, the duplicates also collided on their keys.Per the issue, when two entries are identical but carry different tags we should surface only the most-preferred one.
Change
Dedupe in
getHarperVersionsQuery.tsitself, so both the create and edit flows are covered (the edit-onlyuseMemoinupsert/index.tsxdoes its own version filtering but is skipped entirely when creating a new cluster).dedupeHarperVersionsByTagcollapses entries sharing a version string to a single entry.HARPER_VERSION_TAG_PREFERENCE).Mapinsertion order).HarperVersion.nametype from the incomplete'stable' | 'next' | 'current'union tostring, reflecting that the endpoint also emitsbeta/alphaand potentially unknown tags.Testing
getHarperVersionsQuery.test.tscover the exact issue example (5.1.21stable+next → only stable), the full preference order, known-beats-unknown, a lone unknown tag, order preservation, and the empty case.tsc -b,oxlint, anddprint.🤖 Generated with Claude Code