feat(build): add builder.output (quiet | verbose) for BuildKit's stream

Merged
MH
9d ago
+232-6

Summary

dash build push and dash build dev forced SSHKit to :debug for the whole build, so every BuildKit line printed with a DEBUG [id] prefix whatever -q said, and no configuration could quiet a build.

This adds builder.output (quiet | verbose), which mirrors hooks_output:

builder.outputCLI flagBuildKit stream
unset / verbosenonestreamed, as today (same code path)
quietnonenot printed; the build report still prints
any-vstreamed
any-qnot printed
  • One private helper, Dash::Cli::Build#with_build_output, replaces both DASH.with_verbosity(:debug) call sites (push and dev; pack builds go through the same path).
  • Nothing is lost in quiet mode. SSHKit hands every line to the interaction handler and keeps it on the command before the formatter decides what to print. So the progress parser still reads it all, and configured output loggers still record every line.
  • A failed quiet build raises SSHKit::Command::Failed carrying the full stdout/stderr, which bin/dash prints as the final ERROR line, with exit 1.
  • Validation: builder.output: loud fails with builder/output: Invalid output 'loud', must be one of: quiet, verbose; both quiet and :quiet are accepted.
  • Documented in lib/dash/configuration/docs/builder.yml, which also generates the docs-site page.

Behaviour changes to note:

  • -q now silences the build stream too (it was overridden before). On CI, dash deploy -q or builder.output: quiet means no output while the build runs, so a job with a no-output timeout needs that timeout to cover the longest build. The docs say this.
  • hooks_output: true, false or a number now fails config load (Invalid hooks_output 'false', …). Before, a global one was silently ignored and a per-hook one crashed with NoMethodError on to_sym. The cause is that the validator's type check treats booleans and numbers as strings. This is the same validation path builder.output mirrors, so it is fixed here.

Closes #216

Test plan

  • test/configuration/builder_test.rb: default nil, quiet/verbose, symbol form, loud, a boolean, a hash
  • test/configuration_test.rb: hooks_output: true and per-hook 1 are rejected with the level message
  • test/cli/build_test.rb: the build's verbosity for all 9 setting × flag rows, for both push and dev; a quiet push still prints the build report
  • test/cli/build_test.rb: through SSHKit's real local backend with a failing sh, quiet prints no data lines, still feeds the interaction handler and the output log, and the raised error carries the output; verbose streams at DEBUG. Ran 30 times, 30 green.
  • Mutation: forcing streaming at :info turns 3 tests red
  • Unit suite: 2771 runs, 0 failures. RuboCop is clean on the changed files. docs/spec/config_docs_spec.rb and docs/spec/requests/docs_spec.rb are green.
  • End to end: real bin/dash build push with a fake docker on PATH
    • Default output diffed identical to main once command ids and timings were normalised.
    • quiet and -q successes printed no DEBUG lines and did print the report.
    • quiet and -q failures printed the full BuildKit log in the final ERROR line, with exit 1.
    • quiet with -v streamed.
  • bin/test integration: not run. Deploy, proxy and boot paths are untouched; CI runs the full suite.

Rigor: critical — fallback: no Rigor line in AGENTS.md → ## Workflow
Validator: PASS WITH NOTES at 104de839 (pass 1 BLOCK at 63817b47, fixed in 104de839)

Validator notes, answered:

  • First unit test on SSHKit's local backend: kept on purpose. It spawns only sh, with no Docker, network or clock, and it is the only proof that a quiet failure carries its output through SSHKit itself rather than a stub.
  • hooks_output: true/false/1 now fails load: intended. It is stated above as a behaviour change.
  • -q silences the build for everyone: intended, since it is acceptance criterion 4. It is stated above.
  • The docs CI filters on docs/** only, so it misses lib/dash/configuration/docs/*.yml: predates this PR. The docs specs were run locally (green).

Not verified (validator):

  • A real BuildKit failure through bin/dash: covered only by the fake-docker run above.
  • -q with a failing build on the local backend: proven by the level table, and it shares the same failure path.
  • bin/test integration.
  • Ruby 3.2–3.4: CI's matrix covers these.

Effort & cost

EstimateActualDeviation
SizeSSwithin
Active time2–3 h1.2 h−41 %
Validation passes1–20−100 %
Review rounds11within
Files4–68 (+232 / −6)+33 %

Estimate: plan #216.

Wall clock 1.3 h (2026-11-27 21:31 → 22:47 UTC); active 1.2 h, 1.0 h of it before the PR opened and 11 min after. Active leaves out waiting on CI or a review bot and any gap over 10 min.

TokensCallsInputof it cache readsOutput
Main session · claude-opus-5-59013.5 M12.9 M46 k
Advisor, for the main session · claude-fable-5-21125 k08 k
Total9113.6 M12.9 M54 k

2 commits · 0 review threads · measured from 1 session and 0 agent transcripts on this machine; work elsewhere is not in these numbers.

Where it went: Files ran over because of the hooks_output sibling fix found on the same validation path, and its tests in test/configuration_test.rb. Active time came in under the estimate because SSHKit already buffers each command's output, so quiet mode needed no capture. Two validator passes ran (a BLOCK for an EPIPE-flaky test handler, then PASS WITH NOTES). The table shows 0 because those agent transcripts were not linked to this session.

Deviations & judgment calls

  • Judgment call: no rescue-and-say on a failed quiet build, though the plan proposed one. SSHKit::Command::Failed already carries the full log and bin/dash prints it, so an extra say would print it twice. This is proven by the local-backend test and the end-to-end run.
  • Discovery: the validator's type check treats booleans and numbers as strings (stringish?), so hooks_output: true passed silently and a per-hook 1 crashed. Fixed here with tests. builder.output's level check guards the same way.
  • Deviation: the plan was to special-case output in the validator to accept a String or a Symbol. That turned out unnecessary because stringish? already accepts Symbols.
  • Judgment call: AGENTS.md routes a new config option through a Plan agent. The issue already carried a /flow:plan body, so that plan was used.
  • Validator BLOCK: the local-backend tests' Proc handler returned the array, which SSHKit writes to stdin, so they raced the shell's exit with EPIPE. The handler now returns nil. The same round added the three missing table rows and the CI-timeout note in the docs.

Summary by cubic

Adds builder.output (quiet | verbose) so BuildKit's progress lines can be silenced at the default verbosity; previously builds always streamed at debug, ignoring -q. The setting mirrors hooks_output: -v always streams, -q never does, and builder.output applies only at default verbosity. Quiet builds still feed the progress parser and output loggers, and a failed build's full log still prints in the final error.

Also tightens hooks_output validation: boolean or numeric values previously passed silently or crashed with NoMethodError, and now fail config load with the level message.

Behavior changes

  • -q now silences the build stream (it was overridden before); CI jobs with no-output timeouts must cover the longest build.
  • hooks_output: true, false, or a number now raise a ConfigurationError instead of being ignored or crashing.