Skip to content

Commit 989e529

Browse files
[MCP] dataconnect firebase_init start Cloud SQL provision if it can (#8937)
* Fix the products_initialized GA stats * move into init * Automatically start Cloud SQL provision from dataconnect MCP tool * revert * tests * Update init.ts * Update src/mcp/tools/core/init.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * Update init.ts --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 1d3e49a commit 989e529

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/init/features/dataconnect/index.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as init from "./index";
66
import { Config } from "../../../config";
77
import { RCData } from "../../../rc";
88
import * as provison from "../../../dataconnect/provisionCloudSql";
9+
import * as cloudbilling from "../../../gcp/cloudbilling";
910

1011
const MOCK_RC: RCData = { projects: {}, targets: {}, etags: {} };
1112

@@ -23,6 +24,7 @@ describe("init dataconnect", () => {
2324
beforeEach(() => {
2425
provisionCSQLStub = sandbox.stub(provison, "provisionCloudSql");
2526
ensureSyncStub = sandbox.stub(fs, "ensureFileSync");
27+
sandbox.stub(cloudbilling, "isBillingEnabled").resolves(true);
2628
});
2729

2830
afterEach(() => {

src/init/features/dataconnect/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export async function actuate(setup: Setup, config: Config, options: any): Promi
150150

151151
await writeFiles(config, info, options);
152152

153-
if (setup.projectId && info.shouldProvisionCSQL) {
153+
if (setup.projectId && info.shouldProvisionCSQL && (await isBillingEnabled(setup))) {
154154
await provisionCloudSql({
155155
projectId: setup.projectId,
156156
location: info.locationId,

src/mcp/tools/core/init.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ export const init = tool(
147147
cloudSqlInstanceId: features.dataconnect.cloudsql_instance_id || "",
148148
cloudSqlDatabase: features.dataconnect.cloudsql_database || "",
149149
connectors: [], // TODO populate with GiF,
150-
isNewInstance: false,
151-
isNewDatabase: false,
150+
isNewInstance: false, // not used by actuate
151+
isNewDatabase: false, // not used by actuate
152152
schemaGql: [], // TODO populate with GiF
153-
shouldProvisionCSQL: false,
153+
shouldProvisionCSQL: true, // Always try to provision Cloud SQL for MCP tool init.
154154
};
155155
}
156156
const setup: Setup = {

0 commit comments

Comments
 (0)