ci: keep Bundle Size job green on transient GitHub comment failures - #1795
ci: keep Bundle Size job green on transient GitHub comment failures#1795thymikee wants to merge 1 commit into
Conversation
The size measurement and job summary had already succeeded on PR #1789 (run 32050847506) when the PR comment write got a 503 during a GitHub incident and failed the whole lane. --post-comment now retries 5xx / 429 / network errors (4 attempts, 1s/2s/4s backoff) on both the list and write calls. If it still fails, it prints a ::warning::, appends a note to $GITHUB_STEP_SUMMARY, and exits 0. Other 4xx (bad token, missing permissions) stay fatal.
Size Report
Startup median (7 runs, lower is better):
Top changed chunks: no changes in the largest emitted chunks. |
|
Request changes: The retry wrapper blindly reissues the initial POST after a network/5xx failure. That request may have succeeded server-side before its response was lost, so retries can create duplicate marker comments. Make creation idempotent or reconcile after an uncertain create rather than repeating POST unchanged. The exact head also fails required Fallow Code Quality because |
Why
On PR #1789 (run 32050847506) the size measurement and job summary completed fine, then
--post-commentgot a503 No server is currently availablefrom the GitHub comments API during an incident and the wholeBundle Sizelane went red. The lane's actual job had already succeeded; only the cosmetic comment write failed.What
In
scripts/size-report.mjs, the--post-commentpath is now best-effort against transient GitHub failures:githubRequesthelper that retries 4 attempts with 1s/2s/4s backoff on 5xx, 429, or a network error.TransientGitHubError; the top-level wrapper prints a::warning::annotation, appends a one-line note to$GITHUB_STEP_SUMMARY, and exits 0.assertGitHubWriteResponseis removed; it was only used by this comment write, which was the sole GitHub write in the file, so nothing else depended on it staying fatal.size.ymlneeds no change: it already appends the full report to$GITHUB_STEP_SUMMARYbefore the comment step, so the numbers were never lost — only the comment.Verification
No unit tests exist for this script, so I exercised it end-to-end with a stubbed
fetch(node --import stub.mjs scripts/size-report.mjs --post-comment …) across status sequences:200,200503,200,200/net,200,200503×4/429×4401/200,404oxfmt --checkandoxlint --deny-warningspass on the file.