Skip to content

fix(firestore-bigquery-export): take the extension's yes/no values for snapshot syntax and old data - #3145

Merged
cabljac merged 1 commit into
docs/kits-fbe-failure-handlingfrom
feat/kits-fbe-yes-no-params
Sep 8, 2026
Merged

fix(firestore-bigquery-export): take the extension's yes/no values for snapshot syntax and old data#3145
cabljac merged 1 commit into
docs/kits-fbe-failure-handlingfrom
feat/kits-fbe-yes-no-params

Conversation

@cabljac

@cabljac cabljac commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

USE_NEW_SNAPSHOT_QUERY_SYNTAX and EXCLUDE_OLD_DATA were defineBoolean params, so only the literal true enabled them and the README told users to rewrite yes to true after a migration. The extension defines both as yes / no selects (extension.yaml:575, :589), and the migration exports those values verbatim, so a migrated .env silently left both off. Agreed direction in extension chat: stay with the closest match to the extension so users enter nothing during migration, and do better for new kits or new params.

Both are now defineString with a select({ Yes: "yes", No: "no" }) input and default no, mirroring the extension's labels, values, and default, and configFromEnv maps them with a yesNo helper. Only yes enables, compared after trimming and lowercasing so the select label Yes and stray whitespace still work; no and anything else, true included, read as off. firebase-tools copies .env values verbatim without checking them against the select, which is why the label and whitespace are forgiven; true is not, since the kit has no users who could have written it and the extension's select never emits it. WILDCARD_IDS stays defineBoolean: the extension's select there is true / false, which BooleanParam already parses. The README's "Boolean settings use true / false" difference section is removed since the difference is gone.

Audit of the rest of the kit's params: no other boolean-shaped extension param exists. delete-user-data has the same shape on ENABLE_AUTO_DISCOVERY and is not part of this stack.

Tests: four new cases in config.test.ts cover the unset value, yes, the Yes and whitespace spellings, and no / true. The defineString mock now matches the real StringParam (process.env[name] || "", never the declared default, which only the CLI prompt consults), and the one test that relied on a default now stubs the env var the way the CLI populates it. 100 tests and tsc pass at the top of the stack. Not verified against a live migration export.

Part of #3031.

@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 reverts the configuration parameters USE_NEW_SNAPSHOT_QUERY_SYNTAX and EXCLUDE_OLD_DATA to accept the extension's original yes/no string values instead of booleans, ensuring compatibility with existing configurations. The feedback suggests trimming whitespace in the yesNo helper function to prevent potential issues with leading or trailing spaces in environment variables.

Comment thread kits/firestore-bigquery-export/src/config.ts
@cabljac
cabljac force-pushed the feat/kits-fbe-yes-no-params branch from 3a31b84 to 48d163e Compare September 8, 2026 10:25
@cabljac
cabljac force-pushed the feat/kits-fbe-yes-no-params branch from 48d163e to 730f3cd Compare September 8, 2026 10:41
@cabljac
cabljac force-pushed the feat/kits-fbe-yes-no-params branch from 730f3cd to 41776c2 Compare September 8, 2026 10:50
@cabljac
cabljac force-pushed the feat/kits-fbe-yes-no-params branch from 41776c2 to 18d0516 Compare September 8, 2026 10:52
@cabljac
cabljac force-pushed the feat/kits-fbe-yes-no-params branch 2 times, most recently from 8d4a397 to b156314 Compare September 8, 2026 11:06

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

Change itself looks right: the extension declares both params as yes / no selects and compares === "yes" at runtime, and WILDCARD_IDS correctly stays true / false. Two low-severity notes inline, neither blocking.

Comment thread kits/firestore-bigquery-export/src/config.ts
Comment thread kits/firestore-bigquery-export/tests/config.test.ts Outdated
@cabljac
cabljac force-pushed the feat/kits-fbe-yes-no-params branch from b156314 to def03e7 Compare September 8, 2026 11:17
@cabljac
cabljac force-pushed the feat/kits-fbe-yes-no-params branch from def03e7 to 1b40aa1 Compare September 8, 2026 11:20
@cabljac
cabljac merged commit c7b1a5a into kits Sep 8, 2026
11 checks passed
CorieW added a commit that referenced this pull request Sep 8, 2026
firestore-bigquery-export: #3145 landed the same fix for
`USE_NEW_SNAPSHOT_QUERY_SYNTAX` and `EXCLUDE_OLD_DATA`, and recorded the
decision that `WILDCARD_IDS` stays `defineBoolean` because the extension's
select there is `true` / `false`, which `BooleanParam` already parses
(`!!process.env[name] && process.env[name] === "true"`). Resolved by taking
`kits` for the whole kit, so this branch no longer changes
firestore-bigquery-export at all: `src/config.ts` and `README.md` are the
`kits` versions, and `tests/config-runtime.test.ts` is dropped since
`tests/config.test.ts` on `kits` already covers the two yes/no params.

