refactor(platform): migrate device consumers to neutral facade - #1345
Conversation
Phase 8a of the platform-boundary migration (#1314): every remaining per-OS device mechanic outside the platform seam now routes through fbuild-core::platform. - SerialPortFacts gains location_information (Windows SPDRP_LOCATION_INFORMATION) so topology diagnostics survive the seam. - New platform::device::mount_block_devices: udisksctl mechanics move into the Linux selected tree; RP-series ROM mounting calls the facade. - New per-OS selected::host tree behind platform::host::home_dir; lpc/probe_rs/lpc_debugger_reflash drop their local env forks. - rp2040_topology is rebuilt on facade facts; its hand-rolled SetupAPI/advapi32/cfgmgr32 FFI fork is deleted. Deltas: phantom ports now get topology lines like live ones, and endpoints with neither an instance ID nor ancestry report None instead of a flat sentence. - rp2040_mount and fbuild-serial ports.rs lose their target_os cfgs; sysfs enrichment self-noops where live_sysfs_usb_root() is None. Boundary ledger: 57 -> 33 rows; research TSV and dylint baseline regenerated; pinned-count test updated. Co-Authored-By: Claude <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (21)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change moves host and device platform behavior into ChangesPlatform behavior migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to This change centralizes platform-specific device and host behavior behind the facade while preserving the reported verification results; no actionable merge-blocking risk remains beyond normal checks and review. Sequence Diagram(s)sequenceDiagram
participant Deployment
participant fbuild_core
participant PlatformBackend
participant SerialEnumeration
Deployment->>fbuild_core: request home directory or mount device paths
fbuild_core->>PlatformBackend: delegate selected platform operation
PlatformBackend-->>fbuild_core: optional home path or mount processing
fbuild_core-->>Deployment: return platform result
SerialEnumeration->>fbuild_core: enumerate serial-port facts
fbuild_core-->>SerialEnumeration: return location and identity data
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
…ance ban_std_pathbuf forbids raw std::path::PathBuf under crates/fbuild-core/src/platform/; home_dir now returns crate::path::NormalizedPath like the other neutral facades. lpc.rs converts back with into_path_buf(); probe_rs.rs and lpc_debugger_reflash.rs consume the NormalizedPath directly. Co-Authored-By: Claude <noreply@anthropic.com>
d89dcbf to
cc2cba7
Compare
Phase 8a of the platform-boundary migration (#1314): removes all remaining
device-namespace rows from the boundary ledger by moving every per-OS device mechanic still living in consumer crates behindfbuild_core::platform.Ledger: 57 → 33 data rows (all 24
devicerows gone; what remains is fs/ipc/host/process/host_executable for later phases). Research TSV and dylint baseline regenerated; the pinned-count test now asserts 33.Changes
SerialPortFacts.location_information— new fact carrying WindowsSPDRP_LOCATION_INFORMATION(e.g.Port_#0003.Hub_#0004), populated by the SetupAPI enumeration,Noneelsewhere. Topology diagnostics survive the seam without leaking host mechanics.platform::device::mount_block_devices— the udisksctl loop moves fromrp2040_mount.rsinto the Linux selected tree; Windows/macOS are honest no-ops. The RP-series ROM mount path calls the facade and keeps its scan/policy.selected::hosttree +platform::host::home_dir—%USERPROFILE%with%HOME%fallback on Windows,$HOMEelsewhere, returned asNormalizedPathlike the other neutral facades.lpc.rs,probe_rs.rs, andlpc_debugger_reflash.rsdrop their three local env-var forks (one of which lacked the HOME fallback).rp2040_topology.rsrebuilt on facade facts — the hand-rolledsetupapi/advapi32/cfgmgr32FFI fork (~250 lines) is deleted; pure string classification (HubDepth, composite-CDC skipping) is now unconditional and tested on every host. Two deliberate deltas: phantom ports (fbuild port scan misses all PJRC/Teensy (VID 16C0) serial ports + no vendor/product resolution for them #962) get topology lines like live ones — better failure diagnostics — and endpoints with neither an instance ID nor ancestry returnNoneinstead of a flat "unavailable" sentence.rp2040_mount.rs/ports.rsde-cfg'd — candidate discovery is pure and runs everywhere; sysfs health enrichment self-noops whereverlive_sysfs_usb_root()isNone, replacing the#[cfg(target_os)]re-binding block. Stale doc notes about items "not existing cross-host" fixed.Verification
soldr cargo clippy --workspace --all-targets -- -D warningsexit 0bash test(unit + stress + integration) exit 0RUSTDOCFLAGS="-D warnings" soldr cargo doc --workspace --no-depsexit 0ci.test_platform_boundary_research+ci.test_enforce_platform_boundary+ci.test_rust_toolchain_pins(35 tests) OK; research check green on all three host labelslpc.rs, now smaller)Refs #1314
Co-Authored-By: Claude noreply@anthropic.com