Skip to content

feat(clean): add standalone framework cache cleanup#1101

Merged
zackees merged 1 commit into
mainfrom
feat/clean-framework-cache
Jul 21, 2026
Merged

feat(clean): add standalone framework cache cleanup#1101
zackees merged 1 commit into
mainfrom
feat/clean-framework-cache

Conversation

@zackees

@zackees zackees commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

  • add daemon-coordinated build clean sketch|all with quick/release profile selection
  • add clean-only build plumbing that removes exact framework cache entries and build outputs without compiling or linking
  • keep normal sequential builds cache-aware, and add idempotent FrameworkCoreCache removal plus docs/tests

Validation

  • soldr cargo fmt --all
  • soldr cargo clippy -p fbuild-build-engine -p fbuild-build-esp -p fbuild-build -p fbuild-daemon -p fbuild-cli --all-targets -- -D warnings
  • soldr cargo test -p fbuild-cli --bin fbuild -- (175 passed)
  • soldr cargo test -p fbuild-build-engine framework_core_cache::tests::remove_deletes_only_the_selected_cache_entry --lib (passed)

Closes #1089

Summary by CodeRabbit

  • New Features
    • Added the fbuild clean command for removing project outputs without compiling or deploying.
    • Added sketch and all cleanup scopes, with optional quick or release profiles.
    • Cleanup can remove reusable framework cache entries when using the all scope.
  • Documentation
    • Added CLI reference documentation, examples, scope details, and profile guidance.
  • Bug Fixes
    • Cleanup now preserves unrelated cache entries and handles already-removed entries safely.

@coderabbitai

coderabbitai Bot commented Jul 21, 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: 54 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: 27e476b6-fdb1-4a32-a241-0215291b17b9

📥 Commits

Reviewing files that changed from the base of the PR and between e9fb604 and ff58314.

📒 Files selected for processing (30)
  • agents/docs/commands-reference.md
  • crates/fbuild-build-engine/src/framework_core_cache.rs
  • crates/fbuild-build-engine/src/lib.rs
  • crates/fbuild-build-engine/src/pipeline/sequential.rs
  • crates/fbuild-build-esp/src/esp32/orchestrator/build.rs
  • crates/fbuild-build-esp/src/esp32/orchestrator/framework_libs.rs
  • crates/fbuild-build/src/compile_many.rs
  • crates/fbuild-build/tests/avr_build.rs
  • crates/fbuild-build/tests/eh_frame_strip_esp32.rs
  • crates/fbuild-build/tests/esp32_build.rs
  • crates/fbuild-build/tests/nxplpc_build_flags.rs
  • crates/fbuild-build/tests/nxplpc_core_compile_commands.rs
  • crates/fbuild-build/tests/stm32_acceptance.rs
  • crates/fbuild-build/tests/teensy30_acceptance.rs
  • crates/fbuild-build/tests/teensy_build.rs
  • crates/fbuild-build/tests/teensylc_acceptance.rs
  • crates/fbuild-cli/src/cli/args.rs
  • crates/fbuild-cli/src/cli/build.rs
  • crates/fbuild-cli/src/cli/clean.rs
  • crates/fbuild-cli/src/cli/dispatch.rs
  • crates/fbuild-cli/src/cli/mod.rs
  • crates/fbuild-cli/src/cli/tests.rs
  • crates/fbuild-cli/src/daemon_client/types.rs
  • crates/fbuild-cli/src/mcp/tools.rs
  • crates/fbuild-daemon/src/handlers/emulator/select.rs
  • crates/fbuild-daemon/src/handlers/emulator/tests_process.rs
  • crates/fbuild-daemon/src/handlers/operations/build.rs
  • crates/fbuild-daemon/src/handlers/operations/deploy.rs
  • crates/fbuild-daemon/src/models.rs
  • docs/reference/cli.md
📝 Walkthrough

Walkthrough

Adds fbuild clean sketch|all, propagates clean_only through CLI and daemon requests, removes exact framework cache entries, deletes project outputs without building, and updates ordinary build call sites, tests, and documentation.

Changes

Clean command and documentation

Layer / File(s) Summary
CLI parsing and dispatch
crates/fbuild-cli/src/cli/args.rs, crates/fbuild-cli/src/cli/clean.rs, crates/fbuild-cli/src/cli/dispatch.rs, crates/fbuild-cli/src/cli/tests.rs
Adds fbuild clean with sketch/all scopes, profile flags, daemon request execution, dispatch wiring, and parsing tests.
CLI reference
docs/reference/cli.md, agents/docs/commands-reference.md
Documents cleanup scopes, profiles, locking, and examples.

Build request and cleanup pipeline

