Skip to content

fix(ci): treat fbuild build error: as failure even on exit code 0 - #3784

Merged
zackees merged 2 commits into
masterfrom
fix/fbuild-zero-exit-build-error
Jul 31, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/fbuild-zero-exit-build-error

Conversation

@zackees

@zackees zackees commented Jul 31, 2026 •

Copy link
Copy Markdown
Member

Problem

fbuild's daemon formats build failures as a bare build error: <msg> log line, and the CLI exits with the response's exit_code verbatim. fbuild already guards against a zero exit_code arriving alongside success=false — but only on the test-emu path (cli/deploy.rs:485-498, referencing fbuild issue #130):

// ...if the daemon handler or an intermediate proxy returns 0 alongside
// success=false (issue #130), we must still surface failure to the shell
// rather than silently exiting 0.
let code = if resp.exit_code == 0 { 1 } else { resp.exit_code };

The two paths FastLED actually uses have no such clamp — cli/build.rs:141-146 and the main cli/deploy.rs:241-247 both exit(resp.exit_code) raw, and daemon_client.rs:386 reads that code out of untyped JSON (unwrap_or(1)). A zero arriving there silently reads as a green build.

Change

Corroborate the return code against the stdout marker in the two affected entry points:

ci/util/fbuild_runner.py Function Action
~387 run_fbuild_compile guard added
~771 run_fbuild_deploy guard added — deploy builds before it flashes, same exposure
~485 _run_fbuild_batch_command intentionally not guarded, now commented

compile-many embeds the same build error text mid-line in its per-sketch summary (compile_many.rs:171-179), where it does not indicate whole-run failure — hence the ^\s* anchor, and hence that path keeps its existing result-count corroboration instead.

False-positive review

  • Echoed command line goes to the Python-side stream, not process.stdout — never enters the matched text.
  • Compiler diagnostics use file:line:col: error:, never build error: at column 0.
  • fbuild's startup banner emits only tracing/stderr lines; no log replay on the build path.

Testing

Two tests, one per guarded path. Both were mutation-checked — removing the guards fails exactly these two and nothing else:

$ uv run pytest ci/tests/test_fbuild_deploy_streaming.py ci/tests/test_fbuild_compile_many.py -q
11 passed

# with both guards deleted:
FAILED test_deploy_fails_on_build_error_with_zero_returncode
FAILED test_run_fbuild_compile_fails_on_build_error_with_zero_returncode
2 failed, 9 passed

bash lint clean.

Upstream follow-up

The real fix belongs in fbuild: apply the same clamp already present in cli/deploy.rs:485-498 to cli/build.rs:145 and cli/deploy.rs:246. That would make this guard belt-and-braces rather than load-bearing.

Also included

chore(gitignore): ignore .worktrees/ and TASK.md. Stale per-issue worktrees were being walked by the build-file path linter, producing 4 phantom PathNormJoinChecker violations against copies of files that no longer exist in the tree.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved build and deployment failure detection when an error message appears despite a successful process exit code.
    • Ensured build error details remain available in captured output.
    • Preserved result-count validation for batched compile operations.
  • Tests

    • Added regression coverage for compile and deployment error reporting.

zackees and others added 2 commits July 31, 2026 09:20
fbuild's daemon formats build failures as a bare `build error: <msg>` log
line and the CLI exits with the response's `exit_code` verbatim. fbuild
already guards against a zero `exit_code` arriving alongside
`success=false` (fbuild issue #130, `cli/deploy.rs:485-498`) but only on
the `test-emu` path -- `cli/build.rs:141-146` and the main
`cli/deploy.rs:241-247` both `exit(resp.exit_code)` unclamped, and
`daemon_client.rs:386` reads that code out of untyped JSON. A zero there
silently reads as a green build.

Corroborate the return code against the marker in `run_fbuild_compile`
and `run_fbuild_deploy` (deploy builds before it flashes, so it has the
same exposure). Match only at line start: `compile-many` embeds the same
text mid-line in its per-sketch summary, where it is not a whole-run
failure -- that path keeps its existing result-count corroboration
instead, now commented to say so.

Both guards are covered by tests that fail when the guard is removed.

Co-Authored-By: Claude <[email protected]>
Stale per-issue worktrees under .worktrees/ were being walked by the
meson path linter, producing 4 phantom PathNormJoinChecker violations
against copies of files that no longer exist in the tree.

Co-Authored-By: Claude <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 76f1fd73-4887-41f5-9535-70637a67c4df

📥 Commits

Reviewing files that changed from the base of the PR and between 8f43bd1 and a3d937d.

📒 Files selected for processing (4)
  • .gitignore
  • ci/tests/test_fbuild_compile_many.py
  • ci/tests/test_fbuild_deploy_streaming.py
  • ci/util/fbuild_runner.py

📝 Walkthrough

Walkthrough

The fbuild runner detects line-start build error: markers. Single-build compilation and deployment now fail when these markers occur with return code 0. Regression tests cover both paths, and .gitignore excludes agent worktrees and TASK.md files.

Changes

Fbuild error handling

Layer / File(s) Summary
Build-error marker detection
ci/util/fbuild_runner.py
The runner detects line-start build error: markers and excludes mid-line compile-many messages.
Compilation and deployment results
ci/util/fbuild_runner.py, ci/tests/test_fbuild_compile_many.py, ci/tests/test_fbuild_deploy_streaming.py
Single-build compilation and deployment report failure when output contains the marker with return code 0. Tests verify failure status and preserved output. Batched compilation retains result-count validation.

Repository hygiene

Layer / File(s) Summary
Scratch file ignore rules
.gitignore
Git ignores per-issue worktrees and TASK.md files.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main CI fix for treating fbuild's build error marker as a failure despite exit code 0.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/fbuild-zero-exit-build-error

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@zackees
zackees merged commit 8c1af3a into master Jul 31, 2026
10 of 13 checks passed
@zackees
zackees deleted the fix/fbuild-zero-exit-build-error branch July 31, 2026 17:27
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant