Repository navigation
fix: Treat BusinessTeam as a regular Team for Environment reviewers - #4638
Conversation
There was a problem hiding this comment.
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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
@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
left a comment
There was a problem hiding this comment.
Thank you, @JamBalaya56562 and @JWilkinsonMB!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
|
Thank you, @Not-Dhananjay-Mishra! |
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 withnew(...), 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", soRequiredReviewer.UnmarshalJSONfails and any environment that has such a reviewer cannot be read. This treatsBusinessTeamas aTeam: the reviewer is decoded into a*TeamandTypeis set to"Team", so existing callers (such as the Terraform provider) keep working without changes.Note that the OpenAPI descriptions still list only
UserandTeamfordeployment-reviewer-type; theBusinessTeamvalue comes from the API responses reported in #4457 and #4456.Verified locally:
go build ./...,go vet -tags integration ./test/integration/,go test ./...(100% coverage ofRequiredReviewer.UnmarshalJSON), andcustom-gcl0 issues.