refactor: ♻️ API endpoint updates - #189
Conversation
|
Thank you for submitting this pull request! We appreciate your contribution to the project. Before we can merge it, we need to review the changes you've made to ensure they align with our code standards and meet the requirements of the project. We'll get back to you as soon as we can with feedback. Thanks again! |
Reviewer's GuideAdds protection and robust error handling to the SPDX license details API endpoint, including timeouts and logging, and updates generated badge/DOI snippet URLs in the Zenodo release dashboard page to use the new /api/badge and /doi routes. Sequence diagram for updated SPDX license details API endpointsequenceDiagram
participant Client
participant LicenseAPI as request_license_get
participant SPDX as SPDX_server
participant Logwatch as logwatch
Client->>LicenseAPI: HTTP GET /api/request/license/{licenseid}
LicenseAPI->>LicenseAPI: protectRoute(event)
LicenseAPI->>LicenseAPI: find license in licensesJSON
alt license found
LicenseAPI->>SPDX: fetch(license.detailsUrl, AbortSignal.timeout(10000))
alt response.ok
SPDX-->>LicenseAPI: JSON licenseText
LicenseAPI-->>Client: 200 { licenseText, ... }
else fetch fails or !response.ok
LicenseAPI->>Logwatch: logwatch.error({ action:"request:license", ... })
LicenseAPI-->>Client: 502 license-details-fetch-failed
end
else license not found
LicenseAPI-->>Client: 404
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Thanks for making updates to your pull request. Our team will take a look and provide feedback as soon as possible. Please wait for any GitHub Actions to complete before editing your pull request. If you have any additional questions or concerns, feel free to let us know. Thank you for your contributions! |
PR Summary
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider making
SPDX_FETCH_TIMEOUT_MSconfigurable (e.g., via runtime config/env) rather than hard-coded so it can be tuned without redeploying if SPDX latency characteristics change. - Using
AbortSignal.timeoutmay be runtime-dependent; if this code can run in environments without native support, consider a small helper/utility that falls back to a manual timeout controller.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider making `SPDX_FETCH_TIMEOUT_MS` configurable (e.g., via runtime config/env) rather than hard-coded so it can be tuned without redeploying if SPDX latency characteristics change.
- Using `AbortSignal.timeout` may be runtime-dependent; if this code can run in environments without native support, consider a small helper/utility that falls back to a manual timeout controller.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary by Sourcery
Harden license detail requests and update generated release badge URLs for the current API routes.
Bug Fixes:
Enhancements: