Skip to content

feat(build): EnvNamespace + unified build_flags overlay propagation (#574)#1022

Merged
zackees merged 1 commit into
mainfrom
feat/574-env-namespace-build-flags
Jul 10, 2026
Merged

feat(build): EnvNamespace + unified build_flags overlay propagation (#574)#1022
zackees merged 1 commit into
mainfrom
feat/574-env-namespace-build-flags

Conversation

@zackees

@zackees zackees commented Jul 10, 2026

Copy link
Copy Markdown
Member

Fixes #574. Two concrete pieces of the env-driven namespacing design:

1. Typed EnvNamespace

fbuild_core::EnvNamespace { env_id, platform, board, framework } — the platformio.ini [env:*] routing triplet — with slug() (per-env build output / lib cache key) and framework_segment(). Built via BuildContext::env_namespace(env_id, platform).

2. Single-source-of-truth compile overlays

The (user_overlay, src_overlay) assembly that decides which flags reach each TU was copy-pasted in three places (pipeline::sequential, esp32, nxplpc) — a drift risk. Extracted BuildContext::compile_overlays() (+ _with_base for esp32's SDK-defines prepend) over a pure, unit-tested assemble_compile_overlays. All three now call it, so [env:*] build_flags reach framework/core + library + sketch compiles uniformly by construction.

Fixes a real inconsistency: params.extra_build_flags (caller one-off flags, e.g. QEMU defines) were applied on the ESP32 path but dropped by the shared sequential pipeline. Now folded into user_flags in BuildContext::new — every orchestrator applies them.

Plus docs/namespacing.md.

Scope note

The nxplpc "drops build_flags" symptom that motivated #574 was already retired on main (#576/#587). The residual work is the typing (criterion 1) + the structural de-duplication that guarantees uniform propagation (criterion 3) + docs (criterion 4). Threading EnvNamespace into every fetcher/cache-path (criterion 2's full breadth) and fbuild cache gc --env are follow-ups on this foundation.

Verified — local + Linux Docker

cargo check --workspace green (2m04s); tests: core 237 + engine 366 + arm 195 + esp 92 pass on Linux (incl. EnvNamespace + overlay-assembly). clippy -D warnings + fmt clean.

🤖 Generated with Claude Code

…574)

Two concrete pieces of the env-driven namespacing design:

1. **Typed `EnvNamespace { env_id, platform, board, framework }`** in fbuild-core
   — the `platformio.ini [env:*]` routing triplet, with `slug()` (per-env build
   output / lib cache key) and `framework_segment()` helpers. Constructed via
   `BuildContext::env_namespace(env_id, platform)`.

2. **Single-source-of-truth compile overlays.** The (user_overlay, src_overlay)
   assembly that decides which flags reach each translation unit was copy-pasted
   in three places (`pipeline::sequential`, esp32 orchestrator, nxplpc
   orchestrator) — a drift risk. Extracted `BuildContext::compile_overlays()`
   (+ `_with_base` for esp32's SDK-defines prepend) over a pure, unit-tested
   `assemble_compile_overlays`. All three now call it, so `[env:*] build_flags`
   reach framework/core + library + sketch compiles uniformly by construction.

   Fixes a real inconsistency along the way: `params.extra_build_flags`
   (caller-injected one-off flags, e.g. QEMU emulation defines) were applied on
   the ESP32 path but DROPPED by the shared sequential pipeline — the same build
   behaved differently across platforms. They're now folded into `user_flags` in
   `BuildContext::new`, so every orchestrator applies them.

Plus `docs/namespacing.md` documenting the namespace layout + propagation rule.

Note: the nxplpc "drops build_flags" symptom that motivated #574 was already
retired on main (#576/#587); the residual work is the typing + the structural
de-duplication that prevents that class of bug from recurring. Threading
EnvNamespace into every fetcher/cache-path (criterion 2's full breadth) and
`fbuild cache gc --env` are follow-ups on this foundation.

Verified: EnvNamespace (3) + overlay-assembly (1) unit tests; workspace compiles;
clippy -D warnings + fmt clean.

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

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 4 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

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.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 362794c5-d1bf-4846-b993-07f6f57d4ef6

📥 Commits

Reviewing files that changed from the base of the PR and between c3e9333 and 8b64f5d.

📒 Files selected for processing (7)
  • crates/fbuild-build-arm/src/nxplpc/orchestrator.rs
  • crates/fbuild-build-engine/src/pipeline/context.rs
  • crates/fbuild-build-engine/src/pipeline/sequential.rs
  • crates/fbuild-build-esp/src/esp32/orchestrator/build.rs
  • crates/fbuild-core/src/env_namespace.rs
  • crates/fbuild-core/src/lib.rs
  • docs/namespacing.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/574-env-namespace-build-flags

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 f41a34f into main Jul 10, 2026
88 of 93 checks passed
@zackees
zackees deleted the feat/574-env-namespace-build-flags branch July 10, 2026 00:33
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 10, 2026
Sign up for free to 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.

fbuild: design unified namespaced routing for platform/framework/library artifacts driven by platformio.ini [env:*]

1 participant