Skip to content

Adds an --immediate flag to ext:uninstall which can be run outside a firebase project dir and immediately tears down GCP resources - #10921

Open
Berlioz wants to merge 5 commits into
mainfrom
vsfan_ext_uninstall_prompt
Open

Adds an --immediate flag to ext:uninstall which can be run outside a firebase project dir and immediately tears down GCP resources#10921
Berlioz wants to merge 5 commits into
mainfrom
vsfan_ext_uninstall_prompt

Conversation

@Berlioz

@Berlioz Berlioz commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@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 introduces an --immediate option to the ext:uninstall command, enabling immediate deletion of an extension instance and its associated GCP resources. The review feedback suggests several improvements: throwing a FirebaseError on deletion failure to ensure non-zero exit codes in CI environments, importing FirebaseError, adding a description to the new --immediate option, avoiding the use of any in catch clauses, and checking if the extension instance exists in the manifest before attempting removal to prevent blocking the teardown process.

Comment on lines +57 to +65
try {
await deleteInstance(projectId, instanceId);
} catch (err: any) {
logLabeledError(
logPrefix,
`Error when attempting deletion: ${err instanceof Error ? err.message : err.toString()}`,
);
return;
}

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.

high

  1. Correctness: Logging the error and returning undefined allows the command to exit with code 0 (success) even if the deletion failed. To ensure scripts and CI environments can detect failures, we should throw a FirebaseError instead.
  2. Style Guide Adherence: Use unknown instead of any in the catch clause to maintain type safety.
      try {
        await deleteInstance(projectId, instanceId);
      } catch (err: unknown) {
        throw new FirebaseError(
          `Error when attempting deletion: ${err instanceof Error ? err.message : String(err)}`,
          { original: err instanceof Error ? err : undefined }
        );
      }
References
  1. Never use any or unknown as an escape hatch. Define proper interfaces/types or use type guards. (link)
  2. Throw FirebaseError (src/error.ts) for expected, user-facing errors. (link)

This comment was marked as resolved.

Comment on lines 12 to +14
import { Options } from "../options";
import { needProjectId } from "../projectUtils";
import { confirm } from "../prompt";

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.

medium

To support throwing a FirebaseError when deletion fails, we need to import FirebaseError from ../error.

Suggested change
import { Options } from "../options";
import { needProjectId } from "../projectUtils";
import { confirm } from "../prompt";
import { Options } from "../options";
import { needProjectId } from "../projectUtils";
import { confirm } from "../prompt";
import { FirebaseError } from "../error";

Comment thread src/commands/ext-uninstall.ts Outdated
export const command = new Command("ext:uninstall <extensionInstanceId>")
.description("uninstall an extension that is installed in your Firebase project by instance ID")
.option("--local", "deprecated")
.option("--immediate", "")

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ack

Comment on lines +34 to +45
let config;
try {
config = manifest.loadConfig(options);
} catch (err: any) {
logLabeledBullet(
logPrefix,
"No firebase.json found. Proceeding to immediate extension instance teardown.",
);
}
if (config) {
manifest.removeFromManifest(instanceId, config);
}

This comment was marked as resolved.

@Berlioz
Berlioz force-pushed the vsfan_ext_uninstall_prompt branch from a589fd1 to 338c91f Compare August 11, 2026 22:39
@Berlioz
Berlioz requested a review from ajperel August 11, 2026 22:44

@inlined inlined 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.

LGTM after you run the formatter.

Comment thread src/commands/ext-uninstall.ts Outdated
`Error when attempting deletion: ${err instanceof Error ? err.message : String(err)}`,
{ original: err instanceof Error ? err : undefined }
);
return;

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.

What the heck does return after throw mean?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it means i'm an idiot

@Berlioz
Berlioz force-pushed the vsfan_ext_uninstall_prompt branch from 546126a to fd1d971 Compare August 11, 2026 23:14
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.

4 participants