fix(build): thread caller PATH per request into daemon tool resolution (#1219) - #1236
Conversation
|
Warning Review limit reached
Next review available in: 35 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (33)
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. Comment |
#1219) The daemon captured PATH once at spawn and lived up to 12h, so bare-name tool spawns (esptool, python, objcopy) resolved against whichever shell happened to start the daemon. Forward the CLI caller PATH on every build request (BuildRequest -> BuildParams, like src_dir/pio_env) and apply it at the bare-name spawn sites: esp32/esp8266 esptool elf2image, the find_python probe plus extra-script interpreter execution, the gen_esp32part spawn, and the ch32v objcopy. Caller PATH replaces the child PATH; an absent field keeps legacy daemon-env behavior, so the HTTP API stays backward compatible. Deploy-side threading is #1234. Also fixes a latent Windows env-overlay bug found by the new contract test: compute_env kept both Path (parent spelling) and PATH (overlay) entries, and whichever Command::env applied last silently won. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
624ebd8 to
01d3634
Compare
…#1240) Closes #1238 BinArtifactCache gains a serde-defaulted esptool_fingerprint: empty for a provisioned absolute-path esptool (resolution cannot drift, so pre-existing cache records stay valid and caching behaves exactly as before), a short SHA-256 of the caller's PATH for bare-name spawns. Since #1236 the esptool spawn resolves against the per-request caller PATH, so two requests with different caller PATHs can resolve different esptool binaries — they must never share a cached firmware.bin. The shared BUILD_FINGERPRINT_VERSION constant is left untouched: bumping it would invalidate every unrelated cache, and the serde default already yields the correct match semantics. Also adds the end-to-end subprocess test proving run_command resolves a bare executable from an overlay PATH (staged uniquely named probe in a TempDir), that absolute-path spawns work without an overlay, and that the bare name fails without the overlay. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Closes #1219
Problem
Tool resolution for bare-name spawns was bound to whichever environment spawned the daemon — for up to 12 h (
IDLE_TIMEOUT). Two byte-identical builds could resolve different toolchains (esptool, the Python that runsextra_scripts, objcopy) depending only on which shell started the daemon. This is the mechanism behind the #1217 FastLED CI outage.Fix
Forward the CLI caller's
PATHon every build request and use it at the bare-name spawn sites (issue's "suggested direction 1"):src_dir/pio_envforwarding): CLI setscaller_pathfrom its own env →BuildRequest(serde-optional; old clients omit it and get today's behavior — HTTP API stays backward compatible) → daemon handler →BuildParams.caller_path.PATHis replaced viarun_command's env overlay;None⇒ legacy daemon env):esp32_linkeresptoolelf2imagefallback, and bothboot_artifactsspawns (gen_esp32part python + bootloader elf2image)esp8266_linkerbare-esptoolconversionscript_runtime:find_python_with_pathprobe and the interpreter invocation that runsextra_scripts(so imports/subprocess resolution inside the script see the same environment the probe did)ch32v_linkerobjcopy (via a newLinkerBase::objcopy_firmware_with_env; AVR/Teensy callers unchanged)BuildParamsliteral carries an explicitNone+ comment pointing there).Latent Windows bug fixed along the way
The new contract test exposed that
compute_envkept bothPath(parent spelling) andPATH(overlay) entries;Command::env's case-insensitive child-env map let whichever applied last silently win — i.e. a PATH overlay could be discarded.compute_envnow drops case-variant keys before inserting an overlay var, with a real child-process test asserting the overlay value is exactly what the child sees.Tests
env_overlay_path_reaches_child_over_case_variant(fbuild-core, real child process)test_find_python_with_path_replaces_inherited_path(empty-dir PATH must make the probe fail even though the daemon env has python — the load-bearing regression; on Windows the strict assertion skips when%WINDIR%\py.exeexists, since the OS's system-dir exe fallback forpyis Windows resolution, not a PATH leak) +..._none_matches_find_pythonbuild_request_caller_path_defaults_to_none/..._forwarded(daemon serde compat)test_with_caller_path_stores_value(ch32v builder)Validation
soldr cargo check --workspace --all-targets— cleansoldr cargo clippy --workspace --all-targets -- -D warnings— cleansoldr cargo fmt --all— applied (includes a formatting-only normalization ofdaemon_crash_recovery.rsfrom test(cli): pin daemon crash-recovery with a real-process regression test (#1228) #1232)🤖 Generated with Claude Code