feat(bridges): internal-API + dylint sweep (#844) — phase 1 + initial migrations#849
Conversation
… migrations
Phase 1 — bridge APIs + lint crates:
- fbuild_core::http::{client, client_with_timeout, blocking_client}
(hoisted from fbuild_packages; fbuild_packages::http now re-exports)
- fbuild_core::fs::* (curated re-export of tokio::fs::* + write_atomic)
- fbuild_core::time::{sleep, timeout, interval, Duration, +10 named constants}
- fbuild_core::channel::{bounded, unbounded, Sender, Receiver, UnboundedSender, UnboundedReceiver}
- fbuild_core::path::{canonicalize_existing, strip_unc_prefix}
- fbuild_paths::{dev_or_prod_temp_root, temp_subdir}
- fbuild_cli::output::{progress, result, warn, error, debug}
10 new dylint crates (all with zero allowlist where possible):
- ban_bare_reqwest
- ban_std_fs_in_async (scoped to fbuild-daemon/src/** in Phase 1)
- ban_tokio_fs_direct_import
- ban_std_thread_sleep
- ban_std_mpsc_in_async_reachable
- ban_tokio_mpsc_direct_import
- ban_std_fs_canonicalize
- ban_runtime_new_outside_main
- ban_poison_panic
- ban_print_in_production
Phase 2 — migrations:
- HTTP: 11 reqwest::Client::new sites → fbuild_core::http::client*
- Runtime::new(): 4 sites in fbuild-packages + 1 in fbuild-python → module
OnceLock or pyo3_async_runtimes::tokio::get_runtime()
- Channels: 8 tokio::sync::mpsc direct usages → fbuild_core::channel
- Canonicalize: 10 sites kept sync, allowlisted by file-path (async cascade
out of scope); 2 daemon-handler std::fs::* in async → fbuild_core::fs::*
- Atomic writes: 5 state-file writers → fbuild_core::fs::write_atomic
- Tempfile root: 4 production sites → fbuild_paths::temp_subdir(name)
- Sleep + Duration: 10 named-constant applications across daemon_client,
deploy, library_compiler; 5 run_command(None) audit decisions
- Poison-panic: 22 Mutex/RwLock sites → unwrap_or_else(|e| e.into_inner())
- CLI println: 256 sites in fbuild-cli/src/cli/** → crate::output::*
- Linker println: 9 per-platform linker eprintln+tracing::info pairs →
single tracing::debug! with platform-scoped target
References #844 (rolls up #845-#848). The unwrap discipline sweep
(item 11, 2,238 sites) and the bulk tempfile migration to drive
allowlist to zero (item 10) remain for follow-up — both production-
code sites in those audits got their highest-impact entries fixed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (138)
📝 WalkthroughWalkthroughIntroduces shared bridge modules in ChangesBridge Sweep: Core APIs, Dylints, and Codebase Migration
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches📝 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 |
Releases the post-#813 / #802 / #826 / #844 work landed across: - PR #843 — workspace-wide timeout sweep (#802 family) - PR #837, #849, #850, #851 — internal-bridges + dylint sweep (#826 + #844) - PR #842 — async migration follow-ups (#813) 15 dylints now ship in dylints/ (4 from earlier, 10 from #826/#844, plus the renamed ban_unwrap_in_production). 7 internal bridge APIs: fbuild_core::{http, fs, time, channel, path::canonicalize_existing}, fbuild_paths::temp_subdir, fbuild_cli::output. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Phase 1 + initial Phase 2 of #844. Establishes the internal bridge API + dylint ban pattern across 7 new bridges + 10 new lint crates, then migrates the highest-impact production sites for each.
Bridges added (Phase 1)
fbuild_core::http::{client, client_with_timeout, blocking_client}reqwest::Client::new,reqwest::get,reqwest::blocking::*fbuild_core::fs::*+write_atomictokio::fs::*direct import;std::fs::writefor state filesfbuild_core::time::{sleep, +10 named constants}std::thread::sleep; bareDuration::from_secs(N)SHORT/MEDIUM/LONG_HTTP_TIMEOUT,POLL_50/100/200/500MS,REAL_BUILD_TIMEOUT, etc.fbuild_core::channel::{bounded, unbounded}std::sync::mpsc, directtokio::sync::mpscfbuild_core::path::canonicalize_existingstd::fs::canonicalize\?\UNC, returnsNormalizedPathfbuild_paths::temp_subdir(name)tempfile::TempDir::new()fbuild_cli::output::{progress, result, warn, error, debug}println!/eprintln!in CLILint crates added (10, all zero allowlist where possible)
ban_bare_reqwest,ban_std_fs_in_async(daemon-scoped Phase 1),ban_tokio_fs_direct_import,ban_std_thread_sleep,ban_std_mpsc_in_async_reachable,ban_tokio_mpsc_direct_import,ban_std_fs_canonicalize,ban_runtime_new_outside_main,ban_poison_panic,ban_print_in_production.Migrations applied (Phase 2)
reqwest::Client::new()calls in fbuild-python/cli/daemon-tests →fbuild_core::http::client*OnceLock<Runtime>(fbuild-packages);pyo3_async_runtimes::tokio::get_runtime()(fbuild-python)tokio::sync::mpscdirect usage in daemon/build →fbuild_core::channelstd::fs::*→fbuild_core::fs::*; 10 sync canonicalize sites allowlisted with in-code justification (async cascade out of scope)std::fs::writefor state files →fbuild_core::fs::write_atomic(build_info, status_manager, symbols_cmd, clang_tools, clangd_config)tempfile::TempDir::new()→tempfile::tempdir_in(temp_subdir(name))run_command(None)explicit-timeout auditMutex::lock().unwrap()→ `unwrap_or_else(fbuild-cli/src/cli/**→crate::output::{progress,result,warn,error,debug}eprintln!+tracing::info!pairs → singletracing::debug!with platform-scoped targetTest plan
What's NOT in this PR (deferred follow-ups, still tracked in #844)
References #844 (rolls up #845-#848).
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Chores