Repository navigation
fix: escape job stdout and stderr before rendering ANSI colors as HTML - #9587
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Summary
Fixes #9586. The notebook views of
job.stdoutandjob.stderrescaped quotes after they built the ANSI color spans, which broke everystyleattribute. They never escaped<and>, so output such as<class 'int'>or a traceback'sin <module>was parsed as HTML and disappeared.Changes
StdoutViewer._repr_html_andStderrViewer._repr_html_now escape the raw job output withhtml.escapefirst, then convert ANSI codes to<span>elements. ANSI sequences contain no HTML special characters, so they survive escaping.&,"and'replacements that ran after the span conversion.packages/syft-job/tests/test_job_stdout.pywith tests for escaped output and intact color spans in both viewers.Testing
pytest packages/syft-job/tests: 3 new tests fail before the fix; 163 passed after it.ruff checkandruff format --check(v0.12.9) pass onpackages/syft-job/.Asana task