Skip to content

fix: kits:install prompts if some configurations are missing - #11009

Merged
wandamora merged 6 commits into
mainfrom
morawand-fix-env-prompting
Sep 1, 2026
Merged

fix: kits:install prompts if some configurations are missing#11009
wandamora merged 6 commits into
mainfrom
morawand-fix-env-prompting

Conversation

@wandamora

@wandamora wandamora commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Description

Updates function kit installation logic to properly handle and prompt for unconfigured instances when some configurations are missing for a project, rather than evaluating the entire kit as a whole.

  • Unconfigured Instance Detection: Added getUnconfiguredInstancesForProject to identify specific kit instances lacking a .env or configuration file for the current project.
  • Prompting & Choices: Updated promptExistingInstanceForProject and addKitInstanceOrConfigureProject to filter choices exclusively to unconfigured instances and handle interactive/non-interactive workflows appropriately.
  • Instance ID Routing & CI/CD Support: Updated addKitInstanceOrConfigureProject to properly route options.instanceId:
    • Existing unconfigured instance ID -> configures environment (addEnv) without prompting.
    • Existing already-configured instance ID -> throws FirebaseError.
    • Net-new instance ID -> adds instance (addInstance) without prompting.
    • Instance ID collision with another kit or codebase -> throws FirebaseError.

Scenarios Tested

  • Verified that when a kit has multiple instances and some are already configured for the project, users are prompted only with the unconfigured instances.
  • Tested non-interactive mode behavior when dealing with unconfigured kit instances.
  • Verified proper error throwing when attempting to configure already-configured instances or when no unconfigured instances remain.
  • Verified that specifying an unconfigured instanceId configures that instance directly without prompting or duplicate ID collision errors.
  • Verified that specifying a net-new instanceId adds the instance directly without prompting.
  • Verified proper error throwing when a specified instanceId belongs to another kit or codebase.

@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 refactors the Firebase functions kit installation process to track and handle unconfigured instances on a per-project basis. It introduces getUnconfiguredInstancesForProject, updates isKitConfiguredForProject to ensure all instances are configured, and refactors prompting logic to restrict choices to unconfigured instances. The reviewer identified a critical issue in non-interactive mode where specifying an existing but unconfigured instanceId incorrectly defaults to adding a new instance instead of configuring the environment, which would cause a FirebaseError in CI/CD environments, and provided a code suggestion to resolve it.

Comment thread src/functions/kits/install.ts Outdated
@wandamora
wandamora requested a review from ajperel September 1, 2026 00:18
Comment thread src/functions/kits/install.ts
Comment thread src/functions/kits/install.ts Outdated
Comment thread src/functions/kits/install.ts Outdated
Comment thread src/functions/kits/install.ts Outdated
Comment thread src/functions/kits/install.spec.ts Outdated
Comment thread src/functions/kits/install.ts Outdated
Comment thread src/functions/kits/install.ts Outdated
Comment thread src/functions/kits/install.ts Outdated
Comment thread src/functions/kits/install.ts
Comment thread src/functions/kits/install.ts Outdated
Comment thread src/functions/kits/install.ts Outdated
wandamora and others added 3 commits September 1, 2026 18:37
…g and config checks

- Routes options.instanceId in addKitInstanceOrConfigureProject to properly support configuring existing unconfigured instances or creating net-new instances non-interactively.
- Renames isKitConfiguredForProject to isKitFullyConfiguredForProject, reuses getUnconfiguredInstancesForProject, and documents 0-instance behavior.
- Derives isConfiguredForProject in memory from unconfiguredInstances to avoid redundant disk reads.
- Clarifies error message when an instance ID does not exist in a kit.
- Types unconfiguredInstanceIds as readonly string[].
- Fixes ExistingFunctionsInfo mock types to use arrays following #11008.
@wandamora
wandamora merged commit 4bdc5a3 into main Sep 1, 2026
51 checks passed
@wandamora
wandamora deleted the morawand-fix-env-prompting branch September 1, 2026 21:07
projectId,
projectAlias,
);
const isConfiguredForProject =

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.

still think naming this like isFullyConfigured or something would better convey the intent (just now the var name instead of the function name)

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