refactor: use getLatestRelease API instead of listReleases#48
Conversation
Switched to the dedicated endpoint which returns exactly what we need without fetching and filtering the entire release list. Also renamed the CI workflow from build to test to better reflect its purpose.
70ff820 to
fee35c8
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on February 8
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| }); | ||
| const releaseList = releaseResponse.data; | ||
|
|
||
| if (!releaseList?.length) { |
There was a problem hiding this comment.
Error handling unreachable due to API 404 exception
Medium Severity
The switch from listReleases to getLatestRelease breaks the error handling for missing releases. The old API returned an empty array when no releases exist, allowing the length check to catch it. The new API throws a 404 exception, meaning the if (!releaseResponse.data?.tag_name) check is never reached. Users now see a raw HTTP 404 error instead of the intended helpful message about GitHub outages.
Switched to the dedicated endpoint which returns exactly what we need without fetching and filtering the entire release list.
Also renamed the CI workflow from build to test to better reflect its purpose.
Note
Refactor latest version retrieval
octokit.rest.repos.listReleases+ filtering withoctokit.rest.repos.getLatestReleaseinsrc/install.ts(and regenerateddist/index.js), simplifying logic to returntag_namedirectly and updating error handling.CI workflow rename and test job
buildtotestin.github/workflows/test.yml.ubuntu,macOS, andwindowsand add a basic spacectl smoke test (spacectl --version).Written by Cursor Bugbot for commit fee35c8. This will update automatically on new commits. Configure here.