-
Notifications
You must be signed in to change notification settings - Fork 99
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
gateway: remote car gateway backend #587
Conversation
d02ac99
to
57e2d3a
Compare
c47b8ba
to
88db4f3
Compare
e328b5b
to
55f0d3a
Compare
2f7a31f
to
2d272da
Compare
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## main #587 +/- ##
==========================================
+ Coverage 59.52% 59.65% +0.13%
==========================================
Files 233 238 +5
Lines 28276 29810 +1534
==========================================
+ Hits 16830 17782 +952
- Misses 9977 10415 +438
- Partials 1469 1613 +144
|
@aschmahmann there are quite some tests failing for Gateway Conformance (Graph Gateway). I've already fixed some tests but maybe you have a better intuition for what might be failing here. I had to update the code quite a bit considering all the updates we've had in Boxo. |
2ee6305
to
2036531
Compare
5685076
to
324a9ca
Compare
2036531
to
4bef702
Compare
324a9ca
to
8d9b9e2
Compare
8d9b9e2
to
0d2d80a
Compare
We have now 10 failing conformance tests with the remote CAR gateway backend. I've managed to solve the other ones in the meanwhile.
|
5a2b6c8
to
6fe39c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for salvaging this work @hacdias ❤️
On only-if-cached
Disabling tests for backend_car" for now sgtm.
💭 Click for Rationale
In theory, we could wire it up to in-memory cache, and pre-warm the cache so it passes the test, but it feels like a time sink not worth the effort.
In practice, Cache-Control: only-if-cached
woudl be handled by CDN/cache in front of gateway, so it is reasonable for gateway backed by a remote backend to always return HTTP 412. HTTP 200s will be returned only by the cache that sits in front of it.
On Range requests for DAG-CBOR converted to HTML
Thank you for surfacing this one. Took me a moment to understand what is happening here.
The way I see it, the conformance test of (dag-cbor + Accept
with text/html
+ Range
) in path_gateway_dag_test.go#L718-L731 makes no sense conformance-wise, and should be removed from conformance suite itself, and remove any hacks we added to make it pass.
Lmk if below missed the mark, but I think removing this edge case is the best way of handling it.
💭 Click for (long) Rationale why
Making HTTP Range
request with Accept
that includes text/html
make little sense.
The only meaningful Range
tests for dag-cbor
are ones that fetch subset of CBOR bytes.
So if Accept
is missing, */*
or application/vnd.ipld.dag-cbor
application/vnd.ipld.cbor
.
The case where Accept
is text/html
is not meaningful.
This HTML is generated, getting subset of bytes of generated HTML preview page, while technically possible for HTTP client, is.. meh? Not useful at all, not related to receiving actual content-addressed data.
It would be a-okay regression test in Kubo, but should not be part of conformance.
I think the reason it ended up in conformance tests is that our approach to conformance was to play it safe and "better to test too much than too little". Which is good, and I still think was a good call.
When it comes to conformance, we have two opposite problems:
- We test Kubo-specific behaviors. As we have implementations, we identify these, and over time relax, make generic, or remove.
- We have no tests for implicit behaviors related to generic HTTP due to always using
net/http
from Golang- For example: for a long time we had HTTP Ranges working everywhere "for free" because
net/http
from golang handled things likeRange
andContent-Length
seamlessly. But sincegateway/serve_http_content.go
was introduced in feat(gateway): more explicit IPFSBackend and no multi-range #369 we do all these things by hand, and only where it brings any value. This created a gaps, for example, we are lacking some of basic Range request tests (Add tests for HTTP Range requests gateway-conformance#154)
- For example: for a long time we had HTTP Ranges working everywhere "for free" because
Hopefully this is useful context.
Over time, conformance tests will improve. The more we use them, the better.
@lidel great, I do agree. I opened a PR to remove the conformance test (ipfs/gateway-conformance#202) and I will revert the change here that I made in order to pass such test. We'll need to make a release of the conformance tests once merged. |
Co-authored-by: Marcin Rataj <[email protected]>
This reverts commit 6fe39c8.
48cc5dc
to
84c7d89
Compare
Besides removing the conformance test (PR here), this PR is ready to be reviewed. I just made a few cleanups, so here's a short summary of the most important:
|
2c4b52d
to
8d7ac80
Compare
8d7ac80
to
9d4ebb5
Compare
Note that there is one test that is "expected" [by github actions] ( |
@hacdias thanks! FYSA I've removed "gateway-conformance" workflow from required list for now. Since I took a stab at cleaning it up + adding the missing test for "remote block backend" (where blocks are fetched one by one via (I've run out of time, will try to finish reviewing this PR tomorrow) |
github.com/ipld/go-car v0.6.2 | ||
github.com/ipld/go-car/v2 v2.13.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 i guess we have to live with both now.
iiuc we need v1 for WithErrorOnEmptyRoots
which was introduced in ipld/go-car#461, and v2 does not support everything v1 does, and v3 mentioned in ipld/go-car#461 (comment) never happened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for porting and cleaning this up @hacdias!
I think it is good enough: we have examples that show how to use it, and we dogfood both backends in conformance tests, which is a neat way to ensure they don't break without notice.
Lgtm, let's merge it.
For anyone following this work: the next step will be to expose support for block and car proxy modes in rainbow (ipfs/rainbow#88).
Closes #576. Generally, this imports the graph gateway, here named
CarBackend
, from our old bifrost-gateway repository. The following updates were also done:CarBackend
andBlocksBackend
CarBackend
such that CARs return useful blocks when paths are not not resolvableDepends on: