ci: emit real newlines in Slack release message - #9039
Conversation
format.sh builds the Slack text with literal \n sequences, which bash does not expand. That used to render correctly only because the workflow interpolated the raw text into a hand-written JSON string, where Slack's JSON parser decoded \n as a newline. Since #8955 the payload is built with jq --arg, which correctly escapes the backslash, so #releases posts now show a literal \n between every line. Expand the escapes in the script itself so the output is correct regardless of how the caller encodes it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe CI formatter now uses ChangesSlack message formatting
Estimated code review effort: 1 (Trivial) | ~2 minutes Merge Risk: ⚪ Minimal · up to Slack release notifications will display their intended line breaks, with no current merge-blocking correctness or availability risk identified. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped to the Slack formatting path and aligns with the stated root cause without impacting other format outputs.
Pull request overview
Fixes Slack release notifications emitted by CI so they contain real newline characters rather than the literal \n escape sequence, restoring the expected “one line per download” formatting in #releases.
Changes:
- Update
scripts/ci/format.shSlack formatter output to expand\nescapes into actual newlines viaprintf '%b\n'.
File summaries
| File | Description |
|---|---|
| scripts/ci/format.sh | Emits Slack message text with real newlines by interpreting \n escape sequences when printing. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
Nightly posts in #releases have shown a literal
\nbetween every line since Aug 25 (example), instead of one line per download as before.Cause.
scripts/ci/format.sh slackbuilds its text with\ninside double-quoted bash strings, which bash does not expand, so the script emits the two characters\n. Before #8955 the workflow interpolated that raw text into a hand-written JSON payload, so Slack's JSON parser decoded\nas a newline and the message rendered correctly by accident. #8955 switched tojq --arg text "$text", which correctly escapes the backslash to\\n, and Slack now displays the escape literally.Fix. Expand the escapes in the script:
echo "$text"→printf '%b\n' "$text". The message contains no other backslashes, so nothing else changes. The jq step inrelease.ymlis correct and untouched. Thenightly-failure-notifymessage was never affected because it composes its text withprintfformat strings.Test plan
format.sh slackbefore/after with nightly env and piped throughjq -Rs '{text: .}': before produces\\nin the JSON string, after produces\n.format.sh job-summaryoutput unchanged (the change is scoped to theslack)case).🤖 Generated with Claude Code
Summary by CodeRabbit