Skip to content

test: cover remaining upstream error statuses#4

Open
Boulea7 wants to merge 1 commit into
mainfrom
codex/upstream-error-pattern-coverage
Open

test: cover remaining upstream error statuses#4
Boulea7 wants to merge 1 commit into
mainfrom
codex/upstream-error-pattern-coverage

Conversation

@Boulea7
Copy link
Copy Markdown
Owner

@Boulea7 Boulea7 commented May 27, 2026

Summary

  • add regression coverage for swallowed UNAUTHENTICATED and RESOURCE_EXHAUSTED klog status lines
  • verify they flip had_upstream_error and emit the expected upstream_* subtypes

Validation

  • env UV_CACHE_DIR=/private/tmp/agy-mcp-uv-cache uv run --default-index https://pypi.org/simple pytest tests/test_adapters_agy.py::test_klog_parser_permission_denied_marks_upstream_error tests/test_adapters_agy.py::test_klog_parser_additional_upstream_statuses_mark_upstream_error tests/test_adapters_agy.py::test_klog_parser_captureless_upstream_pattern_uses_full_match -q
  • env UV_CACHE_DIR=/private/tmp/agy-mcp-uv-cache uv run --default-index https://pypi.org/simple pytest tests/test_adapters_agy.py -q
  • env UV_CACHE_DIR=/private/tmp/agy-mcp-uv-cache uv run --default-index https://pypi.org/simple ruff check tests/test_adapters_agy.py
  • git diff --check

Summary by Sourcery

Tests:

  • Add parametrized tests ensuring UNAUTHENTICATED and RESOURCE_EXHAUSTED klog status lines set upstream error context and expected subtypes.

Summary by cubic

Added regression tests to ensure the klog parser treats Google-side UNAUTHENTICATED (401) and RESOURCE_EXHAUSTED (429) lines as upstream errors, setting had_upstream_error and emitting the correct upstream_* subtypes. Also verifies captureless upstream patterns fall back to full-match parsing.

Written for commit 218ba1b. Summary will update on new commits. Review in cubic

Change-Id: Ie9fda8c8a5b853d006959e98c2e787df74da4df2
Copilot AI review requested due to automatic review settings May 27, 2026 07:43
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 27, 2026

Reviewer's Guide

Adds parametrized regression tests to ensure specific upstream Google-side error statuses (UNAUTHENTICATED and RESOURCE_EXHAUSTED) are correctly parsed as upstream errors, set the appropriate subtype, and preserve the message text.

File-Level Changes

Change Details Files
Add parametrized regression test to cover additional upstream klog error statuses and verify upstream error handling behavior.
  • Introduce pytest.mark.parametrize over status, subtype, and message to cover UNAUTHENTICATED and RESOURCE_EXHAUSTED upstream errors in klog parsing.
  • Construct klog-style error lines including the status and message, feed them through handle_klog_line with a fresh context and AgyPrintBackend adapter, and assert a single emitted event.
  • Verify the emitted event subtype matches the expected upstream* subtype, the original message is contained in the event text, and ctx.had_upstream_error is set to True.
tests/test_adapters_agy.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Warning

Review limit reached

@Boulea7, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 6 minutes and 53 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d28d2032-4cd7-48b4-9221-72c80ea86fb7

📥 Commits

Reviewing files that changed from the base of the PR and between 6d619b0 and 218ba1b.

📒 Files selected for processing (1)
  • tests/test_adapters_agy.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/upstream-error-pattern-coverage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Re-trigger cubic

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds regression coverage for upstream klog status handling in the agy adapter tests, ensuring additional Google-side error statuses are detected instead of being silently ignored.

Changes:

  • Adds parametrized coverage for UNAUTHENTICATED (code 401) and RESOURCE_EXHAUSTED (code 429).
  • Verifies emitted upstream error subtypes, retained message text, and had_upstream_error state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants