Skip to content

fix: Treat BusinessTeam as a regular Team for Environment reviewers - #4638

Merged
gmlewis merged 3 commits into
google:masterfrom
JamBalaya56562:fix/4457-business-team-reviewer
Oct 17, 2026
Merged

gmlewis merged 3 commits into
google:masterfrom
JamBalaya56562:fix/4457-business-team-reviewer

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes: #4457.
Closes: #4456.

Supersedes #4456 by @JWilkinsonMB, which has been waiting on the Google CLA since August. This is the same change, rebased onto current master (Ptr(...) is replaced with new(...), following the rest of the package). All credit for the fix goes to @JWilkinsonMB.

When an Enterprise Team is a required reviewer of an environment, the API returns "type": "BusinessTeam", so RequiredReviewer.UnmarshalJSON fails and any environment that has such a reviewer cannot be read. This treats BusinessTeam as a Team: the reviewer is decoded into a *Team and Type is set to "Team", so existing callers (such as the Terraform provider) keep working without changes.

Note that the OpenAPI descriptions still list only User and Team for deployment-reviewer-type; the BusinessTeam value comes from the API responses reported in #4457 and #4456.

Verified locally: go build ./..., go vet -tags integration ./test/integration/, go test ./... (100% coverage of RequiredReviewer.UnmarshalJSON), and custom-gcl 0 issues.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request adds support for unmarshaling the 'BusinessTeam' reviewer type (used for Enterprise Teams) and treating it as a 'Team' type for compatibility, along with corresponding unit tests. Feedback was provided to improve the error message when unmarshaling fails: using %T on reviewer.Type (a *string) prints the Go type '*string' rather than the actual invalid string value, so it is recommended to dereference the pointer and format it with '%q' instead.

Comment thread github/repos_environments.go Outdated
@codecov

codecov Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.61%. Comparing base (af24e38) to head (09d05a2).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4638   +/-   ##
=======================================
  Coverage   98.61%   98.61%           
=======================================
  Files         199      199           
  Lines       18689    18694    +5     
=======================================
+ Hits        18431    18436    +5     
  Misses        258      258           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JWilkinsonMB

Copy link
Copy Markdown

@JamBalaya56562 - Thanks for taking this up! Still hope to get the CLA agreed for next time but it's not been a quick process...

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Oct 16, 2026

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @JamBalaya56562 and @JWilkinsonMB!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @Not-Dhananjay-Mishra

@Not-Dhananjay-Mishra Not-Dhananjay-Mishra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@gmlewis

gmlewis commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

Thank you, @Not-Dhananjay-Mishra!
Merging.

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Oct 17, 2026
@gmlewis
gmlewis merged commit fef0352 into google:master Oct 17, 2026
15 checks passed
@JamBalaya56562
JamBalaya56562 deleted the fix/4457-business-team-reviewer branch October 17, 2026 14:53
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.

Including an enterprise team as a reviewer for an environment results an unmarshal error

4 participants