Uh oh!
There was an error while loading. Please reload this page.
fix: don't show license changed warning for first package versions - #2723
fix: don't show license changed warning for first package versions#2723ProCode-Software wants to merge 9 commits into
Conversation
Add check for previous version index to avoid displaying 'UNKNOWN' as the last version when there were no previous versions.
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughExports ChangesLicense change export, handler guards and tests
Possibly related PRs
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 |
Hello! Thank you for opening your first PR to npmx, @ProCode-Software! 🚀 Here’s what will happen next:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@server/api/registry/license-change/`[...pkg].get.ts:
- Around line 45-47: The current guard returns { change } when
previousVersionIndex < 0 which lets a missing requested version
(currentVersionIndex === -1) slip through; update the logic in the request
handler to first check if currentVersionIndex < 0 and return a 404/appropriate
error (or throw) for unknown version before checking previousVersionIndex, then
only proceed to access the versions array and compute change if
currentVersionIndex and previousVersionIndex are valid; ensure you reference and
protect accesses to versions[currentVersionIndex] and
versions[previousVersionIndex] to satisfy type-safety.
🪄 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: c6736d7d-c7bc-478a-ac3a-def91955178d
📒 Files selected for processing (1)
server/api/registry/license-change/[...pkg].get.ts
Uh oh!
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Add error handling for invalid version requests
ProCode-Software
left a comment
There was a problem hiding this comment.
Added logic for checking if a version wasn't found for a package
gameroman
left a comment
There was a problem hiding this comment.
Looks good 👍
Could you add a regression test please?
Generated with AI
ProCode-Software
commented
May 12, 2026
Done! |
ghostdevv
commented
May 12, 2026
I think you pushed it to the wrong branch 😄 |
Generated with AI
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@test/unit/server/api/registry/license-change.spec.ts`:
- Around line 175-197: The test expects the handler to extract the "type" from
an object-format license but currently asserts the incorrect string '[object
Object]'; update the expectation in the test (the handler call in this spec) so
that result.change.from equals 'Apache-2.0' (matching the license.type provided
by makePackument) while keeping result.change.to as 'ISC' — this will validate
the normalization behavior for object-format licenses handled by the handler
used in this spec.
🪄 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: 082dc3fb-2e44-427a-b065-6fdf39b12bbb
📒 Files selected for processing (1)
test/unit/server/api/registry/license-change.spec.ts
Uh oh!
There was an error while loading. Please reload this page.
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. An unexpected error occurred while generating fixes: Not Found - https://docs.github.com/rest/git/refs#get-a-reference |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Oops, I fixed it now. |
ProCode-Software
commented
May 13, 2026
npm's website says the |
gameroman
commented
May 13, 2026
I think you can use |
ghostdevv
left a comment
There was a problem hiding this comment.
Could you take a look at Roman's comment (no rush)?
ProCode-Software
commented
May 29, 2026
I exported |
gameroman
commented
May 30, 2026
could you also make sure the ci passes, thank you ❤️ |
ProCode-Software
commented
May 30, 2026
Why is type check failing? I synced usePackage.ts with main? |
ghostdevv
commented
May 31, 2026
Hey, thanks for the PR! We got like four for this so we're gonna close this in favor of #2792 and copy over any changes we can from here to there - we'll make sure you get credit dw 😄 |
Add check for previous version index to avoid displaying 'UNKNOWN' as the last version when there were no previous versions.
🔗 Linked issue
Resolves#2720.
🧭 Context
The previous functionality would index the package versions before the current version, even if it is 0. This would result in the previous version being
-1and the default value of "UNKNOWN" being returned as the previous version license.Added a return if
previousVersionIndex < 0📚 Description
For new packages, a license changed warning would be displayed:
There were no prior versions, however, the current functionality claims its license was
UNKNOWN.