pr-comment: surface repo-limit (402) as a warning, not a raw error#131
Merged
Conversation
When the service responds with HTTP 402 and code `repo_limit_reached` (this PR's repository is beyond the plan's repository limit), the pr-comment action previously fell through to the generic non-2xx branch, which dumped the raw JSON body to stderr and failed the step. Add a dedicated branch that surfaces a clear `::warning::` annotation plus a Step Summary block with the upgrade link, mirroring the existing `github_app_not_installed` (409) handling. The workflow is not failed (exit 0): a billing limit should not break the customer's merge gate. Flip the exit code to 1 to hard-gate over-limit repositories instead. Adds a CI test that stubs oasdiff + curl to return the 402 response and asserts the warning annotation, the step summary, exit 0, and that it does not regress to the generic error branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
When the oasdiff service responds with HTTP 402 and code
repo_limit_reached(the pull request's repository is beyond the plan's repository limit), thepr-commentaction previously fell through to the generic non-2xx branch, which dumped the raw JSON body to stderr and failed the step. A maintainer just saw a failed check and had to dig through the raw log to learn it was a plan-limit issue.This adds a dedicated branch that surfaces it properly:
::warning::annotation with the repo, the plan limit, and the upgrade link.github_app_not_installed(409) handling right above it.Behavior: warns, does not fail
The workflow is not failed (
exit 0). A billing limit should not break the customer's merge gate, and the visible warning plus the missing PR comment are signal enough. Flip the singleexit 0toexit 1if you would rather hard-gate repositories beyond the plan.The "View API changes" notice (free review link) is still emitted beforehand, so an over-limit repo keeps the free fallback path.
Test
Adds
pr_comment_repo_limit_warns_without_failing: stubsoasdiffandcurlto return the 402repo_limit_reachedresponse, then asserts the warning annotation, the step summary,exit 0, and that it does not regress to the generic error branch. Verified locally.