Commit dee19d1
committed
Fix
### What does this PR do?
Fix `fetch_main_headroom()` in tasks/static_quality_gates/metrics.py:
widen its lookback from 1 day to 7 so it doesn't miss `main`'s last
report over a weekend, and floor the computed headroom at `BUFFER_SIZE`
instead of 0 when main is already over its own limit.
### Motivation
`agent_rpm_arm64`/`agent_suse_arm64` exceeded their 735.07 MiB limit on
`main`, driven mainly by #54204's Rust data-security check (+3.49 MiB).
Restoring headroom via `quality-gates.exception-threshold-bump` should
have been a one-line fix, but the script failed to produce a usable
threshold, for two reasons.
Its 1-day lookback missed `main`'s last report across the weekend gap
between Friday's merges and the incident, since main only reports this
metric when a commit lands.
And it sets the new limit to the PR's own reported size plus main's
headroom, so whenever main's headroom was at or below 0 (as it was here)
the new limit collapsed to just the PR's own size: a threshold still
below main's actual usage, one that would not even have unblocked
`main`.
### Describe how you validated your changes
Added `test_headroom_floored_when_main_over_its_own_limit` (renamed from
the now-inverted `test_headroom_never_negative`) asserting the floor
applies when main is over budget.
Reran `quality-gates.exception-threshold-bump` twice independently: both
runs produced identical thresholds, confirming the fix is deterministic.exception-threshold-bump's headroom calculation1 parent 2ffb147 commit dee19d1
2 files changed
Lines changed: 10 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
135 | | - | |
136 | | - | |
| 137 | + | |
| 138 | + | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
251 | | - | |
252 | | - | |
| 252 | + | |
| 253 | + | |
253 | 254 | | |
254 | 255 | | |
255 | 256 | | |
| |||
277 | 278 | | |
278 | 279 | | |
279 | 280 | | |
280 | | - | |
281 | | - | |
| 281 | + | |
| 282 | + | |
282 | 283 | | |
283 | 284 | | |
284 | 285 | | |
| |||
0 commit comments