Skip to content

feat: stream the deploy output while it runs - #18

Merged
kristof-siket merged 1 commit into
mainfrom
feat/stream-deploy-output
Oct 6, 2026
Merged

kristof-siket merged 1 commit into
mainfrom
feat/stream-deploy-output

Conversation

@kristof-siket

@kristof-siket kristof-siket commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The action ran the deploy with spawnSync and printed its stdout only after the process exited. A long deploy showed nothing in the job log until the end.

A production deploy of pdp-control-plane (run 37316359545) shows $ bun run --bun prisma deploy module.mjs at 13:32:41. The next line appears at 13:37:06.

What changed

  • New run.mjs exports runCommand. It runs a command with child_process.spawn and waits for it to exit.
  • With capture on (the deploy phase), stdout is piped. Each chunk goes to the job log as it arrives, and is also collected. The collected stdout is what runPhase returns, so the result envelope, the URL outputs and the job summary table are parsed from the same text as before.
  • stdin and stderr stay inherited, as before. The child writes stderr to the log directly, so it was already live.
  • When the output ends without a newline, the log gets one before ::endgroup::. Before, a partial last line ran into the marker. The collected stdout is not changed.
  • runPhase in main.mjs calls runCommand. The exit status, signal and spawn error checks are the same, and so is the environment.
  • Install and build used the same runPhase code, so they now also run through spawn. Their output was already inherited and live, so nothing changes for them.
  • The 64 MB maxBuffer limit is gone, because spawn has none.
  • No new dependencies. There is no build step and no dist/.

Tests

tests/run.test.mjs runs a fake command through runCommand in a separate Node process and records when each write reaches stdout.

  • A command prints first, waits 500 ms, then prints second. The test checks that first arrives in its own write, at least 300 ms before second. With the output held until exit, as in the old code, this test fails. I checked that.
  • A deploy result line split across two writes, with no trailing newline, is collected whole. deployedUrlsFromOutput parses it into the same urls and url as before.
  • Exit status, signal, uncaptured output and a missing command (ENOENT) come back as before.

On Node 24, node --check on the action scripts, node --test tests/*.test.mjs (62 pass) and the action.yml sanity check from CI all pass. I also ran main.mjs end to end against a fake prisma bin that prints, waits 1.5 s, then prints a result line. The first line showed up in the log right away. The url, urls and outcome outputs came out as expected, and a failing exit still set outcome=failed.

Next

This is the first of two changes. With the output now passed through live, Composer's step events will then show in the job log as they happen.

🤖 Generated with Claude Code

The deploy phase ran under spawnSync and printed its captured stdout only
after the process exited, so a long deploy showed nothing in the job log
until the end. Phases now run with spawn: each stdout chunk is written to
the log as it arrives and also collected for the result parsing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 1de97217-4449-4009-a6fb-c0c8bb58ebf2
📥 Commits

Reviewing files that changed from the base of the PR and between 8cef831 and 40fa6ee.

📒 Files selected for processing (3)
  • main.mjs
  • run.mjs
  • tests/run.test.mjs

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.


Summary by CodeRabbit

  • Bug Fixes
    • Command output is now displayed as it arrives, including when output is captured. This keeps progress visible during command execution and preserves the order of output.
    • Captured output now ends with a newline when needed, preventing subsequent terminal output from appearing on the same line.
    • Command results now consistently report failures, including unsuccessful exits, termination by a signal, and commands that cannot be started.

Walkthrough

Added runCommand to spawn shell or argv commands, optionally capture stdout, and return command results. runPhase now uses runCommand and returns its stdout. Added tests for streamed and split output, exit status, signal termination, uncaptured output, and spawn errors.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 40fa6

No new merge-blocking issue was established; the change is ready for normal merge checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: streaming deploy output while the command runs.
Description check ✅ Passed The description explains the reason for the change, how runCommand streams and captures output, and the tests performed. It is directly related to the changeset.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@kristof-siket
kristof-siket marked this pull request as ready for review October 6, 2026 11:57
@kristof-siket
kristof-siket merged commit ac46456 into main Oct 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant