Repository navigation
fix(kits/delete-user-data): fall back to default search fields when empty - #3231
Conversation
… 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
With the same
.env, the kit and the extension deleted different data whenAUTO_DISCOVERY_SEARCH_FIELDSwas empty. The Extensions backend stores an empty value as unset and applies theid,uid,userIddefault. The kit kept it empty and matched on document paths only, so it skipped documents that only matched on a field.corie-testing: avalidateOnlycreate offirebase/delete-user-data@0.1.30withAUTO_DISCOVERY_SEARCH_FIELDS: ""comes back withid,uid,userId. A deployed instance configured with an empty value also hasid,uid,userIdin its env. The CLI sends""unchanged, so the substitution is done by the backend.configFromEnvnow passes the value throughoptional(), like the other optional params, so the resolver applies the default.config.test.ts. It fails without the fix. All 117 tests pass andtscbuilds.AUTO_DISCOVERY_SEARCH_FIELDS=. It logssearchFields: "id,uid,userId"and deletes the same field-matched docs the extension does. Before the fix it left 4 of them.handlers/helpershandling of emptysearchFieldsis unchanged, so./libcallers who pass""themselves still get path-only matching.