Skip to content
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

feat(gateway): visualize dag-cbor and dag-json #315

Merged
merged 4 commits into from
May 31, 2023
Merged

feat(gateway): visualize dag-cbor and dag-json #315

merged 4 commits into from
May 31, 2023

Conversation

hacdias
Copy link
Member

@hacdias hacdias commented May 26, 2023

Closes #307. Builds on top of #298.

image image

@codecov
Copy link

codecov bot commented May 26, 2023

Codecov Report

Merging #315 (b1349b3) into main (c23df38) will increase coverage by 0.29%.
The diff coverage is 63.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #315      +/-   ##
==========================================
+ Coverage   49.36%   49.66%   +0.29%     
==========================================
  Files         281      282       +1     
  Lines       33708    33878     +170     
==========================================
+ Hits        16640    16824     +184     
+ Misses      15329    15300      -29     
- Partials     1739     1754      +15     
Impacted Files Coverage Δ
gateway/assets/assets.go 69.62% <ø> (ø)
gateway/assets/node.go 55.95% <55.95%> (ø)
gateway/handler_codec.go 53.99% <61.22%> (+21.41%) ⬆️
gateway/assets/test/main.go 40.40% <63.04%> (+20.03%) ⬆️
gateway/handler.go 69.42% <80.00%> (+1.38%) ⬆️
gateway/assets/templates.go 64.70% <100.00%> (+1.44%) ⬆️
gateway/handler_unixfs_dir.go 62.06% <100.00%> (-2.57%) ⬇️

... and 14 files with indirect coverage changes

@hacdias
Copy link
Member Author

hacdias commented May 26, 2023

I'm opening this for review to get feedback and for others to take it for a spin. I was quite conservative on how we handle the preview. If some error happens, no preview is shown (this usually means that the DAG isn't valid). If it all works, we show a preview.

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

Thank you @hacdias I think this is good enough to ship, but needs:

gateway/assets/dag.html Outdated Show resolved Hide resolved
gateway/assets/node.go Outdated Show resolved Hide resolved
gateway/assets/node.go Outdated Show resolved Hide resolved
Base automatically changed from issue/262 to main May 30, 2023 09:43
@hacdias hacdias force-pushed the issue/307 branch 4 times, most recently from f659215 to 6b2ef99 Compare May 30, 2023 12:21
@hacdias hacdias requested a review from lidel May 30, 2023 12:31
@hacdias
Copy link
Member Author

hacdias commented May 30, 2023

Kubo is green: ipfs/kubo#9904

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

@hacdias while testing in Kubo, I've found some things we should address before merging:

@hacdias
Copy link
Member Author

hacdias commented May 31, 2023

@lidel I just pushed a fix for both, including tests. In addition, I have a few notes:

  • The codec handler was never redirecting properly. I changed the converted and the raw to wrap the ResponseWriter with statusResponseWriter so we preserve the redirection status. Similar to UnixFS files.
  • HTML response now redirects to /. Therefore, some sharness tests in Kubo fail where we used to check if we got HTML back. I fixed them by simply requesting the path with trailing slash. The redirection is tested in the new tests in this PR. feat(gateway): human error pages, dag-cbor/dag-json preview kubo#9904

@hacdias
Copy link
Member Author

hacdias commented May 31, 2023

@lidel regarding our redirects and body conversations, I did not include it here because we have some tests currently checking for that: #326 - let's keep it separate. However, I do think we should clean it up asap.

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

Thank you, lgtm, merging. I will bubble up to ipfs/kubo#9904 and review there after CI is green.

@lidel lidel merged commit d1b8d1d into main May 31, 2023
@lidel lidel deleted the issue/307 branch May 31, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

More useful html with dag-cbor
2 participants