Skip to content

Phase 1d: AutoShrinkEntry registry + green reporting one-liner #498

Description

@zackees

Part of #493 Phase 1. Lands the per-platform shrinker registry type and the green auto shrinking: … one-liner reporter — both with empty data so the user-facing behavior is silent on every platform until subsequent phases populate the registry.

Scope

  • Define AutoShrinkEntry { category: &'static str, symbols: &'static [&'static str] } in crates/fbuild-build/src/shrink/registry.rs.
  • Define a per-platform registry function registry_for(platform: Platform) -> &'static [AutoShrinkEntry] that returns &[] for every platform. Subsequent phases populate this per-platform.
  • Implement reporting::print_auto_shrinking_line(entries: &[AutoShrinkEntry]) in crates/fbuild-build/src/shrink/reporting.rs:
    • If entries.is_empty(): print nothing.
    • Otherwise: print a single line in green (via owo-colors) of the form auto shrinking: <sym1>, <sym2>, … — the prefix auto shrinking: is bold-green, the comma-separated symbol list is plain green. owo-colors auto-disables on non-tty and respects NO_COLOR, so no extra plumbing is needed.
  • Unit tests:
    • Empty registry → nothing printed (capture stdout).
    • Non-empty registry → exact text auto shrinking: vfprintf, vsnprintf (color codes stripped or asserted separately).
    • The green-coloring path is exercised when owo-colors is forced on.

Out of scope

  • Real per-platform registry entries — every platform's auto-shrink list stays empty in this phase. Phases 4–6 populate them.
  • The libc probe (separate sub-task).
  • The auto-resolver (separate sub-task; Auto always resolves to Off in Phase 1).
  • Plumbing this reporter into the orchestrator (separate sub-task once the resolver lands).
  • Verbose plan output for explicit modes (separate sub-task).

Pass

  • cargo build --workspace --all-targets clean.
  • cargo clippy --workspace --all-targets -- -D warnings exits 0.
  • New unit tests pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions