Skip to content

fix(daemon): resolve a relative project dir against the caller's cwd - #1445

Merged
zackees merged 3 commits into
mainfrom
fix/1441-absolute-project-dir
Sep 18, 2026
Merged

zackees merged 3 commits into
mainfrom
fix/1441-absolute-project-dir

Conversation

@zackees

@zackees zackees commented Sep 18, 2026

Copy link
Copy Markdown
Member

Fixes #1441.

Root cause

It isn't about header-only libraries. fbuild ci/kitchensink build sent the daemon the relative string ci/kitchensink, and the build handler used it as-is (PathBuf::from(&req.project_dir)). Every path derived from it stayed relative: the build dir, libs/, and each downloaded library's -I flag. Meanwhile the compiler runs from the absolute project dir. So the sketch got

-Ici/kitchensink/.fbuild/build/dev/release/libs/arduinojson/src/src

which, resolved from …/ci/kitchensink, points nowhere, and the build failed with fatal error: ArduinoJson.h: No such file or directory. symlink:// libraries were already canonicalised (resolve_local_library_dir), which is why FastLED itself was found. The handler also read the relative path against the daemon's cwd, which only matched the caller's by accident.

Fix

  • CLI: resolve_project_dir() sends an absolute path (std::path::absolute, lexical, no symlink resolution).
  • Daemon: the build, deploy and install-deps handlers resolve a relative project_dir against the request's caller_cwd (resolve_request_project_dir), so every client gets the same answer.

Validation

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Project directories are now resolved consistently against the caller’s working directory, improving build, deployment, and dependency installation when relative paths are used.
    • Absolute paths and the default current-directory behavior continue to work as expected.
  • Tests

    • Added coverage for relative, absolute, missing-working-directory, and default project path scenarios.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: d95abb84-a957-411f-be0a-2ad854d60c51

📥 Commits

Reviewing files that changed from the base of the PR and between cbfbfa3 and a789d36.

📒 Files selected for processing (6)
  • crates/fbuild-cli/src/cli/args.rs
  • crates/fbuild-daemon/src/handlers/operations/build.rs
  • crates/fbuild-daemon/src/handlers/operations/common.rs
  • crates/fbuild-daemon/src/handlers/operations/deploy.rs
  • crates/fbuild-daemon/src/handlers/operations/install_deps.rs
  • crates/fbuild-daemon/src/handlers/operations/tests.rs

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


📝 Walkthrough

Walkthrough

The CLI and daemon now convert project directories to absolute paths. Relative daemon requests use the caller’s working directory. Build, deploy, and dependency installation handlers use the shared resolver. Tests cover relative, absolute, missing-cwd, and "." paths.

Changes

Project Directory Resolution

Layer / File(s) Summary
Path resolution and validation
crates/fbuild-cli/src/cli/args.rs, crates/fbuild-daemon/src/handlers/operations/common.rs, crates/fbuild-daemon/src/handlers/operations/tests.rs
The CLI and daemon resolve project directories lexically to absolute paths. Relative request paths use the caller’s cwd when provided. Tests cover the supported path forms.
Operation path wiring
crates/fbuild-daemon/src/handlers/operations/build.rs, crates/fbuild-daemon/src/handlers/operations/deploy.rs, crates/fbuild-daemon/src/handlers/operations/install_deps.rs
Build, deploy, and dependency installation operations use the shared project-directory resolver before validation and subsequent path operations.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to a789d

The caller-relative path handling is consistently applied across the affected operations, with no actionable current-head risk identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 relative project directories against the caller's working directory in the daemon.
Linked Issues check ✅ Passed This PR implements the required fix for issue #1441. The issue reported that header-only registry libraries were downloaded but not added to the include path because paths derived from relative projec…
Out of Scope Changes check ✅ Passed All changes remain within scope of issue #1441. The modifications to CLI path resolution (args.rs), daemon path resolution (build.rs, deploy.rs, install_deps.rs), the centralized helper (common.rs), a…
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 6 files.
✨ Finishing Touches
📝 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 and others added 3 commits September 18, 2026 11:14
`fbuild ci/kitchensink build` sent the daemon the relative string
"ci/kitchensink", and the build handler used it as-is. Every path
derived from it stayed relative -- the build dir, the downloaded
libraries, and their -I flags -- while the compiler runs from the
absolute project dir. So a registry library's headers were on the
include path under a name that pointed nowhere:

    fatal error: ArduinoJson.h: No such file or directory

(symlink:// libraries were already canonicalised, which is why FastLED
itself was found). It also read the relative path against the daemon's
own cwd, which only matched the caller's by accident.

- CLI: resolve_project_dir() sends an absolute path (std::path::absolute,
  lexical, no symlink resolution).
- Daemon: the build, deploy and install-deps handlers resolve a relative
  project_dir against the request's caller_cwd
  (resolve_request_project_dir), so other clients get the same result.

Fixes #1441

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…laced

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…thbuf)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@zackees
zackees force-pushed the fix/1441-absolute-project-dir branch from 8850257 to a789d36 Compare September 18, 2026 18:14
@zackees
zackees merged commit 2fd322d into main Sep 18, 2026
18 checks passed
@zackees
zackees deleted the fix/1441-absolute-project-dir branch September 18, 2026 18:49
zackees added a commit that referenced this pull request Sep 18, 2026
Ships the fixes FastLED's CI is waiting on:
- #1443 (closes #1440): .ino conversion no longer lifts an #include out of
  its #if. FastLED's root project (Sailboat) builds again.
- #1445 (closes #1441): a relative project dir is resolved against the
  caller's cwd, so downloaded libraries get absolute include paths
  (fbuild ci/kitchensink build could not find ArduinoJson.h).
- #1447 (closes #1442): ESP32 drops core-bundled lib_deps (FS, ArduinoOTA,
  ESPmDNS) before the registry lookup, as RP2040 already did.
- #1446: a pre-unified-toolchain ESP32 platform pin (pioarduino 51.x) warns
  and builds against stable instead of failing on a 404 toolchain URL.
  Regression from #1434; per-MCU toolchain support is #1444.

Also since 2.5.23: honored ESP32 platform pins and PlatformIO-parity
ESP32-S3 size (#1434), fbuild install and split CI caches (#1438),
declared-submodule handling for CH32V and SiLabs (#1439, unblocks
FastLED's mgm240s), and Linux udev setup (#1424).

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Sep 19, 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.

Header-only registry library is fetched but never added to the include path (follow-up to #1276)

1 participant