Skip to content

fix(dylint): clean up violations after dylint-link rollout#991

Merged
zackees merged 2 commits into
mainfrom
fix/990-dylint-cleanup
Jul 7, 2026
Merged

fix(dylint): clean up violations after dylint-link rollout#991
zackees merged 2 commits into
mainfrom
fix/990-dylint-cleanup

Conversation

@zackees

@zackees zackees commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

Closes #964. Advances #990.

Local validation

  • soldr cargo fmt --all
  • git diff --check
  • soldr cargo check -p fbuild-cli --message-format=short
  • soldr --no-cache cargo build -p fbuild-build --message-format=short
  • soldr --no-cache cargo build -p fbuild-cli --bins --message-format=short
  • RUSTDOCFLAGS=-D warnings soldr --no-cache cargo doc -p fbuild-packages --no-deps --message-format=short
  • Docker Linux: soldr cargo check -p fbuild-packages -p fbuild-deploy -p fbuild-build --message-format=short
  • Docker Linux: cargo dylint --all -- --workspace --all-targets
  • Docker Linux: soldr --no-cache cargo build -p fbuild-cli --bins --message-format=short

Summary by CodeRabbit

  • Bug Fixes
    • Improved path handling for builds and tooling so file and directory detection is more consistent across platforms.
    • Fixed library-selection diagnostics so the reported “triggered by” source is more accurate in --explain and --json output.
    • Stabilized embedded and device-related workflows, including boot artifact resolution and probe/tool discovery, with fewer path-related edge cases.
    • Updated support for a legacy serial-port check used for read-only device enumeration.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@zackees, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 19 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

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.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: eabc35a2-84a5-477b-9c1e-14db63bb9450

📥 Commits

Reviewing files that changed from the base of the PR and between 305edaf and 1d86ffd.

📒 Files selected for processing (2)
  • crates/fbuild-cli/src/lib_select.rs
  • crates/fbuild-deploy/src/lpc_debugger_reflash.rs
📝 Walkthrough

Walkthrough

This PR migrates path handling across compile backends, ESP32 orchestrator, deploy tool discovery, and esptool package installation from std::path::PathBuf to fbuild_core::path::NormalizedPath, centralizes object-hash key relativization via path_arg_for_compile_cwd, rewrites a lib_select path-prefix check using normalized keys, and adds a dylint allowlist entry.

Changes

NormalizedPath migration and path-key normalization

Layer / File(s) Summary
Compile backend and object-hash key normalization
crates/fbuild-build/src/compile_backend.rs, crates/fbuild-build/src/compiler.rs, crates/fbuild-build/src/compiler_tests.rs, crates/fbuild-packages/src/library/library_compiler.rs
LibCompileBackend::compile and EmbeddedLibBackend::compile take NormalizedPath cwd; object_hash_key in both files delegates relativization to path_arg_for_compile_cwd with a NormalizedPath fallback; a test assertion updated to compare exact parent path.
ESP32 orchestrator path normalization
crates/fbuild-build/src/esp32/orchestrator/boot_artifacts.rs, .../build.rs, .../packages.rs
resolve_partitions_csv, resolve_esptool, and resolve_pioarduino_packages return/accept NormalizedPath; Esp32Orchestrator::build converts esptool_bin between NormalizedPath/PathBuf/&Path at call sites; related tests updated.
Deploy tool discovery path normalization
crates/fbuild-deploy/src/lpc_debugger_reflash.rs, crates/fbuild-deploy/src/probe_rs.rs
Path-discovery helpers (managed_tools_dir, find_dfu_util, find_lpc_link2_firmware, require_installed, home_dir, managed_probe_rs_path, find_probe_rs, home_dir_local) return NormalizedPath instead of PathBuf; tests updated.
Esptool package install path normalization
crates/fbuild-packages/src/library/esptool.rs
Esptool.project_dir field, from_metadata_url, ensure_installed, staged_install argument, permission fix-up, and find_esptool_binary use NormalizedPath; tests updated.
Normalized path prefix check for library selection
crates/fbuild-cli/src/lib_select.rs
Adds normalize_for_key and a normalized_path_is_under helper replacing direct starts_with containment checks in first_reached_under.
Dylint allowlist entry
dylints/ban_direct_serialport/src/allowlist.txt
Adds an exempt entry for crates/fbuild-deploy/src/lpc.rs for read-only VID/PID enumeration.

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

