Skip to content

Phase 1e: ShrinkRecord struct for build_info.json telemetry #506

Closed

Description

@zackees

Part of #493 Phase 1. Lands the ShrinkRecord and Strategy types that will eventually be embedded in build_info_<env>.json so fbuild bloat and CI bloat-budget gates can label per-symbol reports with the shrink decision that produced them.

In Phase 1e the types are defined and round-trip through JSON; actual emission into build_info.json lands when an orchestrator first calls resolve_for_context end-to-end (Phase 4).

Scope

  • Add #[derive(Serialize, Deserialize)] + #[serde(rename_all = "kebab-case")] to ShrinkMode so JSON output uses the same kebab-case names as the CLI (auto, off, safe, aggressive, printf).
  • Add crates/fbuild-build/src/shrink/record.rs:
    • pub enum Strategy { SpecFile, Wrap } with kebab-case JSON (spec-file / wrap).
    • pub struct ShrinkRecord { mode: ShrinkMode, resolved: ShrinkMode, applied: Vec<String>, strategy: Option<Strategy> }.
    • strategy serializes as null / omitted when not present.
    • applied defaults to empty.
  • Wire pub mod record; into shrink/mod.rs.
  • Unit tests:
    • ShrinkMode round-trips through JSON for every variant.
    • Strategy round-trips for both variants.
    • ShrinkRecord defaults to all-Auto / empty / None and round-trips.
    • ShrinkRecord with a populated applied list and Strategy::SpecFile round-trips.

Out of scope

  • Emitting ShrinkRecord into build_info.json — wiring happens when an orchestrator first calls resolve_for_context (Phase 4).
  • Reading ShrinkRecord from build_info.json in fbuild bloat — separate task once the emission lands.

Pass

  • cargo build --workspace --all-targets clean.
  • cargo clippy --workspace --all-targets -- -D warnings exits 0.
  • New unit tests pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions