diff options
| author | Drew Ritter <drew@primeradiant.com> | 2026-11-26 00:33:32 -0800 |
|---|---|---|
| committer | Drew Ritter <drew@primeradiant.com> | 2026-11-26 00:33:32 -0800 |
| commit | 9a9a94e62a39f8bf73d17a7e533dc8a28dbf2466 (patch) | |
| tree | 9c79481ffc3ea82f3f7f694a4f4bc32113da7662 | |
| parent | abfa7626a72ac9434d34fc6ff937bdf0f5f18502 (diff) | |
fix(writing-skills): drop the CRLF body normalization only the fake dot neededfix/wave1-writing-skills
The CRLF test's fake `dot` exited 1 with "syntax error: unexpected
carriage return" on any input containing a CR. Real Graphviz does not:
15.1.0 renders CRLF input with exit 0, to the same SVG bytes as LF
input. That invented failure was the only thing holding the
normalization of each dot block's body (`.replace(/\r\n/g, '\n')`
before `.trim()`). The stub now reads and discards its input and
prints an SVG, as review finding ADJ-10 proposed, and the CRLF
section's comment no longer mentions normalization.
With that stub and with real `dot`, the script was run with the
normalization removed on three CRLF SKILL.md files (the test's
fixture, the reproduction in #2519, and
subagent-driven-development/SKILL.md converted to CRLF), in single and
--combine modes. Every run found its diagrams, wrote its files and
exited 0, and real `dot` produced SVGs byte-identical to those rendered
with the normalization in place. The one difference is that the
combined .dot source written for debugging keeps the source's CRs;
real `dot` renders that file to the same SVG. #2519 needs only the
fence regex and the non-zero exit, so the body line reads as on dev
again and both of those changes stay.
Reverting the fence regex fails the CRLF case (no diagram found, no
SVG written). Removing the exit on a failed render fails both
broken-DOT cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rwxr-xr-x | skills/writing-skills/render-graphs.js | 2 | ||||
| -rwxr-xr-x | tests/writing-skills/test-render-graphs.sh | 10 |
2 files changed, 3 insertions, 9 deletions
diff --git a/skills/writing-skills/render-graphs.js b/skills/writing-skills/render-graphs.js index defe96e..09292c1 100755 --- a/skills/writing-skills/render-graphs.js +++ b/skills/writing-skills/render-graphs.js @@ -23,7 +23,7 @@ function extractDotBlocks(markdown) { let match; while ((match = regex.exec(markdown)) !== null) { - const content = match[1].replace(/\r\n/g, '\n').trim(); + const content = match[1].trim(); // Extract digraph name const nameMatch = content.match(/digraph\s+(\w+)/); diff --git a/tests/writing-skills/test-render-graphs.sh b/tests/writing-skills/test-render-graphs.sh index 6164bc8..a3142b7 100755 --- a/tests/writing-skills/test-render-graphs.sh +++ b/tests/writing-skills/test-render-graphs.sh @@ -116,13 +116,7 @@ case "${1:-}" in exit 0 ;; -Tsvg) - input="$(cat)" - case "$input" in - *$'\r'*) - echo "syntax error: unexpected carriage return" >&2 - exit 1 - ;; - esac + cat >/dev/null printf '<svg xmlns="http://www.w3.org/2000/svg"><g/></svg>\n' exit 0 ;; @@ -150,7 +144,7 @@ esac EOF chmod +x "$TEST_ROOT/fail-dot/dot" -# 1. CRLF SKILL.md extraction and normalization +# 1. CRLF SKILL.md extraction crlf_fixture="$TEST_ROOT/crlf-skill" mkdir -p "$crlf_fixture" printf -- '---\r\nname: crlf-skill\r\n---\r\n\r\n# CRLF Skill\r\n\r\n```dot\r\ndigraph crlf_graph {\r\n start -> end;\r\n}\r\n```\r\n' >"$crlf_fixture/SKILL.md" |
