Skip to content

fix(build): wire project_dir into board resolution on the daemon build path - #518

Merged
zackees merged 1 commit into
mainfrom
fix/build-path-board-resolution
Jun 9, 2026
Merged

fix(build): wire project_dir into board resolution on the daemon build path#518
zackees merged 1 commit into
mainfrom
fix/build-path-board-resolution

Conversation

@zackees

Copy link
Copy Markdown
Member

TL;DR

#516 added project-local boards/*.json resolution but only wired it through compile_many. The far more common entry point — fbuild build <dir> -e <env> — goes through BuildContext on the daemon side, which still uses the legacy from_board_id (no project_dir), so 2.2.23 still fails with:

build error: config error: unknown board 'lpc845brk' (no built-in defaults)

This PR points the daemon's build path at from_board_id_in_project, completing the wiring for #515. All three production board-resolution sites — compile_many, pipeline::BuildContext, script_runtime — now share from_board_id_in_project.

What was happening

fbuild build <dir> -e <env>
└── CLI daemon_client::ensure_daemon_running()
└── daemon receives BuildRequest
└── pipeline::BuildContext::new_with_perf(params)
└── from_board_id(board_id, &overrides) ← ❌ no project_dir

compile_many::platform_for_board already used from_board_id_in_project, but compile_many is reached via fbuild ci / batch flows, not fbuild build. Daily users hit the daemon path and saw zero benefit from #516.

Patch

FileChange
crates/fbuild-build/src/pipeline/context.rsfrom_board_idfrom_board_id_in_project(board_id, &overrides, Some(project_dir.as_path())). project_dir was already in scope (line 61).
crates/fbuild-build/src/script_runtime.rsThread project_dir through build_script_runtime_board_config (used by extra_scripts overlay setup) so it shares the same project-local fallback.

No public API change.

Verification

Local repro before fix (fbuild 2.2.22 source-built off main):

$ target/x86_64-pc-windows-msvc/debug/fbuild.exe build <ArduinoCore-LPC8xx> -e lpc845brk
build error: config error: unknown board 'lpc845brk' (no built-in defaults)

After fix:

 0.00 = BUILDING lpc845brk =
0.00 Board: NXP LPC845-BRK / LPC845 @ 30MHz
0.00 Memory: 64.00KB Flash, 16.00KB RAM
0.05 Toolchain: arm-none-eabi-gcc 15.2.1
0.29 Compiled 6/6 files
...

(Hits a downstream failure that's the nxplpc orchestrator's framework-ingestion Stage 3 stub — LED_BUILTIN not declared because the variant header isn't pulled in. That's #479 territory, out of scope here.)

Tests

soldr cargo test -p fbuild-build --lib
test result: ok. 687 passed; 0 failed

Related

#516 introduced `BoardConfig::from_board_id_in_project(..., project_dir)`
and updated `compile_many::platform_for_board` to use it, so
`fbuild ci`'s batch path picked up `<project_dir>/boards/*.json`.
But the daemon-backed single-build flow (`fbuild build <dir> -e <env>`,
which 99% of users actually hit) goes through a different entry point:
`BuildContext::new_with_perf` in `pipeline/context.rs`. That call site
was still using the legacy `from_board_id(board_id, &overrides)` — no
project_dir, so the project-local boards/ fallback never ran.
Net effect: 2.2.23 shipped but `fbuild build .` against a project with a
project-local `boards/` directory continued to fail with
config error: unknown board 'lpc845brk' (no built-in defaults)
This patch:
- pipeline/context.rs: switch BuildContext board resolution to
`from_board_id_in_project` with `Some(project_dir.as_path())`. The
field was already in scope (line 61).
- script_runtime.rs: thread `project_dir` into
`build_script_runtime_board_config`, used by `extra_scripts` shim
setup (also currently silently dropping the project_dir context).
Now all three build-path board-resolution sites — `compile_many`,
`pipeline::BuildContext`, `script_runtime` — use the same shared
`from_board_id_in_project` helper.
## Verified locally
Built `cargo build -p fbuild-cli -p fbuild-daemon`, ran
target/x86_64-pc-windows-msvc/debug/fbuild.exe build <repo> -e lpc845brk
against zackees/ArduinoCore-LPC8xx (real boards/lpc845brk.json present).
Before: `unknown board 'lpc845brk' (no built-in defaults)`.
After: prints `Board: NXP LPC845-BRK / LPC845 @ 30MHz` and progresses
into the actual compile stage (next failure is downstream — fbuild's
nxplpc orchestrator framework-ingestion is still at the Stage 3 stub
per #479; out of scope here).
cargo test -p fbuild-build --lib: 687 passed, 0 failed.
@coderabbitai

Copy link
Copy Markdown

Warning

Review limit reached

@zackees, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 2 minutes and 52 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9169b059-c1a1-4449-987a-68a07479803c

📥 Commits

Reviewing files that changed from the base of the PR and between ba8eb0f and ab5d629.

📒 Files selected for processing (2)
  • crates/fbuild-build/src/pipeline/context.rs
  • crates/fbuild-build/src/script_runtime.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/build-path-board-resolution

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 and usage tips.

@zackees
zackees merged commit d91ddc3 into mainJun 9, 2026
87 checks passed
@zackeeszackees mentioned this pull request Jun 9, 2026
zackees added a commit that referenced this pull request Jun 9, 2026
Ships the daemon-path board-resolution fix from #518 so
`fbuild build <dir>` actually consults `<dir>/boards/<id>.json` for
project-local board manifests. Without this 2.2.23 still fails with
`unknown board 'X'` for ANY project that relies on project-local boards
(LPC8xx is just the first real-world reproducer).
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant

@zackees