Skip to content

fix(firestore): respect ignoreUndefinedProperties in subpipelines#8089

Open
dlarocque wants to merge 2 commits intomainfrom
dl/read-options
Open

fix(firestore): respect ignoreUndefinedProperties in subpipelines#8089
dlarocque wants to merge 2 commits intomainfrom
dl/read-options

Conversation

@dlarocque
Copy link
Copy Markdown
Contributor

If ignoreUndefiendProperties is set to true, a sub-pipeline with an undefined value should result in an error being thrown. This is not currently the case, since the _validateUserData method on PipelineValueExpression does not pass down the
ignoreUndefinedProperties config.

This fixes the issue by correctly passing down the config. This is verified by adding a test that uses an undefined value in a sub-pipeline. This test fails if we don't make the change to _validateUserData.

If `ignoreUndefiendProperties` is set to true, a sub-pipeline with an
undefined value should result in an error being thrown.
This is not currently the case, since the `_validateUserData` method on
`PipelineValueExpression` does not pass down the
`ignoreUndefinedProperties` config.

This fixes the issue by correctly passing down the config.
This is verified by adding a test that uses an undefined value in a
sub-pipeline. This test fails if we don't make the change to
`_validateUserData`.
@dlarocque dlarocque requested a review from MarkDuckworth April 21, 2026 14:23
@dlarocque dlarocque requested a review from a team as a code owner April 21, 2026 14:23
@product-auto-label product-auto-label Bot added the api: firestore Issues related to the Firestore API. label Apr 21, 2026
@dlarocque dlarocque changed the title fix(firestore): respect ignoreUndefinedProperties for ppl fix(firestore): respect ignoreUndefinedProperties in subpipelines Apr 21, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

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 updates the PipelineValueExpression class to correctly propagate the ignoreUndefinedProperties flag during user data validation and adds a system test to verify this behavior. Feedback was provided to improve the test's isolation by using a local Firestore instance instead of reassigning a shared variable and to ensure all potential validation errors are captured within the try-catch block.

Comment thread handwritten/firestore/dev/system-test/pipeline.ts Outdated
diff --git c/handwritten/firestore/dev/system-test/pipeline.ts i/handwritten/firestore/dev/system-test/pipeline.ts
index 38a7e06..f3da0b4 100644
--- c/handwritten/firestore/dev/system-test/pipeline.ts
+++ i/handwritten/firestore/dev/system-test/pipeline.ts
@@ -6217,15 +6217,15 @@ describe.skipClassic('Pipeline class', () => {
     });

     it('PipelineValueExpression respects ignoreUndefinedProperties', async () => {
-      firestore = getTestDb({ignoreUndefinedProperties: false});
+      const firestore_2 = getTestDb({ignoreUndefinedProperties: false});

-      const subWithUndefined = firestore
+      const subWithUndefined = firestore_2
         .pipeline()
         .collection('test')
         .where(equal(field('title'), {title: undefined}));

       try {
-        const results = await firestore
+        await firestore_2
           .pipeline()
           .collection(randomCol.path)
           .addFields(subWithUndefined.toArrayExpression().as('reviewsData'))
@dlarocque
Copy link
Copy Markdown
Contributor Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

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 updates the PipelineValueExpression class to correctly utilize the ignoreUndefinedProperties flag during user data validation, replacing a hardcoded string with the actual boolean parameter. Additionally, a new system test has been added to verify that the pipeline correctly respects this configuration by throwing an error when undefined values are encountered. I have no feedback to provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: firestore Issues related to the Firestore API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant