Skip to content

pr-comment: surface repo-limit (402) as a warning, not a raw error#131

Merged
reuvenharrison merged 1 commit into
mainfrom
feat/repo-limit-annotation
Jun 1, 2026
Merged

pr-comment: surface repo-limit (402) as a warning, not a raw error#131
reuvenharrison merged 1 commit into
mainfrom
feat/repo-limit-annotation

Conversation

@reuvenharrison
Copy link
Copy Markdown
Contributor

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), 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. 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:

  • A clear ::warning:: annotation with the repo, the plan limit, and the upgrade link.
  • A Step Summary block explaining that no review comment was posted and how to cover the repository.
  • Mirrors the existing 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 single exit 0 to exit 1 if 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: stubs oasdiff and curl to return the 402 repo_limit_reached response, then asserts the warning annotation, the step summary, exit 0, and that it does not regress to the generic error branch. Verified locally.

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>
@reuvenharrison reuvenharrison merged commit 1abcd01 into main Jun 1, 2026
62 checks passed
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