storage-resize-images/tests/config.test.ts: kept both sides, the
content-filter type imports from #3064 and this branch's `declaration()`
helper.

Fusion-Task-Id: WORK-004
Co-authored-by: Fusion <noreply@runfusion.ai>
CorieW added a commit that referenced this pull request Sep 8, 2026
The previous commit converted all ten extension selects to defineString
with manual === "true" coercion. Only the three yes/no params need that:
BooleanParam.runtimeValue() is `env === "true"`, so for the seven params
whose extension values are already true/false the conversion changed no
runtime value, and the declared default drives only the deploy-time
prompt (an unset variable still reads false, matching the predecessor).

select<T> is generic, so a BooleanParam carries the extension's option
labels directly. Reverts OAUTH_SECURE, DO_BACKFILL, UPDATE_ON_CONFIGURE,
ENABLE_AUTOMATIC_PUNCTUATION, MAKE_PUBLIC, IS_ANIMATED and
REGENERATE_TOKEN to defineBoolean with select<boolean>, restoring the
labels without giving up the typed param or hand-writing coercion.
ENABLE_AUTO_DISCOVERY, ENABLE_DISCUSSION_OPTION_OVERRIDES and
ENABLE_GENKIT_MONITORING stay defineString, matching #3145's scope.

Tests now pin type: "boolean" with boolean-valued options; the runtime
and unset-variable assertions are unchanged. Adds the per-kit CHANGELOG
entries the branch was missing.

Fusion-Task-Id: WORK-004
Co-authored-by: Fusion <noreply@runfusion.ai>
CorieW added a commit that referenced this pull request Sep 8, 2026
firestore-bigquery-export: #3145 landed the same fix for
`USE_NEW_SNAPSHOT_QUERY_SYNTAX` and `EXCLUDE_OLD_DATA`, and recorded the
decision that `WILDCARD_IDS` stays `defineBoolean` because the extension's
select there is `true` / `false`, which `BooleanParam` already parses
(`!!process.env[name] && process.env[name] === "true"`). Resolved by taking
`kits` for the whole kit, so this branch no longer changes
firestore-bigquery-export at all: `src/config.ts` and `README.md` are the
`kits` versions, and `tests/config-runtime.test.ts` is dropped since
`tests/config.test.ts` on `kits` already covers the two yes/no params.

storage-resize-images/tests/config.test.ts: kept both sides, the
content-filter type imports from #3064 and this branch's `declaration()`
helper.
CorieW added a commit that referenced this pull request Sep 8, 2026
The previous commit converted all ten extension selects to defineString
with manual === "true" coercion. Only the three yes/no params need that:
BooleanParam.runtimeValue() is `env === "true"`, so for the seven params
whose extension values are already true/false the conversion changed no
runtime value, and the declared default drives only the deploy-time
prompt (an unset variable still reads false, matching the predecessor).

select<T> is generic, so a BooleanParam carries the extension's option
labels directly. Reverts OAUTH_SECURE, DO_BACKFILL, UPDATE_ON_CONFIGURE,
ENABLE_AUTOMATIC_PUNCTUATION, MAKE_PUBLIC, IS_ANIMATED and
REGENERATE_TOKEN to defineBoolean with select<boolean>, restoring the
labels without giving up the typed param or hand-writing coercion.
ENABLE_AUTO_DISCOVERY, ENABLE_DISCUSSION_OPTION_OVERRIDES and
ENABLE_GENKIT_MONITORING stay defineString, matching #3145's scope.

Tests now pin type: "boolean" with boolean-valued options; the runtime
and unset-variable assertions are unchanged. Adds the per-kit CHANGELOG
entries the branch was missing.
@cabljac cabljac mentioned this pull request Sep 8, 2026
69 tasks
CorieW added a commit that referenced this pull request Sep 8, 2026
…3148)

## Summary

