Skip to content

🐛 (catalogd) serveJSON lines instead of http.serverContent for no-params #1725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

anik120
Copy link
Contributor

@anik120 anik120 commented Feb 6, 2025

The metas endpoint was using serverJSONLines for serving queries that are parameterized, which copies content from a reader to the response writer under the hood. As a result no-parameterized query responses don't have range request support.

The endpoint was however using http.ServeContent for cases when no parameters were provided, which does have range request support.

This PR switches the http.ServeContent out for serveJSONLines to make sure metas endpoint is consistent in it's lack of support for range requests.

Description

Reviewer Checklist

  • API Go Documentation
  • Tests: Unit Tests (and E2E Tests, if appropriate)
  • Comprehensive Commit Messages
  • Links to related GitHub Issue(s)

@anik120 anik120 requested a review from a team as a code owner February 6, 2025 18:52
Copy link

netlify bot commented Feb 6, 2025

Deploy Preview for olmv1 ready!

Name Link
🔨 Latest commit f88c3b8
🔍 Latest deploy log https://app.netlify.com/sites/olmv1/deploys/67a50c4898f67400092b4945
😎 Deploy Preview https://deploy-preview-1725--olmv1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@@ -244,7 +244,7 @@ func (s *LocalDirV1) handleV1Query(w http.ResponseWriter, r *http.Request) {
if schema == "" && pkg == "" && name == "" {
// If no parameters are provided, return the entire catalog (this is the same as /api/v1/all)
w.Header().Add("Content-Type", "application/jsonl")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this line, since serveJSONLines does it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@joelanford joelanford changed the title (catalogd) serveJSON lines instead of http.serverContent for no-params 🐛 (catalogd) serveJSON lines instead of http.serverContent for no-params Feb 6, 2025
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 67.61%. Comparing base (099a6cf) to head (f88c3b8).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
catalogd/internal/storage/localdir.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1725      +/-   ##
==========================================
+ Coverage   67.58%   67.61%   +0.03%     
==========================================
  Files          59       59              
  Lines        4982     4981       -1     
==========================================
+ Hits         3367     3368       +1     
+ Misses       1371     1369       -2     
  Partials      244      244              
Flag Coverage Δ
e2e 53.00% <ø> (-0.09%) ⬇️
unit 54.80% <0.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…arams

The metas endpoint was using `serverJSONLines` for serving queries that are
parameterized, which copies content from a reader to the response writer under
the hood. As a result no-parameterized query responses don't have range request
support.

The endpoint was however using `http.ServeContent` for cases when no parameters
were provided, which does have range request support.

This PR switches the `http.ServeContent` out for `serveJSONLines` to make sure
metas endpoint is consistent in it's lack of support for range requests.

Signed-off-by: Anik Bhattacharjee <[email protected]>
@anik120 anik120 force-pushed the catalogd-metas-endpoint-remove-range-support branch from 740d117 to f88c3b8 Compare February 6, 2025 19:23
@grokspawn
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 6, 2025
@joelanford joelanford enabled auto-merge February 6, 2025 19:24
@joelanford joelanford added this pull request to the merge queue Feb 6, 2025
Merged via the queue into operator-framework:main with commit f6b1130 Feb 6, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants