Skip to content

Conversation

@lukaszgryglicki
Copy link
Member

  • Handle commend body too big (> 64K characters - can happen if PR has a lot of commits) in both python and golang backends.
  • Handle PRs from forks with > 250 commits with graceful fallack to REST (both python and golang backends).
  • Correctly locate PR head SHA using quick API call and fallback to getting last PR's commit SHA (also both backends).
  • Log number of distinct commit SHAs, authors (ids, logins, emails, names) in both backends so we can see how many commit summaries were there and how many actual commits (one commit can have > 1 authors) - both backends.
  • Handle private repos and forks correctly in both backends with fallbacks on errors.

cc @mlehotskylf @ahmedomosanya @jarias-lfx - this is for #4835.

Signed-off-by: Lukasz Gryglicki lgryglicki@cncf.io

Assisted by OpenAI

Assisted by GitHub Copilot

…llback

Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
Signed-off-by: Lukasz Gryglicki <lgryglicki@cncf.io>

Assisted by [OpenAI](https://platform.openai.com/)

Assisted by [GitHub Copilot](https://github.com/features/copilot)
…e-cases

Handle too big commits, missing commits from fork PRs, golang REST fallback
@lukaszgryglicki lukaszgryglicki self-assigned this Oct 22, 2025
Copilot AI review requested due to automatic review settings October 22, 2025 11:32
@coderabbitai
Copy link

coderabbitai bot commented Oct 22, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch unicron-4835-handle-edge-cases-prod

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

Copy link
Contributor

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

This PR enhances the CLA backend to gracefully handle edge cases in PR processing across both Python and Go implementations. The changes ensure robust handling of large comment bodies, PRs with many commits from forks, and edge cases in commit SHA retrieval.

Key Changes:

  • Implemented comment body size limiting to prevent exceeding the 64KB GitHub limit by trimming SHA lists when comments become too large
  • Refactored PR commit fetching to use merge-base history traversal, supporting PRs with > 250 commits and graceful REST API fallback
  • Added comprehensive logging of distinct commit metadata (SHAs, author IDs, logins, emails, names) to track commit summaries vs actual commits

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
cla-backend/cla/utils.py Added comment trimming logic to handle oversized comment bodies and SHA list truncation
cla-backend/cla/models/github_models.py Rewrote GraphQL commit iteration to use merge-base history traversal with fallback handling and enhanced logging
cla-backend-go/github/github_repository.go Mirrored Python changes with merge-base history traversal, comment trimming, improved error handling, and consistent logging

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@lukaszgryglicki lukaszgryglicki merged commit d691eb6 into main Oct 22, 2025
6 of 7 checks passed
@lukaszgryglicki lukaszgryglicki deleted the unicron-4835-handle-edge-cases-prod branch October 22, 2025 11:57
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.

3 participants