The kits migration turned every extension yes/no select into
`defineBoolean`. `BooleanParam` only parses the literal `true`
([`src/params/types.ts:717`](https://github.com/firebase/firebase-functions/blob/master/src/params/types.ts)),
so an `.env` copied from an extension that stored `yes` / `no` silently
reads as off. The `true` / `false` selects parsed fine but lost their
option labels.

Rule applied per param:

- Extension stored `yes` / `no`: `defineString` + `select({ Yes: "yes",
No: "no" })`, coerced in `configFromEnv()` with the extension's `===
"yes"`. Stored values unchanged; kit config types stay boolean.
- Extension stored `true` / `false` and the default is the first option:
keep `defineBoolean`, restore labels with `select<boolean>({ Yes: true,
No: false })`. Label-only, no runtime change.
- `MAKE_PUBLIC` (stored `true` / `false`, default `false` = second
option): `defineString` with `default: "false"`, coerced with `===
"true"`. The CLI's `promptSelect` passes `default` raw but stringifies
option values
([`params.ts`](https://github.com/firebase/firebase-tools/blob/master/src/deploy/functions/params.ts)
`default: resolvedDefault as string` vs `value:
option.value.toString()`), so a boolean default matches nothing and
"Yes" was preselected, making every resized image public on Enter.

Same line as #3145, which kept `WILDCARD_IDS` boolean and converted the
yes/no params. `firestore-bigquery-export` is no longer touched here.

## Affected params

| Kit | Param | Options (order) | Default | Kit param | Coercion |
| --- | --- | --- | --- | --- | --- |
| delete-user-data | `ENABLE_AUTO_DISCOVERY` | Yes=`yes`, No=`no` | `no`
| `defineString` | `=== "yes"` |
| firestore-genai-chatbot | `ENABLE_DISCUSSION_OPTION_OVERRIDES` |
Yes=`yes`, No=`no` | `no` | `defineString` | `=== "yes"` |
| firestore-genai-chatbot | `ENABLE_GENKIT_MONITORING` | Yes=`yes`,
No=`no` | `no` | `defineString` | `=== "yes"` |
| firestore-send-email | `OAUTH_SECURE` | Yes=`true`, No=`false` |
`true` | `defineBoolean` | `BooleanParam` |
| firestore-vector-search | `DO_BACKFILL` | Yes=`true`, No=`false` |
none | `defineBoolean` | `BooleanParam` |
| firestore-vector-search | `UPDATE_ON_CONFIGURE` | Yes=`true`,
No=`false` | none | `defineBoolean` | `BooleanParam` |
| speech-to-text | `ENABLE_AUTOMATIC_PUNCTUATION` | Enabled=`true`,
Disabled=`false` | `true` | `defineBoolean` | `BooleanParam` |
| storage-resize-images | `MAKE_PUBLIC` | Yes=`true`, No=`false` |
`false` | `defineString` | `=== "true"` |
| storage-resize-images | `IS_ANIMATED` | Yes=`true`, No (1st frame
only)=`false` | `true` | `defineBoolean` | `BooleanParam` |
| storage-resize-images | `REGENERATE_TOKEN` | Yes=`true`, No=`false` |
`true` | `defineBoolean` | `BooleanParam` |

## Changes

- Restored `IS_ANIMATED` "Yes" label (kit had "True") and speech-to-text
"Enabled" / "Disabled".
- Removed README notes telling users to rewrite `yes` to `true`
(delete-user-data, firestore-genai-chatbot, firestore-send-email).
- Tests in each kit's existing config test file assert param type,
default, option labels, values, order, and the parsed boolean for each
value and for unset. firestore-send-email uses
`tests/config-runtime.test.ts` because its `config.test.ts` fakes
`firebase-functions/params`.

## Verification

`npx tsc -b` clean and `npx vitest run` green in all six kits
(send-email 158, vector-search 124, resize-images 172 + 6 skipped,
delete-user-data 102, chatbot 58 + 3 skipped, speech-to-text 37).
Prettier clean.

## Follow-up

#3145 coerces yes/no with a trimming, lowercasing `yesNo()` helper; the
3 yes/no params here use the extension's bare `=== "yes"`. Aligning them
is a behavior change, so it is left for a follow-up.

## Accepted differences and inherited behavior

- Kit params with a default are not prompted as required, so the
extension's `required: true` on the yes/no params is not reproduced.
Platform difference, no value change.
- `OAUTH_SECURE` and `ENABLE_AUTOMATIC_PUNCTUATION` advertise default
`true`, but an unset variable reads as `false` in both the extension and
the kit. Reproduced for parity and pinned by tests.
- `UPDATE_ON_CONFIGURE` was declared but unused by the extension
runtime; the kit uses it. Pre-existing, out of scope.
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.

2 participants