Skip to content

ci: a raised package size budget keeps its 5% headroom, so queued changes do not trip it - #8842

Open
miguel-heygen wants to merge 1 commit into
mainfrom
fix/size-budget-raise-headroom
Open

miguel-heygen wants to merge 1 commit into
mainfrom
fix/size-budget-raise-headroom

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

A pull request that raises a package's size budget now has to raise it to the measured size plus 5%, the headroom the size check is built around. A raise to the bare measured size fails, and the message names the value to use. The "over its budget" message names that value too.

Why

scripts/verify-packed-manifests.mjs sets a budget 5% above the measured size and fails a package only when it is more than 1% over, so a change normally has about 6% of room. But raises were going in at roughly the measured size. @hyperframes/inspector went from 933,584 to 945,000 when it measured 943,048, leaving 0.2%. The engine went from 511,040 to 511,900, also 0.2%. With no headroom left, the next queued change that grows the same package crosses the 1% line inside the merge group, where its own pull request run never measured it. This morning that failed eight merge groups in about 30 minutes, at 128 bytes over.

The over-budget message never said what to raise to, while the no-budget and well-under-budget messages already print measured x1.05.

Related work

None.

How

  • listPackageSizeIssues(name, sizes, budget, baseBudget): when baseBudget is given and the budget went up from it, the new budget must be at least suggest(size) (measured x1.05, the same helper the other two messages use). A package with no base budget counts as raised from 0. baseBudget undefined (the merge queue, a push, a local run) skips the raise check; sizes are still checked against the 1% line.
  • verifyPackageSizes reads the base's budgets from SIZE_BUDGETS_BASE_FILE when it is set and the file exists.
  • ci.yml Build: on pull_request only, scripts/ci/base-file.sh writes the budgets file as it was on the base this run measured, and the verify step gets its path. The merge queue doesn't judge raises, because a group's base already holds the changes queued ahead of it. A raise sized for one change would be compared there against the size of all of them.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

New in scripts/verify-packed-manifests.test.mjs:

  • "names the budget to raise to when a package is over" (1011 bytes over a budget of 1000: raise to 1062).
  • "refuses a budget a change raised without its 5% headroom": today's inspector numbers (base 933,584, raised to 945,000, measured 943,048) fail and name 990,201.
  • "lets two queued changes that each grow a package about 1% both pass once the first raise keeps headroom": the first change grows the package to 1040. Raising to 1040 is refused; raising to 1092 passes. A second change at 1053 then passes against 1092, and fails against the bare 1040.
  • "judges a raise only where the base's budgets were read, and never an unchanged budget".

fails without the fix: scripts/verify-packed-manifests.test.mjs "names the budget to raise to when a package is over", "refuses a budget a change raised without its 5% headroom" and "lets two queued changes that each grow a package about 1% both pass once the first raise keeps headroom" fail with main's verify-packed-manifests.mjs (3 of 10 size tests). With the change, all 10 pass, 3 runs in a row.

Also run: merge-queue-workflows, ci-cache-workflows, ci/base-file and comments-workflow tests pass. oxlint, oxfmt --check (including ci.yml) and the comment ratchet are clean.

Not changed: today's budgets that already sit without headroom. Each one gets its headroom back the next time a change raises it.

@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 273 (base branch 271), smooth 59 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Newly passing (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)

  • seqscaletwice-scale-px-r0-nested-z100
  • seqscaletwice-scale-px-r0-root-z100

Quarantined, measured but not gated (0)

Unstable (1)

  • seqrepeat-none-center-r0-root-z100: tracking 0.05, pressJump 0, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true / tracking 0.05, pressJump 0, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true / tracking 0.05, pressJump 0, drop 0, reload 0, render 0.02, renderKey -, undo true, teleport true

@vanceingalls vanceingalls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving at aca4ae5.

  • Rule: a budget raised against the base file must be >= ceil(measured x 1.05) (the same suggest() the other two messages use). A package missing from the base counts as raised from 0. baseBudget undefined (merge queue, push, local) skips the check, and an unchanged budget is never judged. This matches the stated rule.
  • Base file: base-file.sh reads the first parent of the merge commit, so it is the base this run measured, not a moving tip. A failed fetch fails the step. It runs on pull_request only, so the queue never compares a group's raise against everything queued ahead.
  • Message: the over-budget error now names the value to raise to.
  • Red-first: the three named tests fail on main's script and cover the message, the inspector 933,584 to 945,000 case (names 990,201), and the two-queued-changes case.
  • CI: all required checks are green at this head. Studio: timeline viewport gate failed (interaction p95 66.7 vs 58.3 ms). It is not a required check, and the PR touches no studio code, so I read it as runner noise.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants