Skip to content

feat(attestation): expand PR reviewers with requested status and review state#2895

Merged
migmartri merged 4 commits into
chainloop-dev:mainfrom
javirln:javirln/gh-pr-reviews
Mar 22, 2026
Merged

feat(attestation): expand PR reviewers with requested status and review state#2895
migmartri merged 4 commits into
chainloop-dev:mainfrom
javirln:javirln/gh-pr-reviews

Conversation

@javirln

@javirln javirln commented Mar 20, 2026

Copy link
Copy Markdown
Member

Add Requested and ReviewStatus fields to track which reviewers were explicitly requested versus who actually submitted reviews. For GitHub PRs, merge requested reviewer lists from both event payload and /requested_reviewers API endpoint, then overlay review states from /reviews API. For GitLab, mark API reviewers as requested. Introduces PR info schema v1.2.

…ew state

Add Requested and ReviewStatus fields to prinfo.Reviewer to track which reviewers were explicitly requested vs who submitted reviews. For GitHub PRs, merge requested reviewer lists from both event payload and API endpoint, then overlay review states from /reviews API. For GitLab, mark all API-retrieved reviewers as requested. Bump PR info schema to v1.2.

Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln javirln self-assigned this Mar 20, 2026
@javirln javirln requested review from Piskoo, jiparis and migmartri March 20, 2026 11:49

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

2 issues found across 9 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="pkg/attestation/crafter/prmetadata.go">

<violation number="1" location="pkg/attestation/crafter/prmetadata.go:266">
P2: `fetchGitHubReviews` only reads the first API page, so reviewer `ReviewStatus` can be incomplete or stale on PRs with more than 30 reviews.</violation>
</file>

<file name="internal/schemavalidators/internal_schemas/prinfo/pr-info-1.2.schema.json">

<violation number="1" location="internal/schemavalidators/internal_schemas/prinfo/pr-info-1.2.schema.json:84">
P2: Make `requested` required in each reviewer object so requested-state is explicit instead of ambiguous when omitted.

(Based on your team's feedback about preferring explicit states over opaque nils/omissions.) [FEEDBACK_USED]</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread pkg/attestation/crafter/prmetadata.go Outdated
javirln added 2 commits March 20, 2026 12:56
…d required in schema 1.2

Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Comment thread pkg/attestation/crafter/prmetadata.go Outdated
})
}

for _, r := range fetchGitHubRequestedReviewers(ctx, githubAPIBase, owner, repo, prNumber, token) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Aren't these the ones the ones gathered from event.PullRequest a few lines above? Is there a possibility that they don't match?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I found yesterday a case where the event didn't have all reviewers, I added an User and the API had it and since we are asking for the actual reviewers I don't it harms to do another API request

Comment thread pkg/attestation/crafter/prmetadata.go Outdated
Comment thread pkg/attestation/crafter/prmetadata.go
@jiparis

jiparis commented Mar 20, 2026

Copy link
Copy Markdown
Member

Thanks @javirln. I've left some comments.

@javirln

javirln commented Mar 21, 2026

Copy link
Copy Markdown
Member Author

Thanks @javirln. I've left some comments.

Checking them Jose, thanks!

- Use GITHUB_REPOSITORY_OWNER env var directly for owner instead of
  splitting GITHUB_REPOSITORY; remove now-unused splitOwnerRepo helper
- Add comment clarifying why both event payload and API are used as
  sources for requested reviewers (event is a snapshot, API is current)
- Decode requested_reviewers API response directly into []prinfo.Reviewer
  instead of an equivalent anonymous struct

Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@migmartri migmartri merged commit 6d9c4ff into chainloop-dev:main Mar 22, 2026
15 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.

3 participants