Repository navigation
feat(shrink): report an unhonoured --shrink request instead of dropping it (#1459 part 1) - #1813
Merged
Merged
Conversation
…ng it `--shrink` has been parsed since #496 and never consumed: dispatch bound the flags as `shrink: _, no_shrink: _`, and resolve_for_context/registry_for had no call sites outside fbuild-build-engine. --shrink=safe built a stock image and said nothing, so the flag looked functional. Report the resolved decision once per build. auto/off stay silent; an explicit safe/aggressive/printf with an empty platform registry prints WARNING: shrink: --shrink=safe has no effect yet: no shrinker is registered for espressif32; building unshrunk (#1459) The platform id is read from the project's own platformio.ini (best-effort), and the notice disappears by itself once a registry gains entries. No compilation or link behaviour changes; the printf reducer itself is still #1459's remaining work.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
fbuild build --shrink=<mode>has been accepted since #496 and silently dropped ever since. Three facts fromorigin/main(47d81e0):crates/fbuild-cli/src/cli/dispatch.rsbound the flags asshrink: _, no_shrink: _— the values never reached a build.fbuild_build::shrink::resolve_for_contextandregistry_forhave zero call sites outsidecrates/fbuild-build-engine/src/shrink/.registry_forreturns&[]for all 15 platforms.So
--shrink=safe|aggressive|printfproduced a stock build and printed nothing. The flag looks functional; the user finds out it isn't from a symbol dump. That is the "the build prints no shrink decision" half of #1459.What this changed
One reporting path, no behaviour change to compilation or linking:
crates/fbuild-cli/src/cli/shrink_notice.rs:unsupported_notice(mode, platform, available)returns the single line to print,Nonewhen silence is correct.dispatch.rsnow resolves the flag with the existingresolve_explicit(global, subcommand, no_shrink)and reports it before the build runs.platformio.ini(get_default_environment+get_env_config("platform")→Platform::from_platform_str), best-effort: unreadable ini → "this platform", never an error.Semantics:
auto(default, bare--shrink)off/--no-shrinksafe/aggressive/printfshrink: --shrink=safe has no effect yet: no shrinker is registered for espressif32; building unshrunk (FastLED/fbuild#1459)The notice deletes itself once a platform registry gains entries, so it cannot go stale.
What this does NOT do
No printf reducer, no link-strategy change, no
build_infofield.--shrink=autostill resolves tooffon ESP32-S3/newlib, so a stock Blink ELF still retains_vfprintf_r/_svfprintf_r(28,320 B cluster from #1459). #1459 stays open; this is its reporting prerequisite — thebuild_infotelemetry criterion is still outstanding because the decision never reaches the link stage.Tests
crates/fbuild-cli/src/cli/shrink_notice.rsunit tests:auto_is_silent,off_is_silent— the two silent paths.explicit_mode_with_empty_registry_is_reported_with_platform— message names--shrink=safe, the platform, and feat(shrink): make ESP32-S3 printf reduction actually apply #1459.every_explicit_non_off_mode_is_reported—safe/aggressive/printf.unknown_platform_still_reports— falls back to "this platform".registered_shrinker_suppresses_the_notice— injected non-empty registry → silence.esp32_s3_newlib_auto_is_off_today— the RED half of feat(shrink): make ESP32-S3 printf reduction actually apply #1459 pinned as a test:resolve_for_context(Auto, espressif32/newlib/arduino) == Offandregistry_for(espressif32) == [].platform_id_covers_every_slice_of_the_report.End-to-end on the real binary (default verbosity, no
RUST_LOG),tests/platform/esp32s3:and the platform id really comes from the project,
tests/platform/uno:Note on the output channel
output::warnis atracing::warn!, which is invisible at default verbosity (onlyRUST_LOG=infosurfaced it) — that would have recreated the same silent-flag problem. The notice therefore goes throughoutput::diagnosticwith the repo'sWARNING:marker, the always-visible path (--quietand redirected stderr included).