Repository navigation
fix(cli): escape DOT strings and drop ANSI colors from --dot output - #2487
Open
rafal-hawrylak wants to merge 1 commit into
Open
rafal-hawrylak wants to merge 1 commit into
rafal-hawrylak wants to merge 1 commit into
Conversation
Escape double quotes, backslashes and control characters in dotRepresentation node IDs, labels and edges so special characters cannot break Graphviz DOT syntax or trigger escString macro expansion. Always format DOT targets without ANSI color codes in interactive terminals and omit empty semicolon lines when a compiled graph has no nodes or no dependency edges so dot renders standalone-action and empty projects cleanly.
rafal-hawrylak
requested review from
Ford544,
apilaskowski,
mbiernacik and
zaptot
and removed request for
a team and
zaptot
November 24, 2026 15:02
apilaskowski
approved these changes
Nov 24, 2026
| ); | ||
| }); | ||
|
|
||
| test("printCompiledGraph prints DOT without ANSI escape sequences on an interactive terminal", () => { |
Collaborator
There was a problem hiding this comment.
Since dotRepresentation no longer takes an interactive flag, the first expect(dotRepresentation(graph)).equals(expected) already proves there is no ANSI output. Could we drop the process.stdout/isTTY/env patching? It is global state that is easy to leak if an assertion throws mid-test.
| * literal backslash (a line feed and a backslash followed by `n`) produce the same output, so two | ||
| * such names would share a node. BigQuery names cannot contain these characters. | ||
| */ | ||
| export function escapeDotString(value: string): string { |
Collaborator
There was a problem hiding this comment.
Nice docstring. Did you verify the trailing-backslash case (…\\") and the \N case with real dot -Tsvg? Might be worth a line in the PR description.
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.
Escape double quotes, backslashes and control characters in dotRepresentation node IDs, labels and edges so special characters cannot break Graphviz DOT syntax or trigger escString macro expansion. Always format DOT targets without ANSI color codes in interactive terminals and omit empty semicolon lines when a compiled graph has no nodes or no dependency edges so dot renders standalone-action and empty projects cleanly.