Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where deploying specific Firestore resources using '--only firestore::rules' or 'firestore::indexes' would deploy both rules and indexes instead of only the requested resource. The logic in 'src/firestore/fsConfig.ts' was refactored to parse and filter the selected Firestore configurations more robustly, and the preparation step in 'src/deploy/firestore/prepare.ts' was simplified to rely on these parsed configurations. Comprehensive unit tests were added to verify various deployment target scenarios, including multi-database setups, target aliases, single-database configurations, and invalid targets. I have no feedback to provide as the changes are well-implemented and thoroughly tested.
aalej
left a comment
There was a problem hiding this comment.
LGTM! Tested the filters and they work as expected
Description
Fixes #11447. Supersedes #11461 (preserving @dajiaohuang's original commit and addressing all review feedback).
Database-scoped Firestore deploy selectors now honor the optional resource suffix (
:rulesor:indexes) across both single-database and multi-databasefirebase.jsonconfigurations:firestore:<databaseId|target>:rulesprepares and deploys only rules for that database or target.firestore:<databaseId|target>:indexesprepares and deploys only indexes for that database or target.firestore:<databaseId|target>continues to select both resources for that database or target.firestore:rulesandfirestore:indexesselectors remain resource-specific and merge cleanly with comma-separated database-scoped selectors in both single-database and multi-database configurations.FirebaseErrorremediation messages and{ exit: 1 }.Scenarios Tested
src/firestore/fsConfig.spec.tscovering::rules/:indexes, merged global + database-scoped selectors, and unmatched target errors withexit: 1)..firebaserc(firestore:<target>:rules,firestore:<target>:indexes, and merged global + target-scoped selectors).(default)and named single-DB configs, global + database-scoped merging, and unmatched target errors withexit: 1).exit: 1.src/deploy/firestore/prepare.spec.tsverifying database-scoped rules-only and indexes-only deploy preparation (160 passingacrosssrc/firestore/*.spec.tsandsrc/deploy/firestore/*.spec.ts).npm run build,npm run test:compile, ESLint, and Prettier checks.Sample Commands