Skip to content

fix: use correct fallback type for reviewData in fetcher#1034

Open
MaxwellCalkin wants to merge 1 commit intoanthropics:mainfrom
MaxwellCalkin:fix/review-data-type-mismatch
Open

fix: use correct fallback type for reviewData in fetcher#1034
MaxwellCalkin wants to merge 1 commit intoanthropics:mainfrom
MaxwellCalkin:fix/review-data-type-mismatch

Conversation

@MaxwellCalkin
Copy link

Summary

  • Bug: reviewData is typed as { nodes: GitHubReview[] } | null but the fallback on line 302 was [] (a plain array), causing a type mismatch when pullRequest.reviews is nullish
  • Impact: When pullRequest.reviews is null/undefined, reviewData.nodes returns undefined instead of [], breaking downstream iteration in filterReviewsToTriggerTime and filterCommentsByActor
  • Fix: Change fallback from [] to { nodes: [] } to match the declared type

Test plan

  • bun run typecheck passes cleanly
  • All data-fetcher.test.ts tests pass
  • Change is a single-line fix with no behavioral change when pullRequest.reviews is present

🤖 Generated with Claude Code

The reviewData variable is typed as `{ nodes: GitHubReview[] } | null`,
but the fallback value was `[]` (a plain array). When
`pullRequest.reviews` is null/undefined, `reviewData` becomes `[]`,
causing `reviewData.nodes` to return `undefined` instead of `[]`.

This leads to silent failures in downstream code that iterates over
`reviewData.nodes`, such as `filterReviewsToTriggerTime` and
`filterCommentsByActor`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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