Skip to content

fix(fbuild-python): forward PLATFORMIO_SRC_DIR through build/deploy requests (#274)#310

Merged
zackees merged 1 commit into
mainfrom
fix/python-src-dir-forward-274
May 30, 2026
Merged

fix(fbuild-python): forward PLATFORMIO_SRC_DIR through build/deploy requests (#274)#310
zackees merged 1 commit into
mainfrom
fix/python-src-dir-forward-274

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented May 30, 2026

Summary

  • Add src_dir: Option<String> to PyO3 OpRequest; populate from PLATFORMIO_SRC_DIR in both sync DaemonConnection and async AsyncDaemonConnection build/deploy requests, matching the CLI.
  • Keep Python signatures unchanged; the env var is read inside the request builder.
  • New PlatformioSrcDirGuard (RAII + module-level Mutex<()>) keeps env-mutating tests serialized without --test-threads=1.

Closes #274.

Test plan

  • soldr cargo check --workspace --all-targets
  • soldr cargo clippy --workspace --all-targets -- -D warnings
  • soldr cargo test -p fbuild-python — 23 tests (10 new, 13 existing)
  • bash ./test full workspace — 0 failures

🤖 Generated with Claude Code

…equests (#274)

The Rust CLI reads `PLATFORMIO_SRC_DIR` and forwards it into
`BuildRequest`/`DeployRequest.src_dir`, but the PyO3 `DaemonConnection` and
`AsyncDaemonConnection` request model omitted `src_dir` entirely. FastLED's
autoresearch wrapper uses the Python binding, so the caller env override was
lost and the daemon fell back to `platformio.ini`'s `src_dir = examples/Sailboat`
instead of the requested `examples/AutoResearch`.

Add `src_dir: Option<String>` to the shared `OpRequest` and a
`platformio_src_dir_from_env()` helper that mirrors the CLI's
`.ok().filter(|s| !s.is_empty())` contract. Both the sync and async
`build_request`/`deploy_request` constructors now populate `src_dir` from the
env var; monitor requests intentionally leave it `None` since the daemon
doesn't compile during monitor. Python signatures are unchanged.

Tests:
- `platformio_src_dir_helper_*` exercise set / unset / empty env values.
- `daemon_connection_*` and `async_daemon_connection_*` request constructors
  verify forwarding when set and omission when unset for both build and deploy.
- `op_request_serializes_src_dir_only_when_set` guards the wire format so the
  daemon's `platformio.ini` fallback still kicks in when the env var is unset.

Env-var tests share a `Mutex<()>` and an RAII guard
(`PlatformioSrcDirGuard`) that holds the lock across set -> call -> assert ->
restore, so cargo's default parallel test runner doesn't race them.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 30, 2026

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 47 minutes and 26 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: df89f310-79aa-4740-b409-f13da8206b5a

📥 Commits

Reviewing files that changed from the base of the PR and between 1a4d661 and 9a471a2.

📒 Files selected for processing (4)
  • crates/fbuild-python/src/async_daemon_connection.rs
  • crates/fbuild-python/src/daemon_connection.rs
  • crates/fbuild-python/src/lib.rs
  • crates/fbuild-python/src/outcome.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/python-src-dir-forward-274

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 8c8163d into main May 30, 2026
82 of 83 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fbuild-python DaemonConnection drops PLATFORMIO_SRC_DIR so FastLED autoresearch builds the wrong sketch

1 participant