Skip to content

builder: give the ground-plan bridge budget the owner's 8 KiB margin - #3486

Merged
timohueser merged 2 commits into
ground-planfrom
claude/gp-wasm-guard-margin
Nov 15, 2026
Merged

timohueser merged 2 commits into
ground-planfrom
claude/gp-wasm-guard-margin

Conversation

@timohueser

@timohueser timohueser commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

What

The size guard of the ground-plan bridge (builder/wasm/wasm_size_guard.py) gets a budget in two parts:

  • The recorded size: 806,847 B gzipped (WASM and glue) and 2,087,262 B raw. It comes from the CI build that the guard names, with stable 1.100.0.
  • The margin: 8 KiB (8,192 B) gzipped. This is the owner's number. The raw margin has the same fraction of the raw size: 21,192 B.

The guard prints the measured size, the budget, and the two parts of the budget, with the change against the recorded size. A reviewer sees growth inside the margin.

A pull request that changes the code of the bridge records its own CI size in the guard. The margin is only for toolchain and dependency noise.

Why

The old budget was the CI size rounded up to the next whole KiB. It had 65 B gzipped and 674 B raw of headroom. rust-toolchain.toml follows stable. The next Rust release or a small dependency update can move the size by a few kilobytes. That fails unrelated pull requests. The owner chose a margin of 8 KiB. A pinned toolchain was the other option; the owner did not choose it. Real growth past the margin still fails.

Figures

Budget Before After
gzipped WASM + glue 806,912 B (788 KiB), headroom 65 B 815,039 B, headroom 8,192 B
raw WASM 2,087,936 B (2,039 KiB), headroom 674 B 2,108,454 B, headroom 21,192 B

The other budgeted bridge does not change. Its headroom on the CI run of #3481 (wasm-bridges, stable 1.100.0):

Bridge Measured Budget Headroom
builder, gzipped 496,290 B 555,008 B 58,718 B (11 %)
builder, raw 1,288,539 B 1,359,872 B 71,333 B (5 %)

The test device (flat-device) has no budget. No other bridge has headroom under 1 KiB.

Checks

  • python3 -m py_compile builder/wasm/wasm_size_guard.py.
  • The guard on an older local ground-plan build (--module ground-plan --pkg …): it prints both parts of each budget and exits 0.
  • Left out: a local bridge build. The local toolchain is 1.99.0 and CI is 1.100.0, so a local size does not compare with the recorded size. CI wasm-bridges runs the guard on this head.
  • The guard has no tests of its own. obc suites check is not necessary: no test sources, suite commands or workflows change.

Public docs: unchanged.

Mode: change #3105
Requirements: none

🤖 Generated with Claude Code

The budget was the CI size rounded up to the next whole KiB: 65 B gzipped
and 674 B raw of headroom on a toolchain that follows stable. The guard now
states the recorded CI size and the owner's margin apart, and prints both
parts with the change against the recorded size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e20beac6-141e-4814-ac9d-c70c8df1f812

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

@timohueser

Copy link
Copy Markdown
Owner Author

Review of #3486 (head 7ec28df, base ground-plan)

Verdict: MERGE AFTER FIXES. The fix is one sentence of text (F1). The code is correct.

Checks

  1. The guard fails past recorded + margin. File builder/wasm/wasm_size_guard.py.
    • Comparison: measured > budget per key, :122 and :130; failed gives exit 1, :136.
    • Budgets: :38, recorded + margin per key, 815,039 B gzipped and 2,108,454 B raw.
    • Scratch run with a patched measure():
      • At the budget exactly: exit 0.
      • Gzip 815,040 B: ::error::, exit 1.
      • Raw 2,108,455 B: ::error::, exit 1.
      • Missing --pkg: exit 1 (:100). Empty pkg: exit 1 (:69). --module nope: exit 2 (argparse choices, :86).
    • The behavior for a missing file and a wrong module name is the same as before. Those lines did not change.
  2. The comments are correct.
    • Recorded size :19-25: the build is named by its content, the feature storeys and stable 1.100.0.
    • Margin :26-28: the owner's number with its reason (noise must not fail unrelated pull requests).
    • The comments have no date and no pull-request number.
    • Raw margin :31: round(8192 * raw / gzip) = 21,192 B. This is sound because the comment states the reason ("same fraction"). It moves by a few bytes when the recorded size changes, and that is correct. A literal number is not necessary.
  3. Drift: see F1.
  4. Scope and body.
    • Only this file changed (git diff 7fbbff989 --stat: 1 file).
    • The builder budget is unchanged: 555,008 / 1,359,872 B, the same expression. Only its comment moved into the dict, :35-37.
    • The CLI, PKG_DIRS, UNBUDGETED and ADVICE are unchanged.
    • All figures in the body are correct: 806,847 + 8,192 = 815,039; 2,087,262 + 21,192 = 2,108,454; old 806,912 / 2,087,936 with 65 / 674 B headroom.
    • The body has Mode: change #3105, Requirements: none and "Public docs: unchanged".
    • CI on 7ec28df: all checks are green or skipped, and wasm-bridges is SUCCESS.

Findings

F1 (should fix). No rule says when the recorded size changes.

  • The +N B against the recorded size line (:126-129) is printed only in the log of a green CI step. Nobody reads that log.
  • A bridge change of +5 kB passes and leaves 3 kB for the next unrelated pull request. The margin then stops absorbing noise, which is its only purpose.
  • Docstring :4 ("Raising a cap needs a reason in the PR") does not cover growth inside the margin.
  • Smallest fix: add one sentence to the margin comment at :27:
    A pull request that changes the bridge's code records its own CI size here; the margin is only for toolchain and dependency noise.
  • Optional, more code: write a ::warning:: annotation when measured - recorded is above half the margin. The annotation shows on the pull request checks. It is not required.

F2 (minor, existing text). The comment :23-24 says "The owner allows a few per cent for line water and about 60 kB for the crossing block when stated."

  • Next to a fixed margin, this reads like a second allowance.
  • It is from an older pull request. Leave it, or remove it when F1 is done.

Not checked

  • I did not do a local build. I did not read the CI log. I did not compare the CI size of this head with 806,847 B. A green wasm-bridges shows only that the size is inside the budget.
  • I did not confirm the owner's "8 KiB" quote at its source. I used the brief.

Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@timohueser
timohueser merged commit 67092ce into ground-plan Nov 15, 2026
24 checks passed
@timohueser
timohueser deleted the claude/gp-wasm-guard-margin branch November 15, 2026 11:31
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.

1 participant