Layer / File(s) Summary
Request contract and forwarding
crates/fbuild-cli/src/daemon_client/types.rs, crates/fbuild-daemon/src/models.rs, crates/fbuild-daemon/src/handlers/operations/*
Adds serde-defaulted clean_only request data and forwards it into build parameters.
Output and cache removal
crates/fbuild-build-engine/src/framework_core_cache.rs, crates/fbuild-build-engine/src/pipeline/sequential.rs, crates/fbuild-build-esp/src/esp32/orchestrator/*
Removes exact cache entries, deletes project build outputs, returns early for clean-only requests, and skips framework compilation.
Build call-site updates
crates/fbuild-build/src/compile_many.rs, crates/fbuild-build/tests/*
Explicitly sets clean_only: false for ordinary build helpers and integration tests.

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

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant Daemon
  participant BuildPipeline
  participant FrameworkCoreCache
  participant ProjectOutputs
  CLI->>Daemon: submit clean request
  Daemon->>BuildPipeline: forward clean_only and clean_all
  BuildPipeline->>FrameworkCoreCache: remove matching entry for clean all
  BuildPipeline->>ProjectOutputs: delete project build directory
  BuildPipeline-->>Daemon: return clean result
  Daemon-->>CLI: stream operation result
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 matches the main change: adding standalone cleanup for framework cache and build outputs.
Linked Issues check ✅ Passed The PR appears to satisfy the clean sketch/all commands, exact cache removal, clean-only plumbing, docs, and tests described in #1089.
Out of Scope Changes check ✅ Passed The changes stay focused on clean command plumbing, cache removal, docs, and tests with no clear unrelated additions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/clean-framework-cache

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.

@zackees
zackees force-pushed the feat/clean-framework-cache branch from e9fb604 to ff58314 Compare July 21, 2026 22:25
@zackees
zackees merged commit eb2a91a into main Jul 21, 2026
91 of 96 checks passed
@zackees
zackees deleted the feat/clean-framework-cache branch July 21, 2026 22:28

@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: 3

🧹 Nitpick comments (1)
crates/fbuild-daemon/src/models.rs (1)

561-566: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add positive deserialization coverage for clean_only: true.

The current test proves only that omitted fields default to false; it does not verify the new value that activates clean-only behavior. Add a request containing "clean_only": true and assert that it deserializes to true.

As per path instructions: write tests as the specification and cover request-semantics contract boundaries.

🤖 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-daemon/src/models.rs` around lines 561 - 566, Extend the
build_request_defaults test to deserialize a request containing "clean_only":
true and assert req.clean_only is true, while preserving the existing
omitted-field assertions for false defaults. This should explicitly cover the
positive deserialization contract for BuildRequest.clean_only.

Source: Path instructions

🤖 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 `@agents/docs/commands-reference.md`:
- Line 15: Escape the pipe character in the command name within the Markdown
table row so “sketch|all” remains in a single cell and the “See more” value is
preserved. Update only the affected command-name entry in the documentation
table.

In `@crates/fbuild-build-engine/src/pipeline/sequential.rs`:
- Around line 107-122: Make clean-all fail when exact cache eviction fails
instead of logging a warning and returning success. In sequential.rs, propagate
errors from core_cache.remove() in the clean_all branch; apply the same
propagation to the ESP32 core-cache removal in build.rs and framework-library
cache removal in framework_libs.rs, preserving successful removal handling.

In `@crates/fbuild-build-esp/src/esp32/orchestrator/build.rs`:
- Around line 628-648: Gate the fast-path reuse and project-as-library
compilation paths in the build orchestration flow on !params.clean_only,
ensuring neither executes for clean-only builds. Let clean-only requests reach
the existing params.clean_only branch, including cache eviction for clean all,
without compiling sources.

---

Nitpick comments:
In `@crates/fbuild-daemon/src/models.rs`:
- Around line 561-566: Extend the build_request_defaults test to deserialize a
request containing "clean_only": true and assert req.clean_only is true, while
preserving the existing omitted-field assertions for false defaults. This should
explicitly cover the positive deserialization contract for
BuildRequest.clean_only.
🪄 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: 8c2ffec7-484f-4f9a-956b-ec373403475e

📥 Commits

Reviewing files that changed from the base of the PR and between cd210ee and e9fb604.

📒 Files selected for processing (30)
  • agents/docs/commands-reference.md
  • crates/fbuild-build-engine/src/framework_core_cache.rs
  • crates/fbuild-build-engine/src/lib.rs
  • crates/fbuild-build-engine/src/pipeline/sequential.rs
  • crates/fbuild-build-esp/src/esp32/orchestrator/build.rs
  • crates/fbuild-build-esp/src/esp32/orchestrator/framework_libs.rs
  • crates/fbuild-build/src/compile_many.rs
  • crates/fbuild-build/tests/avr_build.rs
  • crates/fbuild-build/tests/eh_frame_strip_esp32.rs
  • crates/fbuild-build/tests/esp32_build.rs
  • crates/fbuild-build/tests/nxplpc_build_flags.rs
  • crates/fbuild-build/tests/nxplpc_core_compile_commands.rs
  • crates/fbuild-build/tests/stm32_acceptance.rs
  • crates/fbuild-build/tests/teensy30_acceptance.rs
  • crates/fbuild-build/tests/teensy_build.rs
  • crates/fbuild-build/tests/teensylc_acceptance.rs
  • crates/fbuild-cli/src/cli/args.rs
  • crates/fbuild-cli/src/cli/build.rs
  • crates/fbuild-cli/src/cli/clean.rs
  • crates/fbuild-cli/src/cli/dispatch.rs
  • crates/fbuild-cli/src/cli/mod.rs
  • crates/fbuild-cli/src/cli/tests.rs
  • crates/fbuild-cli/src/daemon_client/types.rs
  • crates/fbuild-cli/src/mcp/tools.rs
  • crates/fbuild-daemon/src/handlers/emulator/select.rs
  • crates/fbuild-daemon/src/handlers/emulator/tests_process.rs
  • crates/fbuild-daemon/src/handlers/operations/build.rs
  • crates/fbuild-daemon/src/handlers/operations/deploy.rs
  • crates/fbuild-daemon/src/models.rs
  • docs/reference/cli.md

| Command | Use this when | See more |
|---|---|---|
| `fbuild build` | You want to compile firmware for the env specified by `-e <env>` and `<project_dir>`. The default path; cache via daemon. | `fbuild help build` |
| `fbuild clean sketch|all` | You want to remove one environment/profile's project outputs, optionally including its exact reusable framework-cache entries, without compiling or deploying. | `fbuild help clean`, FastLED/fbuild#1089 |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Escape the pipe in the command name.

sketch|all creates an extra table cell, so the “See more” value is dropped.

Proposed fix
-| `fbuild clean sketch|all` | You want to remove one environment/profile's project outputs, optionally including its exact reusable framework-cache entries, without compiling or deploying. | `fbuild help clean`, FastLED/fbuild#1089 |
+| `fbuild clean sketch\|all` | You want to remove one environment/profile's project outputs, optionally including its exact reusable framework-cache entries, without compiling or deploying. | `fbuild help clean`, FastLED/fbuild#1089 |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `fbuild clean sketch|all` | You want to remove one environment/profile's project outputs, optionally including its exact reusable framework-cache entries, without compiling or deploying. | `fbuild help clean`, FastLED/fbuild#1089 |
| `fbuild clean sketch\|all` | You want to remove one environment/profile's project outputs, optionally including its exact reusable framework-cache entries, without compiling or deploying. | `fbuild help clean`, FastLED/fbuild#1089 |
🧰 Tools
🪛 LanguageTool

[style] ~15-~15: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...ld| |fbuild clean sketch|all` | You want to remove one environment/profile's projec...

(REP_WANT_TO_VB)

🪛 markdownlint-cli2 (0.23.0)

[warning] 15-15: Table column count
Expected: 3; Actual: 4; Too many cells, extra data will be missing

(MD056, table-column-count)

🤖 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 `@agents/docs/commands-reference.md` at line 15, Escape the pipe character in
the command name within the Markdown table row so “sketch|all” remains in a
single cell and the “See more” value is preserved. Update only the affected
command-name entry in the documentation table.

Source: Linters/SAST tools

Comment on lines +107 to +122
if params.clean_all {
let _g = perf.phase("core-cache-remove");
match core_cache.remove() {
Ok(()) => tracing::info!(
"removed framework core cache key={} at {}",
core_cache.key(),
core_cache.path().display()
),
Err(error) => tracing::warn!(
"failed to remove framework core cache key={} at {}: {}",
core_cache.key(),
core_cache.path().display(),
error
),
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Fail clean all when exact cache eviction fails. These paths only warn on removal errors and then report a successful cleanup, leaving reusable cache entries intact.

  • crates/fbuild-build-engine/src/pipeline/sequential.rs#L107-L122: propagate core_cache.remove() failures instead of continuing to the successful clean-only result.
  • crates/fbuild-build-esp/src/esp32/orchestrator/build.rs#L613-L627: propagate ESP32 core-cache removal failures.
  • crates/fbuild-build-esp/src/esp32/orchestrator/framework_libs.rs#L105-L112: propagate ESP32 framework-library cache removal failures.
📍 Affects 3 files
  • crates/fbuild-build-engine/src/pipeline/sequential.rs#L107-L122 (this comment)
  • crates/fbuild-build-esp/src/esp32/orchestrator/build.rs#L613-L627
  • crates/fbuild-build-esp/src/esp32/orchestrator/framework_libs.rs#L105-L112
🤖 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-build-engine/src/pipeline/sequential.rs` around lines 107 -
122, Make clean-all fail when exact cache eviction fails instead of logging a
warning and returning success. In sequential.rs, propagate errors from
core_cache.remove() in the clean_all branch; apply the same propagation to the
ESP32 core-cache removal in build.rs and framework-library cache removal in
framework_libs.rs, preserving successful removal handling.

Comment thread crates/fbuild-build-esp/src/esp32/orchestrator/build.rs
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Jul 22, 2026
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.

feat(build): retain verified framework caches for clean builds

1 participant