chore(paths): route fbuild-deploy tool paths through fbuild-paths - #1383
Conversation
Five tool resolvers in `fbuild-deploy` each hand-rolled
`~/.fbuild/{dev|prod}/tools`, and all five disagreed with `fbuild-paths`
about what dev mode is: they tested `var_os("FBUILD_DEV_MODE").is_some()`,
while `fbuild_paths::is_dev_mode()` requires the literal `1`. So
`FBUILD_DEV_MODE=0` — an explicit opt *out* — sent lpc21isp, probe-rs,
wchisp, wlink and the LPC-Link2 debugger assets to the dev tree while every
other fbuild path stayed in prod. A tool installed where fbuild said to
install it would then go on being not-found. The new test in `lpc.rs` fails
on the old code with exactly that split.
That is the drift #1349 predicted, found by removing the
duplication rather than by hitting it in the field.
`fbuild-paths` grows the accessors the call sites needed and did not have:
- `try_get_fbuild_root` / `try_get_tools_dir` — the `Option`-returning
forms. The resolvers report a missing home directory rather than
panicking, and that is why they re-derived the path instead of calling
`get_fbuild_root`, which panics.
- `get_tools_dir` / `TOOLS_DIR_NAME` — the managed-tools location itself.
- `tools_dir_label` — the `~/.fbuild/{dev|prod}/tools` spelling for
diagnostics, so an install hint names the tree fbuild will actually
search instead of hardcoding `prod`.
Allowlist: 48 -> 43. Lint crate version bumped so the cached `.so` is
rebuilt against the shrunk list.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 30 minutes 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. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day 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 (8)
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 |
First ratchet batch for #1349. Allowlist 48 → 43; all five
fbuild-deployentries are gone.
The drift the ratchet was for
Five tool resolvers — lpc21isp, probe-rs, wchisp, wlink, and the LPC-Link2
debugger assets — each hand-rolled
~/.fbuild/{dev|prod}/tools. All fivedisagreed with
fbuild-pathsabout what dev mode is:FBUILD_DEV_MODE=0var_os("FBUILD_DEV_MODE").is_some()fbuild_paths::is_dev_mode()var(..) == "1"So an explicit opt-out sent every managed tool to the dev tree while every
other fbuild path stayed in prod. A tool installed exactly where fbuild's own
hint said to install it would then go on being not-found — and the hint
hardcoded
prod, so underFBUILD_DEV_MODE=1it named a directory theresolver was not searching either.
The new test in
lpc.rsfails on the old code with precisely that split:This is the failure mode #1349 predicted, found by removing the duplication
rather than by hitting it in the field. It is a behavior change: with
FBUILD_DEV_MODEset to anything other than1, managed tools now resolveunder
prod, consistent with the rest of fbuild.New in
fbuild-pathsThe call sites re-derived the path because the accessor they needed did not
exist —
get_fbuild_root()panics when the home directory cannot bedetermined, and these resolvers return
Option/Resulton purpose so ahome-less environment stays diagnosable rather than becoming a crash.
try_get_fbuild_root/try_get_tools_dir— theOption-returning formsget_tools_dir/TOOLS_DIR_NAME— the managed-tools location itselftools_dir_label— the~/.fbuild/{dev|prod}/toolsspelling fordiagnostics, so an install hint names the tree fbuild will actually search
Verification
The lint is live on these files, not merely silent: with the allowlist entries
removed, a canary
".fbuild/build"literal reintroduced intowlink.rsfailsthe build —
— and passes with the canary removed.
soldr cargo test -p fbuild-deploy: 286passed, 0 failed. Lint crate version bumped so the cached
.sois rebuiltagainst the shrunk allowlist.
Also hoists the module's existing env-var mutex over the two tests that now
read a
FBUILD_DEV_MODE-derived path, with a drop-guard restore, so a failingassertion cannot leave a flipped value behind for a sibling test.