feat(local-dev): add --json status output and a non-TTY build heartbeat#6027
Merged
Merged
Conversation
Contributor
Automated Reviewer SuggestionsBased on the
|
aglinxinyuan
approved these changes
Jun 29, 2026
Mrudhulraj
pushed a commit
to Mrudhulraj/texera
that referenced
this pull request
Jun 30, 2026
…at (apache#6027) ### What changes were proposed in this PR? Two small, agent/script-friendly additions to `bin/local-dev.sh` — no change to the human TTY experience. **1. `--json` machine-readable status.** `status --json` prints one JSON object on stdout (no colours, no table) and exits `0` iff every service is running, else `1`: ```json {"branch":"...","sha":"...","running":14,"total":14,"services":[ {"service":"texera-web","port":8080,"type":"jvm","pid":25823,"state":"running"}, ...]} ``` `up` and `down` also accept `--json`: human progress is routed to **stderr** (unbuffered) and the final status JSON goes to **stdout** (via a saved fd), so a caller can `up --json >state.json 2>progress.log` and parse stdout directly. **2. Non-TTY build heartbeat.** In non-TTY mode the spinner can't render in place, so a long silent step (`sbt dist`, output redirected to a log) used to print one line then go quiet for 25s+ — indistinguishable from "stuck" to a non-interactive caller. `tui_spinner` now emits `… still running (Ns)` every `TUI_HEARTBEAT_SECS` (default 15), polling at 1s so it still returns within ~1s of the job finishing (no trailing latency). ### Any related issues, documentation, discussions? Closes apache#6026. Usage banner (`--help`) updated to document `--json` on `status`/`up`/`down`. ### How was this PR tested? - `bash bin/local-dev/tests/test_local_dev_sh.sh` → **19 passed, 0 failed** (added 6: JSON shape/consistency, health-based exit code, unknown-flag negative case, `--help` coverage, heartbeat regression guard, up/down `--json` wiring). - `python -m pytest bin/local-dev/tests/` → **38 passed** (no regression). - Dogfooded end to end: `down --json` → stdout pure JSON (`running:0`, 14 `stopped`), exit 0; `up --json` → single-line JSON `running:14/14` on stdout, and stderr showed the new heartbeat across a ~60s build (`… still running (15s/30s/45s/60s)`), 14/14 healthy. - Verified stdout/stderr separation: `up --json >state.json 2>progress.log` yields parseable JSON in `state.json`. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 4.8)
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.
What changes were proposed in this PR?
Two small, agent/script-friendly additions to
bin/local-dev.sh— no change to the human TTY experience.1.
--jsonmachine-readable status.status --jsonprints one JSON object on stdout (no colours, no table) and exits0iff every service is running, else1:{"branch":"...","sha":"...","running":14,"total":14,"services":[ {"service":"texera-web","port":8080,"type":"jvm","pid":25823,"state":"running"}, ...]}upanddownalso accept--json: human progress is routed to stderr (unbuffered) and the final status JSON goes to stdout (via a saved fd), so a caller canup --json >state.json 2>progress.logand parse stdout directly.2. Non-TTY build heartbeat. In non-TTY mode the spinner can't render in place, so a long silent step (
sbt dist, output redirected to a log) used to print one line then go quiet for 25s+ — indistinguishable from "stuck" to a non-interactive caller.tui_spinnernow emits… still running (Ns)everyTUI_HEARTBEAT_SECS(default 15), polling at 1s so it still returns within ~1s of the job finishing (no trailing latency).Any related issues, documentation, discussions?
Closes #6026. Usage banner (
--help) updated to document--jsononstatus/up/down.How was this PR tested?
bash bin/local-dev/tests/test_local_dev_sh.sh→ 19 passed, 0 failed (added 6: JSON shape/consistency, health-based exit code, unknown-flag negative case,--helpcoverage, heartbeat regression guard, up/down--jsonwiring).python -m pytest bin/local-dev/tests/→ 38 passed (no regression).down --json→ stdout pure JSON (running:0, 14stopped), exit 0;up --json→ single-line JSONrunning:14/14on stdout, and stderr showed the new heartbeat across a ~60s build (… still running (15s/30s/45s/60s)), 14/14 healthy.up --json >state.json 2>progress.logyields parseable JSON instate.json.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)