fix: report clear size-limit errors for oversized blueprints in webhooks#25
Merged
Conversation
Blueprints over 1MB bypass the size check entirely: the GitHub Contents API returns encoding "none" with empty content for such files, which decoded to an empty string, passed the 500KB check at 0KB, and surfaced as a generic "Failed to fetch blueprint content" error. Files between 500KB and 1MB hit the size check, but the error was swallowed by the catch block and also reported generically. Check the API-reported size field (populated even when content is not inlined) before decoding, and propagate a structured error so PR comments tell contributors the file is too large and to split it. Also adds the same 500KB check to the push webhook, which had none. Seen on weval-org/configs#27 (~1.6MB) and #28 (~1.14MB). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Both GitHub webhooks (
github-prandgithub-push) now report a clear, actionable error when a blueprint exceeds the 500KB size limit, instead of the genericFailed to fetch blueprint content.fetchBlueprintContentchecks the API-reportedsizefield before decoding content, and returns{ content, error }instead ofstring | nullso the specific error reaches the PR comment.Why
Two compounding bugs produced the useless generic error, seen on configs#27 (~1.6MB) and configs#28 (~1.14MB):
encoding: "none"with emptycontentfor files over 1MB. Decoding empty base64 yields"", which measured 0KB, passed the 500KB check, then surfaced as a falsy-content generic failure.null.Contributors now see e.g. "Blueprint is 1632.5KB, which exceeds the 500KB limit. Please split it into smaller files."
Reviewer notes
response.data.sizeis always populated by the Contents API, even when content isn't inlined, so it's the reliable measure.tsc --noEmitlocally (no Node toolchain on this machine) — both call sites were updated by inspection; please let CI confirm.🤖 Generated with Claude Code