Possibly related PRs

  • FastLED/fbuild#963: Introduces the path_arg_for_compile_cwd/NormalizedPath-based replacement for manual strip_prefix/slash-normalization used in object hash keying, directly extended by this PR.
  • FastLED/fbuild#987: Introduced the embedded zccache LibCompileBackend dispatch that this PR updates to accept NormalizedPath cwd.
  • FastLED/fbuild#988: Introduced managed esptool provisioning (resolve_pioarduino_packages esptool_bin path) that this PR migrates to NormalizedPath.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The changes clean up linted code, but they do not address the reported dylint alias-loop workflow failure needed to restore CI enforcement. Update the dylint workflow/tooling so cargo-dylint resolves aliased libraries reliably, then verify the job turns green on main.
✅ 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 is concise and clearly describes the lint cleanup after the dylint-link rollout.
Out of Scope Changes check ✅ Passed The edits stay focused on path normalization, lint cleanup, and allowlist adjustments tied to the stated dylint objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/990-dylint-cleanup

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
crates/fbuild-cli/src/lib_select.rs (1)

341-353: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add coverage for normalized_path_is_under. crates/fbuild-cli/tests/lib_select.rs only covers CLI parsing and early exits, so the new path-prefix logic behind triggered_by still lacks direct tests. Cover exact match, trailing-slash prefix matching, and the /foo/barbaz vs /foo/bar negative case.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/fbuild-cli/src/lib_select.rs` around lines 341 - 353, Add direct test
coverage for normalized_path_is_under in lib_select.rs, since the current tests
only exercise CLI parsing and early exits. Update
crates/fbuild-cli/tests/lib_select.rs to verify the helper’s exact-match
behavior, prefix matching when the directory has or needs a trailing slash, and
the negative case where /foo/barbaz must not match /foo/bar. Use
normalized_path_is_under and triggered_by as the key symbols to locate the
path-prefix logic.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/fbuild-deploy/src/lpc_debugger_reflash.rs`:
- Around line 277-286: `home_dir()` only reads `USERPROFILE` on Windows, so add
a `HOME` fallback there to match `probe_rs.rs::home_dir_local()`. Update the
Windows branch in `home_dir()` to try `USERPROFILE` first and then `HOME` if
needed, so callers like `managed_tools_dir()`, `find_dfu_util()`, and
`find_lpc_link2_firmware()` still resolve a home directory in shells that only
set `HOME`.

---

Nitpick comments:
In `@crates/fbuild-cli/src/lib_select.rs`:
- Around line 341-353: Add direct test coverage for normalized_path_is_under in
lib_select.rs, since the current tests only exercise CLI parsing and early
exits. Update crates/fbuild-cli/tests/lib_select.rs to verify the helper’s
exact-match behavior, prefix matching when the directory has or needs a trailing
slash, and the negative case where /foo/barbaz must not match /foo/bar. Use
normalized_path_is_under and triggered_by as the key symbols to locate the
path-prefix logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3a043b48-f7ea-4cdf-8f61-3cb522537c2c

📥 Commits

Reviewing files that changed from the base of the PR and between 7f28fc6 and 305edaf.

⛔ Files ignored due to path filters (1)
  • dylints/ban_std_pathbuf/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • crates/fbuild-build/src/compile_backend.rs
  • crates/fbuild-build/src/compiler.rs
  • crates/fbuild-build/src/compiler_tests.rs
  • crates/fbuild-build/src/esp32/orchestrator/boot_artifacts.rs
  • crates/fbuild-build/src/esp32/orchestrator/build.rs
  • crates/fbuild-build/src/esp32/orchestrator/packages.rs
  • crates/fbuild-cli/src/lib_select.rs
  • crates/fbuild-deploy/src/lpc_debugger_reflash.rs
  • crates/fbuild-deploy/src/probe_rs.rs
  • crates/fbuild-packages/src/library/esptool.rs
  • crates/fbuild-packages/src/library/library_compiler.rs
  • dylints/ban_direct_serialport/src/allowlist.txt

Comment thread crates/fbuild-deploy/src/lpc_debugger_reflash.rs
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.

ci(dylint): Dylint job is red on main — alias-loop workaround fails, so NO custom lints are enforced

1 participant