Skip to content

fix: report clear size-limit errors for oversized blueprints in webhooks#25

Merged
nojibe merged 1 commit into
mainfrom
fix/blueprint-size-error-reporting
Jun 11, 2026
Merged

fix: report clear size-limit errors for oversized blueprints in webhooks#25
nojibe merged 1 commit into
mainfrom
fix/blueprint-size-error-reporting

Conversation

@nojibe

@nojibe nojibe commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What changed

Both GitHub webhooks (github-pr and github-push) now report a clear, actionable error when a blueprint exceeds the 500KB size limit, instead of the generic Failed to fetch blueprint content.

  • fetchBlueprintContent checks the API-reported size field before decoding content, and returns { content, error } instead of string | null so the specific error reaches the PR comment.
  • The push webhook gets the same 500KB check (it previously had none).

Why

Two compounding bugs produced the useless generic error, seen on configs#27 (~1.6MB) and configs#28 (~1.14MB):

  1. Files over 1MB bypassed the size check entirely. The GitHub Contents API returns encoding: "none" with empty content for files over 1MB. Decoding empty base64 yields "", which measured 0KB, passed the 500KB check, then surfaced as a falsy-content generic failure.
  2. Files between 500KB and 1MB lost their error message. The size check threw a descriptive error, but the catch block swallowed it and returned null.

Contributors now see e.g. "Blueprint is 1632.5KB, which exceeds the 500KB limit. Please split it into smaller files."

Reviewer notes

  • The 500KB policy is unchanged — this is error-reporting only. No blob-API fallback was added since >500KB files are rejected by policy anyway.
  • response.data.size is always populated by the Contents API, even when content isn't inlined, so it's the reliable measure.
  • I was unable to run tsc --noEmit locally (no Node toolchain on this machine) — both call sites were updated by inspection; please let CI confirm.

🤖 Generated with Claude Code

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>
@railway-app

railway-app Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

This PR was not deployed automatically as @nojibe does not have access to the Railway project.

In order to get automatic PR deploys, please add @nojibe to your workspace on Railway.

@nojibe nojibe merged commit 8980003 into main Jun 11, 2026
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