From 7ec28df8f5baa5136d44d59df2d891e9cf07ab7f Mon Sep 17 00:00:00 2001 From: timohueser Date: Sun, 15 Nov 2026 12:06:14 +0100 Subject: [PATCH 1/2] builder: give the ground-plan bridge budget the owner's 8 KiB margin 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 --- builder/wasm/wasm_size_guard.py | 45 +++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/builder/wasm/wasm_size_guard.py b/builder/wasm/wasm_size_guard.py index 6f96677105..8a8eab68c1 100644 --- a/builder/wasm/wasm_size_guard.py +++ b/builder/wasm/wasm_size_guard.py @@ -2,7 +2,7 @@ """Gate each production wasm bridge on raw WASM and gzipped WASM plus glue. The test-device variant is measured but does not ship. Raising a cap needs a reason in the PR. -The ground-plan budget is the bridge with the faces, the records, the near mesh, the outline slopes and line water. +The ground-plan budget is its recorded CI size plus the owner's margin; both parts print. """ from __future__ import annotations @@ -16,18 +16,29 @@ from pathlib import Path -# Preserve the sum of the conversion, assembly and preview caps. Consolidation does not -# increase the permitted production download or raw WASM size. +# Measured in CI on the build with the outline's turns, the levels that the tiles carry, the faces' tile-line +# vertices, the decks' ceilings and end faces, the shared water level and curve of the feature bake, line water +# and its culverts with their mouths, the classifier's ford rule, and the storeys over the ground with their open +# junction ends, their ends on the stubs' points, what each deck is made of and the junctions that lie on the +# ground (the crate's feature `storeys` on, stable 1.100.0). The owner allows a few per cent for line water and +# about 60 kB for the crossing block when stated. +GROUND_PLAN_MEASURED = {"gzipped": 806_847, "raw_wasm": 2_087_262} +# The owner's margin: compiler and dependency updates move the size by a few kilobytes and must not fail +# unrelated pull requests; real growth past the margin still fails. Raw gets the same fraction as gzipped. +GROUND_PLAN_MARGIN_GZIPPED = 8 * 1024 +GROUND_PLAN_MARGIN = { + "gzipped": GROUND_PLAN_MARGIN_GZIPPED, + "raw_wasm": round(GROUND_PLAN_MARGIN_GZIPPED * GROUND_PLAN_MEASURED["raw_wasm"] / GROUND_PLAN_MEASURED["gzipped"]), +} + BUDGETS = { + # Preserve the sum of the conversion, assembly and preview caps. Consolidation does not + # increase the permitted production download or raw WASM size. "builder": {"gzipped": (62 + 352 + 128) * 1024, "raw_wasm": (112 + 944 + 272) * 1024}, - # Measured in CI on the build with the outline's turns, the levels that the tiles carry, the faces' tile-line - # vertices, the decks' ceilings and end faces, the shared water level and curve of the feature bake, line water - # and its culverts with their mouths, the classifier's ford rule, and the storeys over the ground with their open - # junction ends, their ends on the stubs' points, what each deck is made of and the junctions that lie on the - # ground (the crate's feature `storeys` on: 806,847 B gzipped with the glue, 2,087,262 B raw, stable 1.100.0), the - # next whole KiB. The owner allows a few per cent for line water and about 60 kB for the crossing block when stated. - "ground-plan": {"gzipped": 788 * 1024, "raw_wasm": 2039 * 1024}, + "ground-plan": {key: GROUND_PLAN_MEASURED[key] + GROUND_PLAN_MARGIN[key] for key in GROUND_PLAN_MEASURED}, } +# A budget made of a measured size and a margin prints both, so a reviewer sees growth inside the margin. +BUDGET_PARTS = {"ground-plan": (GROUND_PLAN_MEASURED, GROUND_PLAN_MARGIN)} ADVICE = { "builder": ( @@ -101,13 +112,21 @@ def main() -> int: failed = False budgets = BUDGETS[args.module] - for label, measured, budget in ( - ("gzipped wasm + glue", total_gzipped, budgets["gzipped"]), - ("raw wasm", raw_wasm, budgets["raw_wasm"]), + parts = BUDGET_PARTS.get(args.module) + for key, label, measured in ( + ("gzipped", "gzipped wasm + glue", total_gzipped), + ("raw_wasm", "raw wasm", raw_wasm), ): + budget = budgets[key] pct = 100 * measured / budget status = "over" if measured > budget else "ok" print(f"{label}: {measured:,} B / {budget:,} B budget ({pct:.0f}%) — {status}") + if parts: + recorded, margin = parts + print( + f" budget = {recorded[key]:,} B recorded + {margin[key]:,} B margin;" + f" {measured - recorded[key]:+,} B against the recorded size" + ) if measured > budget: print( f"::error::obc-{args.module}-bridge {label} is {measured:,} B, over the {budget:,} B budget." From a212e7cc63a6d3448a00abbc533996c9fcd0ecad Mon Sep 17 00:00:00 2001 From: timohueser Date: Sun, 15 Nov 2026 12:21:03 +0100 Subject: [PATCH 2/2] builder: say when the ground-plan bridge's recorded size changes Co-Authored-By: Claude Opus 5.5 --- builder/wasm/wasm_size_guard.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builder/wasm/wasm_size_guard.py b/builder/wasm/wasm_size_guard.py index 8a8eab68c1..26319d6747 100644 --- a/builder/wasm/wasm_size_guard.py +++ b/builder/wasm/wasm_size_guard.py @@ -20,11 +20,13 @@ # vertices, the decks' ceilings and end faces, the shared water level and curve of the feature bake, line water # and its culverts with their mouths, the classifier's ford rule, and the storeys over the ground with their open # junction ends, their ends on the stubs' points, what each deck is made of and the junctions that lie on the -# ground (the crate's feature `storeys` on, stable 1.100.0). The owner allows a few per cent for line water and -# about 60 kB for the crossing block when stated. +# ground (the crate's feature `storeys` on, stable 1.100.0). +# The owner allows about 60 kB of code growth for the crossing block, stated in its pull request and recorded here. GROUND_PLAN_MEASURED = {"gzipped": 806_847, "raw_wasm": 2_087_262} # The owner's margin: compiler and dependency updates move the size by a few kilobytes and must not fail # unrelated pull requests; real growth past the margin still fails. Raw gets the same fraction as gzipped. +# A pull request that changes the bridge's code records its own CI size here; the margin is only for toolchain +# and dependency noise. GROUND_PLAN_MARGIN_GZIPPED = 8 * 1024 GROUND_PLAN_MARGIN = { "gzipped": GROUND_PLAN_MARGIN_GZIPPED,