fix(gcp): remove the project from the number call#11
Conversation
|
/fs quality |
|
🤖 Finished Review · ✅ Success · Started 2:42 PM UTC · Completed 2:48 PM UTC |
ReviewReason: stale-head The review agent reviewed commit Previous runReviewReason: stale-head The review agent reviewed commit Previous run (2)ReviewFindingsCritical
Low
|
| // CRM is a global API — omit x-goog-user-project to avoid requiring | ||
| // the API to be enabled on the target project. | ||
| noQuotaClient := *c.Client | ||
| noQuotaClient.QuotaProject = "" |
There was a problem hiding this comment.
[critical] compilation error
The diff sets noQuotaClient.QuotaProject but gcp.Client (defined in internal/gcp/client.go) has no QuotaProject field. The struct contains only httpClient *http.Client and tokenFunc. This code will not compile.
Suggested fix: Add a QuotaProject string field to gcp.Client and update DoRequest to set the x-goog-user-project header when non-empty, or take a different approach.
| // the API to be enabled on the target project. | ||
| noQuotaClient := *c.Client | ||
| noQuotaClient.QuotaProject = "" | ||
| resp, err := noQuotaClient.DoRequest(ctx, http.MethodGet, reqURL, "") |
There was a problem hiding this comment.
[critical] logic error / no-op mechanism
Even if QuotaProject were added to gcp.Client, DoRequest never reads it or sets the x-goog-user-project HTTP header. Clearing the field would have no effect on the outgoing request.
Suggested fix: Modify DoRequest to conditionally set x-goog-user-project based on the QuotaProject field value.
|
|
||
| resp, err := c.Client.DoRequest(ctx, http.MethodGet, reqURL, "") | ||
| // CRM is a global API — omit x-goog-user-project to avoid requiring | ||
| // the API to be enabled on the target project. |
There was a problem hiding this comment.
[low] struct-copy-pattern
The shallow copy pattern is unconventional in this file. Consider adding explicit support in gcp.Client for quota-project-free requests.
Suggested fix: Add a dedicated method or option to gcp.Client for quota-project-free requests.
|
🤖 Finished Review · ✅ Success · Started 2:50 PM UTC · Completed 2:59 PM UTC |
|
/fs-review |
|
🤖 Finished Review · ✅ Success · Started 3:01 PM UTC · Completed 3:12 PM UTC |
|
/fs-review |
Generated 7 Go e2e test functions from STD YAML for the "Remove Quota Project from GCP Project Number Lookup" fix. Test coverage: 7/7 STD scenarios (TS-GH-11-001 through TS-GH-11-007) Framework: Go testing + testify Build tag: e2e Known issue: gcp.Client lacks QuotaProject field (compilation prerequisite).
QualityFlow Pipeline Summary
Test Output
Issue: GH-11 Generated by QualityFlow |
|
Closing — QF infrastructure updated on main, will re-create with improved pipeline. |
cloudresourcemanagerpermissions on the GCP project.Mirrored from upstream PR #2231