Skip to content

fix(kits/delete-user-data): fall back to default search fields when empty - #3231

Merged
CorieW merged 5 commits into
kitsfrom
fix/kits-delete-user-data-empty-search-fields
Oct 13, 2026
Merged

CorieW merged 5 commits into
kitsfrom
fix/kits-delete-user-data-empty-search-fields

Conversation

@CorieW

@CorieW CorieW commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

With the same .env, the kit and the extension deleted different data when AUTO_DISCOVERY_SEARCH_FIELDS was empty. The Extensions backend stores an empty value as unset and applies the id,uid,userId default. The kit kept it empty and matched on document paths only, so it skipped documents that only matched on a field.

  • Confirmed on corie-testing: a validateOnly create of firebase/delete-user-data@0.1.30 with AUTO_DISCOVERY_SEARCH_FIELDS: "" comes back with id,uid,userId. A deployed instance configured with an empty value also has id,uid,userId in its env. The CLI sends "" unchanged, so the substitution is done by the backend.
  • configFromEnv now passes the value through optional(), like the other optional params, so the resolver applies the default.
  • The README's "Empty search fields no longer error" difference is removed, and "Unchanged" now notes the fallback.
  • Test added to config.test.ts. It fails without the fix. All 117 tests pass and tsc builds.
  • Tested end to end: redeployed a kit instance with AUTO_DISCOVERY_SEARCH_FIELDS=. It logs searchFields: "id,uid,userId" and deletes the same field-matched docs the extension does. Before the fix it left 4 of them.
  • The handlers/helpers handling of empty searchFields is unchanged, so ./lib callers who pass "" themselves still get path-only matching.

… is empty

The Extensions platform stores an empty AUTO_DISCOVERY_SEARCH_FIELDS as
unset and applies the id,uid,userId default, so an installed extension
never runs with empty search fields. The kit kept the empty value and
matched on document paths only, deleting less data for the same config.

@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 ensures that an empty AUTO_DISCOVERY_SEARCH_FIELDS configuration falls back to the default id,uid,userId values, aligning the kit's behavior with the Extensions platform. The changes update the configuration parsing logic, document the behavior in the README and CHANGELOG, and add a unit test to verify the fallback mechanism. There are no review comments, so I have no feedback to provide.

@CorieW CorieW changed the title fix(kits): fall back to default search fields when delete-user-data's is empty fix(kits/delete-user-data): fall back to default search fields when empty Oct 13, 2026

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

Lgtm. One small optional follow-up: the searchFields param description in kits/delete-user-data/src/config.ts still ends with "If left empty, document fields will not be used in auto discovery." With this change an empty value uses the default, so that sentence could read:

If left empty, the default fields (id,uid,userId) are used.

Fine to do here or in a follow-up.

…data-empty-search-fields

# Conflicts:
#	kits/delete-user-data/README.md
@CorieW
CorieW merged commit d91f27f into kits Oct 13, 2026
11 checks passed
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