Enhance v2 project handling around nulls#12356
Enhance v2 project handling around nulls#12356andyfeller wants to merge 1 commit intotrunkcli/cli:trunkfrom af/12325-pr-view-project-nullcli/cli:af/12325-pr-view-project-nullCopy head branch name to clipboard
Conversation
This commit applies familiar conditional protections around v2 project items to avoid panics as mentioned in #12325.
|
Sorry, I didn't see #12324 |
There was a problem hiding this comment.
Pull request overview
This PR adds null safety guards to prevent panics when processing v2 project items that may contain null entries in their nodes array. This addresses issue #12325 where null project items from the GraphQL API could cause runtime panics.
Key changes:
- Added null checks in
ProjectsV2ItemsForIssueandProjectsV2ItemsForPullRequestfunctions to skip null nodes - Added comprehensive test cases for both issue and pull request scenarios with null project items
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| api/queries_projects_v2.go | Added nil checks before processing project item nodes in both issue and pull request fetching functions |
| api/queries_projects_v2_test.go | Added test cases to verify null project items are gracefully skipped without errors |
The changes are well-implemented and consistent with existing patterns in the codebase (e.g., similar null handling in pkg/cmd/status/status.go lines 473-492 and pkg/cmd/pr/view/view.go lines 459-468). The tests appropriately verify the new behavior, and the fix is applied at the correct layer (API) to protect all downstream consumers from null pointer panics.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Relates #12325
This commit applies familiar conditional protections around v2 project items to avoid panics including:
cli/pkg/cmd/status/status.go
Lines 473 to 492 in baf6299
cli/pkg/cmd/pr/view/view.go
Lines 459 to 468 in baf6299