Skip to content

fix(daemon): resolve test-emu project_dir against the caller's cwd (#1415) - #1591

Merged
zackees merged 2 commits into
mainfrom
fix/1415-test-emu-project-dir
Sep 29, 2026
Merged

zackees merged 2 commits into
mainfrom
fix/1415-test-emu-project-dir

Conversation

@zackees

@zackees zackees commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Refs #1415.

build, deploy and install_deps already resolve project_dir via resolve_request_project_dir; POST /api/test-emu was the remaining handler reading the raw string against the daemon's own cwd, so a second project's test-emu within the daemon idle window ran the first project's sketch. It now uses the same resolver, and its lock/error text names the resolved absolute path.

Regression tests (tests_project_dir.rs): project_dir: "." with caller_cwd elsewhere reads the caller's platformio.ini (the daemon cwd has none); a missing relative dir reports the resolved path.

Not covered here: the monitor/reset handlers don't take a project_dir from what I found; the issue can be closed once this merges unless you know of others.

Summary by CodeRabbit

  • Bug Fixes
    • Emulator test requests now resolve relative project directories using the caller’s working directory, helping the endpoint locate the intended project.
    • When a project directory is missing, the error message now identifies its resolved path.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

Next included review available in 40 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: FastLED/fbuild/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 5f983ca7-9e7a-4cb4-aa97-dbf72eca0c43

📥 Commits

Reviewing files that changed from the base of the PR and between 1520b87 and 31ea47f.

📒 Files selected for processing (1)
  • crates/fbuild-daemon/src/handlers/emulator/tests_project_dir.rs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: FastLED/fbuild/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 834d450e-8f85-4a88-a097-4759dd705e91

📥 Commits

Reviewing files that changed from the base of the PR and between a1b1ade and 1520b87.

📒 Files selected for processing (4)
  • crates/fbuild-daemon/src/handlers/emulator/mod.rs
  • crates/fbuild-daemon/src/handlers/emulator/select.rs
  • crates/fbuild-daemon/src/handlers/emulator/tests_project_dir.rs
  • crates/fbuild-daemon/src/handlers/operations/mod.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The emulator test handler now resolves the request’s project directory using the optional caller working directory. Its operation-guard label and missing-directory error use the resolved path. Tests cover relative and missing project directories.

Changes

Emulator project directory resolution

Layer / File(s) Summary
Resolve project directory in emulator tests
crates/fbuild-daemon/src/handlers/operations/mod.rs, crates/fbuild-daemon/src/handlers/emulator/select.rs, crates/fbuild-daemon/src/handlers/emulator/tests_project_dir.rs, crates/fbuild-daemon/src/handlers/emulator/mod.rs
The operations module re-exports resolve_request_project_dir. test_emu uses it with the request project path and optional caller working directory. The operation-guard label and missing-directory error report the resolved path. Tests cover a relative path with a bogus platform configuration and a missing relative directory. The test module is included only in test builds.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 1520b

No actionable issue remains; the change is ready to merge after normal checks.

Architecture Summary

Architecture risk: 🟡 Medium · up to 1520b

The change affects 1 system.

Changed systems: crates

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 4 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/fbuild-daemon/src/handlers/emulator/mod.rs: Adds the tests_project_dir module under #[cfg(test)], so it is included only in test builds.
  • observed — Modified behavior in crates/fbuild-daemon/src/handlers/emulator/select.rs: test_emu now resolves the project directory using req.project_dir and the optional caller working directory, replacing direct PathBuf construction from the request path.
  • observed — Modified behavior in crates/fbuild-daemon/src/handlers/emulator/select.rs: The operation-guard label and missing-project-directory error now report the resolved project path instead of req.project_dir.
  • observed — Modified behavior in crates/fbuild-daemon/src/handlers/emulator/tests_project_dir.rs: Adds a request helper that supplies project_dir and caller_cwd, plus a test that invokes test_emu with "." and expects a failed response mentioning the bogus platform written to the caller’s platformio.ini.

Reliability and maintainability

  • inferred — Risk-relevant change factors for crates: blast_radius_2; direct_dependents_2
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: resolving test-emu project directories against the caller's working directory.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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 3fa8e78 into main Sep 29, 2026
22 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Sep 30, 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.

1 participant