Skip to content

Decode graphviz SVG bytes in analysis card HTML body - #5289

Closed
rootkiller6788 wants to merge 1 commit into
facebook:mainfrom
rootkiller6788:fix-graphviz-svg-bytes-decoding
Closed

rootkiller6788 wants to merge 1 commit into
facebook:mainfrom
rootkiller6788:fix-graphviz-svg-bytes-decoding

Conversation

@rootkiller6788

Copy link
Copy Markdown
Contributor

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.

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.
@meta-cla meta-cla Bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Sep 12, 2026

@saitcakmak saitcakmak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thanks for the fix!

@meta-codesync

meta-codesync Bot commented Sep 14, 2026

Copy link
Copy Markdown

@saitcakmak has imported this pull request. If you are a Meta employee, you can view this in D119966981.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.58%. Comparing base (d034ba2) to head (0d94c98).
⚠️ Report is 4 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@meta-codesync meta-codesync Bot closed this in 0e341dd Sep 15, 2026
@meta-codesync meta-codesync Bot added the Merged label Sep 15, 2026
@meta-codesync

meta-codesync Bot commented Sep 15, 2026

Copy link
Copy Markdown

@saitcakmak merged this pull request in 0e341dd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity. Merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants