Decode graphviz SVG bytes in analysis card HTML body - #5289
Closed
rootkiller6788 wants to merge 1 commit into
Closed
rootkiller6788 wants to merge 1 commit into
rootkiller6788 wants to merge 1 commit into
Conversation
Source.pipe(format="svg") returns bytes unless an encoding is passed, so the card body was embedding the repr of a bytes literal (b'...') and the notebook rendered the raw SVG source as text instead of the graph. Decode the bytes to utf-8 before inserting into the HTML div.
|
@saitcakmak has imported this pull request. If you are a Meta employee, you can view this in D119966981. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5289 +/- ##
==========================================
- Coverage 96.59% 96.58% -0.02%
==========================================
Files 621 621
Lines 70894 70925 +31
==========================================
+ Hits 68481 68501 +20
- Misses 2413 2424 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@saitcakmak merged this pull request in 0e341dd. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Graphviz cards (the Generation Strategy Graph you get from compute_analyses, and the hierarchical search space one) were showing a wall of raw text instead of a graph in notebooks.
graphviz's Source.pipe returns bytes unless you pass an encoding, and the card was embedding that bytes object straight into its HTML div - so the browser got something like b'<?xml ...' as text rather than an element to render.
Decode the pipe output to a string before putting it in the HTML. Also added a small regression test that mocks pipe to return bytes and checks the body actually contains an tag.