Skip to content

feat(esp32): measure per-stage disk footprint and publish the measured minimum (#1750 item 1) - #1773

Merged
zackees merged 1 commit into
mainfrom
agent/disk-footprint
Oct 28, 2026
Merged

zackees merged 1 commit into
mainfrom
agent/disk-footprint

Conversation

@zackees

@zackees zackees commented Oct 28, 2026

Copy link
Copy Markdown
Member

Implements #1750 item 1: "Record the peak disk delta of a cold ESP32 build … and publish a documented minimum per platform. Keep the measured footprint per stage so the estimate tightens as data accumulates."

Why

The pre-flight check (#1767) judges a budget, and that budget was a guess:
ESP32_CACHE_BYTES = 2 GiB, documented as "a platform package (~1.3 GB), a toolchain (~1.0 GB) and the framework install". Measurement says a hydrated pioarduino framework alone is bigger than the whole 2 GiB budget, so the check passed hosts that then hit ENOSPC in the linker — the exact failure it exists to prevent.

What

1. fbuild_build_engine::disk_footprint — per-stage measurement. A recorder samples free space per root at stage boundaries and reports the peak delta per root. Free space, not directory size: this counts everything written by subprocesses and by the embedded zccache service, which a walk of the project tree would miss (and a walk of a warm cache costs ~60 s, while the daemon's GC can move it mid-build).

  • Off by default, same shape as perf_log: FBUILD_DISK_FOOTPRINT=1 emits one summary line; FBUILD_DISK_FOOTPRINT_JSON=<absolute path> also appends one JSON line per build (implies the flag) so measurements accumulate.
  • Zero work when off: sample() returns immediately, drop prints nothing.
  • Unmeasurable roots are skipped with a warning, never fatal — a footprint log must not be able to fail a build.
  • Reuses disk_preflight::{FreeSpace, available_on_volume} (the latter is now pub(crate)) instead of re-deriving volume probing; generic over the probe so the async fn build future stays Send and tests can inject a scripted volume.
  • Wired into the ESP32 orchestrator at three boundaries: pioarduino-resolve, compile, link-convert; the recorder is created right beside the pre-flight it will one day replace.
  • No new policy, no new crate, no automatic eviction, and nothing user-visible unless the flag is set.

2. Measured minimum, published in the code. ESP32_CACHE_BYTES is now 5 GiB, with the measurement in its doc comment:

component measured
pioarduino framework install (incl. tools/esp32-arduino-libs, 2.7 GB) 2.2–2.8 GB
platform package (pioarduino-platform-espressif32) 28 MB
Xtensa toolchain (toolchain-xtensa-esp-elf) 1.1 GB
RISC-V toolchain (toolchain-riscv32-esp, C3/C6/H2/P4) 2.1 GB

→ ~3.9 GiB cold for Xtensa, ~4.9 GiB for RISC-V. PROJECT_BUILD_BYTES stays 256 MiB, now documented against measurement (15–59 MB across nine ESP32 test projects) rather than a guess. FBUILD_MIN_DISK_BYTES still lowers the requirement outright for hosts that already hold part of the cache.

Verification (real output)

soldr test -p fbuild-build-engine --lib disk_footprint
  test result: ok. 8 passed; 0 failed   (stage deltas, peak, freed-space, unmeasurable root,
                                         one-line summary, JSON shape, JSON sink appends per build)
soldr test -p fbuild-build-esp --lib disk_requirements
  test result: ok. 6 passed; 0 failed   (incl. footprint_roots = cache/project/temp, no requirements)
soldr fmt --all                                  clean
soldr clippy --workspace --all-targets -- -D warnings   clean
ci.run_dylint --package fbuild-build-engine      clean (30 dylints)
ci.run_dylint --package fbuild-build-esp         clean
ci/check_dylint_allowlists.py                    current
ci/enforce_platform_boundary.py --print-totals  rows=44; dylint_rows=43
bash test                                        see CI / run log

Live probe through the real HostFreeSpace path against this host's cache root (throwaway check, not committed):

LIVE LINE: [disk-footprint esp32-live] start: cache unchanged, project unchanged | noop: cache unchanged, project unchanged | peak consumed cache 0 bytes, project 0 bytes

Not done (deliberately)

Refs #1750.

…d minimum (#1750 item 1)

The pre-flight check judged a budget that was a guess: ESP32_CACHE_BYTES
was 2 GiB, documented as "platform ~1.3 GB + toolchain ~1.0 GB + framework",
while a hydrated pioarduino framework alone measures 2.2-2.8 GB. The check
passed hosts that then hit ENOSPC in the linker.

- new fbuild_build_engine::disk_footprint: free-space sampling per root at
  stage boundaries, peak delta per root, one-line summary, optional JSON sink
  for accumulated measurements (FBUILD_DISK_FOOTPRINT / _JSON), no-op when off
- reuses disk_preflight::{FreeSpace, available_on_volume}; generic over the
  probe so the async build future stays Send
- wired into the ESP32 orchestrator at resolve / compile / link boundaries
- ESP32_CACHE_BYTES 2 -> 5 GiB with the measured component table in its doc;
  PROJECT_BUILD_BYTES documented against 15-59 MB of measured build trees

Tests: 8 footprint unit tests (scripted volumes) + footprint_roots; the real
HostFreeSpace path was verified against the live cache root out of tree.

Refs #1750
@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 4eee75f Oct 28, 2026
36 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Oct 29, 2026
@zackees
zackees deleted the agent/disk-footprint branch November 5, 2026 05:51
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.

1 participant