feat: hide stale tags and deprecated versions by default#2629
feat: hide stale tags and deprecated versions by default#2629ShroXd wants to merge 10 commits intonpmx-dev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds client-side controls and state to hide/show prerelease and deprecated version groups and dist-tags, implements tag sorting (priority/date with direction), introduces Changes
Possibly related issues
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/pages/package/`[[org]]/[name]/versions.vue:
- Around line 149-179: Current implementation shows deprecated entries by
default because the "Current Tags" and version-history sections don't use a
unified deprecation predicate and they render before deprecation metadata
(fullVersionMap) is available; update the filtering to use a single
isDeprecated(version) predicate that checks fullVersionMap.value (or a loaded
flag) and showDeprecated, and apply that predicate in both
tagRows/otherTagRowsAll/stableOtherTagRows and the version-history filter
(referencing tagRows, otherTagRowsAll, stableOtherTagRows, otherTagRows); also
gate rendering of the default-hidden state until fullVersionMap is loaded (e.g.
treat unknown deprecation state as not-yet-hidden) so deprecated rows remain
visible only after deprecation metadata is available or when showDeprecated is
true.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6769201e-7329-43ce-aa18-add1e452554c
📒 Files selected for processing (4)
app/pages/package/[[org]]/[name]/versions.vueapp/utils/versions.tsi18n/locales/en.jsoni18n/schema.json
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
app/pages/package/[[org]]/[name]/versions.vue (1)
157-167: Optional: simplify the date comparator.The current branch uses a sign multiplier and a manual three-way compare on ISO strings. ISO-8601 strings sort lexicographically by date, so
localeCompare(or direct subtraction ofDate.parse) reads more clearly and avoids thedir * (... ? -1 : ... ? 1 : 0)ladder.♻️ Proposed refactor
if (tagsSortMode.value === 'date') { - const dir = tagsSortOrder.value === 'desc' ? 1 : -1 - return [...rows].sort((rowA, rowB) => { - const timeA = versionTimes.value[rowA.version] ?? '' - const timeB = versionTimes.value[rowB.version] ?? '' - return dir * (timeB < timeA ? -1 : timeB > timeA ? 1 : 0) - }) + const sign = tagsSortOrder.value === 'desc' ? -1 : 1 + return [...rows].sort((rowA, rowB) => { + const timeA = versionTimes.value[rowA.version] ?? '' + const timeB = versionTimes.value[rowB.version] ?? '' + return sign * timeA.localeCompare(timeB) + }) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/pages/package/`[[org]]/[name]/versions.vue around lines 157 - 167, In sortTagRows, the date-branch comparator is overly complex: using dir * a ternary ladder to compare ISO date strings; simplify it by directly comparing the ISO strings (e.g., use timeB.localeCompare(timeA) or parse to numbers via Date.parse) and apply the sort direction by swapping operands or multiplying the compare result by -1 when needed; update the comparator inside sortTagRows (referencing tagsSortMode, tagsSortOrder, versionTimes, and the TaggedVersionRow sort call) to return a single numeric compare result without the manual three-way conditional.test/nuxt/pages/PackageVersionsPage.spec.ts (1)
461-471: Optional: assertion couples to English copy.
'newest first'/'oldest first'(and'Show all'at line 113) are matched against the rendered i18n string, so any rewording ofpackage.versions.sort_tags_by_date_asc/desc(or running the suite with another locale) silently breaks these tests. Consider asserting ontagsSortOrdervia an exposed test hook, or matching against the i18n key's resolved value directly (e.g. binding the expectation to$t('package.versions.sort_tags_by_date_asc')).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/nuxt/pages/PackageVersionsPage.spec.ts` around lines 461 - 471, The test currently asserts on rendered English copy via sortByDateBtn.attributes('aria-label') containing 'newest first'/'oldest first', which breaks with i18n changes; change the assertion to avoid hardcoded English by either (a) asserting the component's exposed state/two-way binding tagsSortOrder (or other exported test hook) flips from 'asc' to 'desc' when sortByDateBtn is clicked, or (b) resolve the expected label via the i18n instance (use $t('package.versions.sort_tags_by_date_asc') / $t('package.versions.sort_tags_by_date_desc') ) and compare against that resolved string instead of literal English; update the two expect calls around sortByDateBtn.trigger('click') accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/pages/package/`[[org]]/[name]/versions.vue:
- Around line 475-509: The group wrapper currently sets :aria-label to
$t('package.versions.sort_tags_by_priority') which duplicates a child button
label; change the wrapper's :aria-label to use a new i18n key like
package.versions.sort_tags_label (e.g. "Sort tags by") and update
i18n/locales/en.json and i18n/schema.json to include that key so the group
announces its purpose distinctly; locate the wrapper element with role="group"
and the selectTagsSort('priority') / selectTagsSort('date') buttons to make the
substitution.
In `@test/nuxt/pages/PackageVersionsPage.spec.ts`:
- Around line 297-308: The test directly indexes the wrapper arrays returned by
findAll (e.g., checkboxes from
component.find('[role="dialog"]').findAll('input[type="checkbox"]') and the
destructured sortByTagBtn / sortByDateBtn) which can be undefined if DOM shape
changes; before accessing checkboxes[0] / checkboxes[1] or using the
destructured buttons, assert the array length or that the specific element is
defined (e.g., expect(checkboxes.length).toBeGreaterThanOrEqual(2) or
expect(sortByTagBtn).toBeDefined()) so the test fails with a clear assertion
message instead of a runtime "cannot read properties of undefined" error, and
apply the same guard at the other occurrences (the destructurings at the noted
lines).
---
Nitpick comments:
In `@app/pages/package/`[[org]]/[name]/versions.vue:
- Around line 157-167: In sortTagRows, the date-branch comparator is overly
complex: using dir * a ternary ladder to compare ISO date strings; simplify it
by directly comparing the ISO strings (e.g., use timeB.localeCompare(timeA) or
parse to numbers via Date.parse) and apply the sort direction by swapping
operands or multiplying the compare result by -1 when needed; update the
comparator inside sortTagRows (referencing tagsSortMode, tagsSortOrder,
versionTimes, and the TaggedVersionRow sort call) to return a single numeric
compare result without the manual three-way conditional.
In `@test/nuxt/pages/PackageVersionsPage.spec.ts`:
- Around line 461-471: The test currently asserts on rendered English copy via
sortByDateBtn.attributes('aria-label') containing 'newest first'/'oldest first',
which breaks with i18n changes; change the assertion to avoid hardcoded English
by either (a) asserting the component's exposed state/two-way binding
tagsSortOrder (or other exported test hook) flips from 'asc' to 'desc' when
sortByDateBtn is clicked, or (b) resolve the expected label via the i18n
instance (use $t('package.versions.sort_tags_by_date_asc') /
$t('package.versions.sort_tags_by_date_desc') ) and compare against that
resolved string instead of literal English; update the two expect calls around
sortByDateBtn.trigger('click') accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6a288870-4ade-476b-a98e-0f5b4b354726
📒 Files selected for processing (2)
app/pages/package/[[org]]/[name]/versions.vuetest/nuxt/pages/PackageVersionsPage.spec.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/nuxt/pages/PackageVersionsPage.spec.ts`:
- Around line 387-391: The current assertions use component.text() which also
includes the popover label, so change the test to scope the check to the 1.x
group header instead of the whole component: use the existing component wrapper
and within the vi.waitFor block locate the 1.x group header element (e.g., find
or findAll and match text "1.x" or use the group header selector used in the
component), then assert that that header contains the deprecated badge (check
for the badge element/class or its text "deprecated"); alternatively close/hide
the popover before asserting to ensure the badge inside the 1.x header is the
source of the match. Ensure you update the assertions around component and
vi.waitFor accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0cd4ccfa-4497-40ac-9b74-986eebacfff0
📒 Files selected for processing (4)
app/pages/package/[[org]]/[name]/versions.vuei18n/locales/en.jsoni18n/schema.jsontest/nuxt/pages/PackageVersionsPage.spec.ts
✅ Files skipped from review due to trivial changes (1)
- app/pages/package/[[org]]/[name]/versions.vue
🚧 Files skipped from review as they are similar to previous changes (1)
- i18n/locales/en.json
There was a problem hiding this comment.
🧹 Nitpick comments (2)
test/nuxt/pages/PackageVersionsPage.spec.ts (2)
172-190: Stale test name after semver-range migration.The describe block now exercises semver-range matching (per the new tests at lines 192–236), but this case is still labelled "filters groups by substring match" and feeds
'1.0'— which now passes becausevalidRange('1.0')expands to>=1.0.0 <1.1.0-0rather than via substring matching. Consider renaming the test (and/or the surrounding describe) to reflect the new semantics so future readers do not assume substring behaviour is being asserted.♻️ Suggested rename
- it('filters groups by substring match', async () => { + it('filters groups by a partial semver range (e.g. "1.0")', async () => {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/nuxt/pages/PackageVersionsPage.spec.ts` around lines 172 - 190, Rename the stale test title and/or describe block in the PackageVersionsPage.spec.ts test (the describe('version filter') / it('filters groups by substring match') case) to reflect semver-range matching semantics instead of substring matching; for example change the it(...) string to indicate "filters groups by semver-range match" (or similar) and, if helpful for clarity, update the test input comment to state that '1.0' is treated as a semver range (validRange('1.0')) rather than a substring.
294-295: Brittle empty-string assertion on the toggle button.
expect(toggleBtn.text()).toBe('')couples this test to the toggle's entire rendered text — if the button later gains any visible label (e.g. "Filters") or icon-text fallback, the assertion will silently break for an unrelated reason. Prefer asserting on the badge element directly (e.g.toggleBtn.find('[data-testid="filter-badge"]').exists()or whatever marker is used for the count node) so the contract under test is "no badge is rendered when there are no active filters", not "the whole button has no text".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/nuxt/pages/PackageVersionsPage.spec.ts` around lines 294 - 295, The test currently asserts the entire toggle button text is empty via toggleBtn.text(), which is brittle; change the assertion to check the badge/count element directly (e.g. assert that toggleBtn.find('[data-testid="filter-badge"]').exists() is false or the specific badge selector used in PackageVersionsPage) so the test verifies "no badge rendered when there are no active filters" instead of "button has no text"; update the assertion in the PackageVersionsPage.spec.ts test that uses component.find('button[aria-haspopup="dialog"]') to check the badge node's existence/non-existence.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@test/nuxt/pages/PackageVersionsPage.spec.ts`:
- Around line 172-190: Rename the stale test title and/or describe block in the
PackageVersionsPage.spec.ts test (the describe('version filter') / it('filters
groups by substring match') case) to reflect semver-range matching semantics
instead of substring matching; for example change the it(...) string to indicate
"filters groups by semver-range match" (or similar) and, if helpful for clarity,
update the test input comment to state that '1.0' is treated as a semver range
(validRange('1.0')) rather than a substring.
- Around line 294-295: The test currently asserts the entire toggle button text
is empty via toggleBtn.text(), which is brittle; change the assertion to check
the badge/count element directly (e.g. assert that
toggleBtn.find('[data-testid="filter-badge"]').exists() is false or the specific
badge selector used in PackageVersionsPage) so the test verifies "no badge
rendered when there are no active filters" instead of "button has no text";
update the assertion in the PackageVersionsPage.spec.ts test that uses
component.find('button[aria-haspopup="dialog"]') to check the badge node's
existence/non-existence.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fcba864e-3222-4811-afba-b5cec3001001
📒 Files selected for processing (1)
test/nuxt/pages/PackageVersionsPage.spec.ts
|
@gameroman Nice idea! I will include it in this PR, looks like there's some code I can reuse. Update. Now the versions list in the package page has the same functionality. 🎉
|
50c1a8e to
6d94668
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app/pages/package/[[org]]/[name]/versions.vue (1)
169-175: Consider whether sort direction should reset when switching modes.
selectTagsSortonly flipstagsSortOrderwhen re-clicking the already-active 'date' button. As a result, the sequence "click date → click date (nowasc) → click priority → click date" lands silently inascmode without the user re-selecting that direction. This may be intentional (sticky user preference), but it can also surprise users who expect "Sort by date" to start from the defaultdescwhenever it's freshly activated.If the latter is desired, reset on mode switch:
♻️ Proposed tweak
function selectTagsSort(mode: 'priority' | 'date') { - if (tagsSortMode.value === mode && mode === 'date') { - tagsSortOrder.value = tagsSortOrder.value === 'desc' ? 'asc' : 'desc' - return - } - tagsSortMode.value = mode + if (tagsSortMode.value === mode) { + if (mode === 'date') { + tagsSortOrder.value = tagsSortOrder.value === 'desc' ? 'asc' : 'desc' + } + return + } + tagsSortMode.value = mode + tagsSortOrder.value = 'desc' }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/pages/package/`[[org]]/[name]/versions.vue around lines 169 - 175, The selectTagsSort function currently only toggles tagsSortOrder when re-clicking the active 'date' mode which leaves a previously chosen order sticky when switching modes; update selectTagsSort so that when changing tagsSortMode (i.e., when mode !== tagsSortMode.value) you also reset tagsSortOrder.value to the desired default (e.g., 'desc' for date) before setting tagsSortMode.value = mode so that re-activating the date sort starts from the default direction; reference the selectTagsSort function and the tagsSortMode and tagsSortOrder refs when making this change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@app/pages/package/`[[org]]/[name]/versions.vue:
- Around line 650-666: The toggle button for hidden prerelease tags (the element
using `@click`="showHiddenTags = !showHiddenTags") needs an aria-expanded
attribute bound to the component state so assistive tech knows its state; update
the <button> to include a binding like :aria-expanded="showHiddenTags" (and
optionally add aria-controls pointing to the ID of the collapsible region that
shows/hides the hidden tag rows), referencing the same showHiddenTags state used
in the label toggling.
---
Nitpick comments:
In `@app/pages/package/`[[org]]/[name]/versions.vue:
- Around line 169-175: The selectTagsSort function currently only toggles
tagsSortOrder when re-clicking the active 'date' mode which leaves a previously
chosen order sticky when switching modes; update selectTagsSort so that when
changing tagsSortMode (i.e., when mode !== tagsSortMode.value) you also reset
tagsSortOrder.value to the desired default (e.g., 'desc' for date) before
setting tagsSortMode.value = mode so that re-activating the date sort starts
from the default direction; reference the selectTagsSort function and the
tagsSortMode and tagsSortOrder refs when making this change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 820b0807-eee8-4e8d-87d4-e6f009fdf869
📒 Files selected for processing (6)
app/components/Package/Versions.vueapp/pages/package/[[org]]/[name]/versions.vueapp/utils/versions.tsi18n/locales/en.jsoni18n/schema.jsontest/nuxt/pages/PackageVersionsPage.spec.ts
✅ Files skipped from review due to trivial changes (2)
- i18n/locales/en.json
- i18n/schema.json



🔗 Linked issue
#2255
🧭 Context
After the first version of the package version history page launched, many people requested hiding less important information to make the page easier to use. Related discussions and a summary can be found in the issue.
📚 Description
PixPin_2026-04-26_10-13-49.mp4