Skip to content

refactor(platform): move QEMU runtime-library policy behind the facade (#1315) - #2116

Merged
zackees merged 2 commits into
mainfrom
agent/host-runtime-libs
Nov 20, 2026
Merged

zackees merged 2 commits into
mainfrom
agent/host-runtime-libs

Conversation

@zackees

@zackees zackees commented Nov 20, 2026

Copy link
Copy Markdown
Member

Phase 9/9 of the platform refactor (#1315): the Espressif QEMU toolchain was the
largest remaining host-mechanic group in the enforcement ledger — 9 of 15 rows,
all of them cfg-selected host policy rather than product policy.

What moved

New neutral capability fbuild_core::platform::runtime:

  • probe_binary(binary, library_path) → BinaryProbe — whether an installed
    binary can start, and the linker's own complaint when it cannot.
  • stage_runtime_libraries(binary) — place the libraries a binary needs beside it.
  • runtime_library_dirs(binary) — directories a child needs on its search path.
  • library_path_var() — the variable this host's loader reads, None when it
    resolves libraries another way.

Linux probes the binary with LD_LIBRARY_PATH and stages nothing. Windows
stages libiconv-2.dll beside the executable and reports PATH directories.
macOS binaries are self-contained: it stages and probes nothing.

Call sites

crates/fbuild-toolchain/src/toolchain/esp_qemu.rs: the five
hydrate_windows_runtime + validate_windows_runtime pairs collapse into one
stage_runtime_libraries(&path) call; build_windows_qemu_path_env now composes
the platform's directory list instead of owning the DLL discovery. The
libiconv-2.dll search policy (PATH, %ProgramFiles%\Git, %LOCALAPPDATA%
avr-gcc) moved into the Windows implementation, which is the only host that had
it.

crates/fbuild-toolchain/src/toolchain/esp_qemu_runtime.rs: the private
QemuProbe enum and the #[cfg(target_os)] pair inside probe_qemu_binary
are replaced by the capability; ensure_qemu_can_start keeps the lazy-bundle
policy and the diagnostics, and asks library_path_var() when composing the
probe's search path.

Ledger

rows=15; dylint_rows=15 → rows=6; dylint_rows=6 — a migration, not a
re-baseline: the rows disappear because the cfg selections no longer exist.
ci/platform_boundary_research.tsv regenerated (--write, line-number shifts
only) and the explicit row count in ci/test_enforce_platform_boundary.py
lowered 15 → 6.

Verification

  • soldr cargo test -p fbuild-core --lib platform:: — 77 passed, 0 failed.
  • soldr cargo test -p fbuild-toolchain --lib — 203 passed, 0 failed, 6 ignored
    (includes the three probe tests, now routed through the capability).
  • Red proof: short-circuiting the Linux probe to always report Started makes
    probe_linux_detects_missing_shared_library_exit_127 and
    probe_linux_exports_the_bundle_on_ld_library_path FAIL; restoring it makes
    them pass, so those assertions are not vacuous.
  • soldr cargo check --workspace --all-targets --exclude fbuild-python — clean
    (fbuild-python cannot link on this host: no shared libpython3.14).
  • soldr cargo clippy -p fbuild-core -p fbuild-toolchain --all-targets --no-deps -- -D warnings — clean; cargo fmt --all --check — clean.
  • ci/enforce_platform_boundary.py --print-totals → rows=6; dylint_rows=6,
    exit 0; ci/platform_boundary_research.py --check exit 0;
    ci.test_enforce_platform_boundary + ci.test_platform_boundary_research —
    30 tests OK.

The Windows staging test (staging_copies_a_path_dll_next_to_the_binary) runs in
the full / windows / Check lane; it cannot execute on this Linux host, so the
Windows half of this change is verified by compilation plus that test's
existence, not by a local run.

#1315 stays open (remaining cells: the residue rows and the closing three-host
audit).

The Espressif QEMU toolchain held 9 of the 15 remaining enforcement-ledger
rows: `#[cfg(windows)]`/`#[cfg(not(windows))]` pairs around DLL staging and
`#[cfg(target_os = "linux")]` around the shared-library probe.

Add `platform::runtime` (`probe_binary`, `stage_runtime_libraries`,
`runtime_library_dirs`, `library_path_var`) with per-OS implementations, and
collapse the toolchain's cfg-selected bodies into single calls. Ledger
15 -> 6 (a migration, not a re-baseline).

Refs #1315
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

…very

The dylint path lints reject naming `std::path::PathBuf`, which local clippy
cannot see (#2116 first run). Convert the environment roots with
`Path::new(&os_string)` instead.

Refs #1315
@zackees
zackees added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit dad7c6b Nov 20, 2026
31 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Nov 21, 2026
@zackees
zackees deleted the agent/host-runtime-libs branch November 24, 2026 21:36
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.

1 participant