From 3a05043a0586baf137fc8194cdd91eefb83062e2 Mon Sep 17 00:00:00 2001 From: zackees Date: Sun, 23 Aug 2026 15:50:19 -0700 Subject: [PATCH] chore(build-engine): route production `.fbuild` walks through fbuild-paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fourth ratchet batch for FastLED/fbuild#1349. Allowlist 33 -> 28. Scoped to `fbuild-build-engine`'s *production* sites — the skip-lists and path walks that decide what a build looks at: - `FAST_PATH_EXCLUDES` and the source scanner's skip-list are `const` arrays, and `FBUILD_DIR_NAME` is a `const &str`, so it drops straight in. - `framework_libs`' two `matches!` arms take it as a const pattern. - `compiler`'s ancestor walk compares against it. - `symbol_analyzer`'s ELF search builds `<.fbuild>/` from both segments rather than spelling the pair. These matter more than a spelling fix: a skip-list that disagrees with the real directory name silently stops excluding the build tree, so a warm build starts fingerprinting its own output. The five test-fixture files in this crate are deliberately left for the next batch — they are a different kind of change (hand-rolled layouts in assertions) and mixing them here would bury the production edits. Verified with a genuinely rebuilt lint: main already carried version 0.1.3, so the usual bump was a no-op and the first clean run could have been a stale `.so` still holding the old allowlist. Bumped to 0.1.4 and re-ran, then confirmed the lint still fires here by reintroducing a canary literal (exit 1, one finding) and removing it again. Co-Authored-By: Claude Opus 5 (1M context) --- .../src/build_fingerprint/fast_path.rs | 2 +- crates/fbuild-build-engine/src/compiler.rs | 2 +- crates/fbuild-build-engine/src/framework_libs.rs | 10 ++++++++-- crates/fbuild-build-engine/src/source_scanner.rs | 2 +- crates/fbuild-build-engine/src/symbol_analyzer/mod.rs | 7 ++++++- dylints/ban_raw_fbuild_path/Cargo.toml | 2 +- dylints/ban_raw_fbuild_path/src/allowlist.txt | 5 ----- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/crates/fbuild-build-engine/src/build_fingerprint/fast_path.rs b/crates/fbuild-build-engine/src/build_fingerprint/fast_path.rs index fe747f94..274cf6b2 100644 --- a/crates/fbuild-build-engine/src/build_fingerprint/fast_path.rs +++ b/crates/fbuild-build-engine/src/build_fingerprint/fast_path.rs @@ -53,7 +53,7 @@ pub const FAST_PATH_EXTENSIONS: &[&str] = &[ /// should not invalidate a warm build. pub const FAST_PATH_EXCLUDES: &[&str] = &[ ".cache", - ".fbuild", + fbuild_paths::FBUILD_DIR_NAME, ".git", ".pio", ".venv", diff --git a/crates/fbuild-build-engine/src/compiler.rs b/crates/fbuild-build-engine/src/compiler.rs index e73b4e96..4da81be1 100644 --- a/crates/fbuild-build-engine/src/compiler.rs +++ b/crates/fbuild-build-engine/src/compiler.rs @@ -363,7 +363,7 @@ fn object_hash_key(source: &Path, build_dir: &Path) -> String { for ancestor in build_dir.ancestors() { if ancestor .file_name() - .map(|n| n == ".fbuild") + .map(|n| n == fbuild_paths::FBUILD_DIR_NAME) .unwrap_or(false) { if let Some(workspace) = ancestor.parent() { diff --git a/crates/fbuild-build-engine/src/framework_libs.rs b/crates/fbuild-build-engine/src/framework_libs.rs index b24bb4c3..9643abcd 100644 --- a/crates/fbuild-build-engine/src/framework_libs.rs +++ b/crates/fbuild-build-engine/src/framework_libs.rs @@ -187,7 +187,13 @@ fn collect_header_basenames(roots: &[PathBuf]) -> HashSet { .to_lowercase(); if matches!( name.as_str(), - ".git" | ".pio" | ".fbuild" | ".zap" | ".build" | "build" | "target" + ".git" + | ".pio" + | fbuild_paths::FBUILD_DIR_NAME + | ".zap" + | ".build" + | "build" + | "target" ) { continue; } @@ -530,7 +536,7 @@ fn should_scan_entry(entry: &DirEntry) -> bool { name.as_str(), ".git" | ".pio" - | ".fbuild" + | fbuild_paths::FBUILD_DIR_NAME | ".zap" | ".build" | "build" diff --git a/crates/fbuild-build-engine/src/source_scanner.rs b/crates/fbuild-build-engine/src/source_scanner.rs index ebb6e803..1c72d85f 100644 --- a/crates/fbuild-build-engine/src/source_scanner.rs +++ b/crates/fbuild-build-engine/src/source_scanner.rs @@ -93,7 +93,7 @@ const EXCLUDE_DIRS: &[&str] = &[ ".git", "__pycache__", "node_modules", - ".fbuild", + fbuild_paths::FBUILD_DIR_NAME, ".venv", "venv", ".cache", diff --git a/crates/fbuild-build-engine/src/symbol_analyzer/mod.rs b/crates/fbuild-build-engine/src/symbol_analyzer/mod.rs index f2ecd1ae..9446bacc 100644 --- a/crates/fbuild-build-engine/src/symbol_analyzer/mod.rs +++ b/crates/fbuild-build-engine/src/symbol_analyzer/mod.rs @@ -557,7 +557,12 @@ pub fn discover_elf_in_project(project_dir: &Path) -> Option { } } // 2. .fbuild and 3. .pio output trees - for relative in [".fbuild/build", ".pio/build"] { + let fbuild_tree = format!( + "{}/{}", + fbuild_paths::FBUILD_DIR_NAME, + fbuild_paths::BUILD_DIR_NAME + ); + for relative in [fbuild_tree.as_str(), ".pio/build"] { let root = project_dir.join(relative); if root.exists() { if let Some(elf) = newest_elf_under(&root) { diff --git a/dylints/ban_raw_fbuild_path/Cargo.toml b/dylints/ban_raw_fbuild_path/Cargo.toml index 452371ad..9fe6efd9 100644 --- a/dylints/ban_raw_fbuild_path/Cargo.toml +++ b/dylints/ban_raw_fbuild_path/Cargo.toml @@ -3,7 +3,7 @@ name = "ban_raw_fbuild_path" # Bump the version to bust the dylint .so cache when allowlist.txt # changes (setup-soldr's dylint-cache key hashes the manifest but not # src/allowlist.txt). Same convention ban_manual_slash_normalize follows. -version = "0.1.3" +version = "0.1.4" description = "Ban raw '.fbuild' path literals outside fbuild-paths" edition = "2021" publish = false diff --git a/dylints/ban_raw_fbuild_path/src/allowlist.txt b/dylints/ban_raw_fbuild_path/src/allowlist.txt index ac3cb3b8..6a584312 100644 --- a/dylints/ban_raw_fbuild_path/src/allowlist.txt +++ b/dylints/ban_raw_fbuild_path/src/allowlist.txt @@ -29,16 +29,11 @@ crates/fbuild-core/src/path.rs # Each line below is a file that spells `.fbuild` by hand today. Removing # a line is the unit of progress on #1349; adding one is not allowed. -crates/fbuild-build-engine/src/build_fingerprint/fast_path.rs crates/fbuild-build-engine/src/build_info.rs crates/fbuild-build-engine/src/compile_database/tests/clang.rs crates/fbuild-build-engine/src/compile_database/tests/generate.rs -crates/fbuild-build-engine/src/compiler.rs crates/fbuild-build-engine/src/compiler_tests.rs -crates/fbuild-build-engine/src/framework_libs.rs crates/fbuild-build-engine/src/linker.rs -crates/fbuild-build-engine/src/source_scanner.rs -crates/fbuild-build-engine/src/symbol_analyzer/mod.rs crates/fbuild-build/src/compile_many.rs crates/fbuild-build/tests/avr_build.rs crates/fbuild-build/tests/clangd_check_parity.rs