Skip to content

fix: prevent premature caching of API enablement status#10740

Open
fredzqm wants to merge 3 commits into
mainfrom
fix-api-enablement-race-condition-14193484741930371072
Open

fix: prevent premature caching of API enablement status#10740
fredzqm wants to merge 3 commits into
mainfrom
fix-api-enablement-race-condition-14193484741930371072

Conversation

@fredzqm

@fredzqm fredzqm commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Fixes a race condition where the CLI prematurely caches Google Cloud APIs as enabled immediately upon initiating the enablement process, leading to false positives during polling.


PR created automatically by Jules for task 14193484741930371072 started by @fredzqm

…Enabled.ts`

When initiating API enablement, the status was cached immediately before actually verifying the long-running operation completed. This commit removes the `cacheEnabledAPI` call from the `enable` method, relying on the `check` method to correctly cache the status once polling succeeds. Tests have been updated accordingly.

Co-authored-by: fredzqm <9068391+fredzqm@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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

Code Review

This pull request removes the call to cacheEnabledAPI(projectId, apiName) when enabling an API in src/ensureApiEnabled.ts, and removes the corresponding mock assertion from the unit tests in src/ensureApiEnabled.spec.ts. I have no feedback to provide as there are no review comments.

@joehan joehan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So, we added this caching in order to avoid overloading our shared quota. Does this disable it entirely, or is there a later spot where the chaching gets triggered?

google-labs-jules Bot and others added 2 commits June 30, 2026 19:26
…Enabled.ts`

When initiating API enablement, the status was cached immediately before actually verifying the long-running operation completed. This commit removes the `cacheEnabledAPI` call from the `enable` method, relying on the `check` method to correctly cache the status once polling succeeds. Tests have been updated accordingly.

Co-authored-by: fredzqm <9068391+fredzqm@users.noreply.github.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.

3 participants