Skip to content

chore(size-limit-action): Resolve baseline by walking git history - #24310

Draft
mydea wants to merge 1 commit into
developfrom
fix/size-limit-baseline-from-git-history
Draft

chore(size-limit-action): Resolve baseline by walking git history#24310
mydea wants to merge 1 commit into
developfrom
fix/size-limit-baseline-from-git-history

Conversation

@mydea

@mydea mydea commented Sep 10, 2026

Copy link
Copy Markdown
Member

The size-limit GitHub action was comparing PRs against a stale develop baseline — e.g. #24299 (run at 12:10 on Sep 10) picked a baseline build from Sep 8, two days and many commits behind the tip, without the "not the latest" warning banner.

Root cause

Baseline resolution drove off listWorkflowRuns filtered by branch + event=push. That listing is backed by an eventually-consistent index that can omit or reorder recent runs. At the time #24299 ran, that index returned the Sep 8 run as the first (newest) result even though six completed Sep 10 develop runs already carried the size-limit-action artifact — so the action took the Sep 8 build and stopped.

The warning banner didn't fire because isLatest was computed as latestWorkflowRun.id === <baseline>.id, where latestWorkflowRun = filtered[0] came from the same stale listing. When the API omits recent runs, latestWorkflowRun is stale in the exact same way, so isLatest was trivially true. The banner could only ever catch "a newer run exists but has no artifact yet" — never "newer runs are missing from the response entirely," which is the failure that actually occurred.

Approach

Resolve the baseline from git history instead of the run index:

  • Walk repos.listCommits({ sha: branch }) — authoritative and strictly ordered newest-first — and pin each candidate run by exact head_sha. head_sha is a precise key with no ordering/event-index dependency, so recent commits can no longer be silently skipped.
  • isLatest is now truthful: true only when the artifact is found on the tip commit, otherwise false (banner fires) with a log line stating how many commits behind the baseline is.
  • The event: 'push' filter is dropped — the size-limit-action artifact is only ever uploaded on the base-branch push path, so a PR run for the same SHA can't carry it, and dropping it avoids relying on the same lagging index.
  • The walk is capped at 50 commits.

The return shape ({ artifact, workflowRun, isLatest }) is unchanged, so index.mjs needs no changes.

🤖 Generated with Claude Code

The size-limit GH action resolved the develop baseline from
`listWorkflowRuns` filtered by branch + event. That listing is backed by
an eventually-consistent index that can omit or reorder very recent runs,
so the action would silently compare against a days-old baseline while
still reporting it as the latest one (the `isLatest` flag was derived from
`filtered[0]` of the same stale listing, so it could never detect the
staleness it was meant to warn about).

Drive baseline resolution from `repos.listCommits` (authoritative,
strictly ordered git history) instead, and pin each candidate run by exact
`head_sha`. Walking commits newest-first means the order is exact and, when
the tip commit has no artifact yet, we fall back to its parent and
correctly report the baseline as not-latest so the warning banner fires.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mydea mydea changed the title fix(size-limit-action): Resolve baseline by walking git history chore(size-limit-action): Resolve baseline by walking git history Sep 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.92 kB - -
@sentry/browser - with treeshaking flags 27.21 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 27.11 kB - -
@sentry/browser (incl. Tracing) 50.28 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 50.29 kB - -
@sentry/browser (incl. Tracing, Profiling) 53.27 kB - -
@sentry/browser (incl. Tracing, Replay) 89.77 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 78.86 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 94.46 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 107.47 kB - -
@sentry/browser (incl. Feedback) 46.41 kB - -
@sentry/browser (incl. sendFeedback) 33.97 kB - -
@sentry/browser (incl. FeedbackAsync) 39.08 kB - -
@sentry/browser (incl. Metrics) 29.93 kB - -
@sentry/browser (incl. Logs) 30.2 kB - -
@sentry/browser (incl. Metrics & Logs) 30.87 kB - -
@sentry/react 30.67 kB - -
@sentry/react (incl. Tracing) 52.6 kB - -
@sentry/vue 36.16 kB - -
@sentry/vue (incl. Tracing) 52.53 kB - -
@sentry/svelte 28.93 kB - -
CDN Bundle 30.66 kB - -
CDN Bundle (incl. Tracing) 50.78 kB - -
CDN Bundle (incl. Logs, Metrics) 32.93 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 52.74 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.62 kB - -
CDN Bundle (incl. Tracing, Replay) 88.33 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 90.29 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 94.37 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 96.38 kB - -
CDN Bundle - uncompressed 90.73 kB - -
CDN Bundle (incl. Tracing) - uncompressed 151.69 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 97.31 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 157.66 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 226.72 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 271.26 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 277.21 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 284.96 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 290.9 kB - -
@sentry/nextjs (client) 54.92 kB - -
@sentry/sveltekit (client) 50.7 kB - -
@sentry/core/server 37.08 kB - -
@sentry/core/browser 13.66 kB - -
@sentry/node 128.59 kB +0.02% +14 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 81.82 kB - -
@sentry/node - without tracing 89.55 kB +0.04% +30 B 🔺
@sentry/node - without channel injection 107.53 kB +0.03% +22 B 🔺
@sentry/aws-serverless 97.77 kB +0.03% +22 B 🔺
@sentry/cloudflare (withSentry) - minified 203.01 kB - -
@sentry/cloudflare (withSentry) 505.44 kB - -

View base workflow run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4022882. Configure here.

}
core.warning(`No "${artifactName}" artifact found on branch "${branch}".`);
return null;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fix PR missing regression tests

Medium Severity

This fix PR adds no unit, integration, or E2E test for the stale-baseline regression. Flagged because the review rules file asks for a test that fails without the change and passes with it, so the listCommits walk, head_sha pinning, and truthful isLatest behavior are covered.

Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 4022882. Configure here.

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