Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Address edge cases for excluding large properties when using save #1356

Merged
merged 7 commits into from
Nov 6, 2024

Conversation

danieljbruce
Copy link
Contributor

Summary

To solve #1242 a PR was merged. However, some edge cases remain where a valid argument passed into the save function will produce an error when it shouldn't. This PR contains changes that address those edge cases that were already reviewed in the following PRs:

#1336
#1349
#1350
#1355

danieljbruce and others added 7 commits October 31, 2024 17:18
…rties in arrays (#1336)

* Add some test cases for findLargeProperties_

* Add a test for arrays and skip it.

* Add a test for the complex case wrapped in an arra

* Add a test case for an array without name/value.

* Add another test for name/value pair

* Change the test case involving a name/value pair

* Add two simple test cases for excludeFromIndexes

* Add another unit test for findLargeProperties_

* Remove if block that stops recursion

* Add a test for save with a `name/value` pair

* Add some test code that ensures name/value encoded

Against the current source code, this test fails because the code throws an error, but it should pass.

* Add header

* Remove only

* Add a test that saves a long string value property

* Add a unit test checking longString for value

* Remove only

* TODO is done
…cludeFromIndexes list (#1349)

* Add some test cases for findLargeProperties_

* Add a test for arrays and skip it.

* Add a test for the complex case wrapped in an arra

* Add a test case for an array without name/value.

* Add another test for name/value pair

* Change the test case involving a name/value pair

* Add two simple test cases for excludeFromIndexes

* Add another unit test for findLargeProperties_

* Remove if block that stops recursion

* Add a test for save with a `name/value` pair

* Add some test code that ensures name/value encoded

Against the current source code, this test fails because the code throws an error, but it should pass.

* Add header

* Remove only

* Add a test that saves a long string value property

* Add a unit test checking longString for value

* Remove only

* TODO is done

* Refactor the save function

Pull out the code that extends the excludeFromIndexes list

* Add TODO

* Write unit tests for the new excludeFromIndexes fn

* Add the header

* Document parameter for extendExcludeFromIndexes

* Remove redundant check
* Add some test cases for findLargeProperties_

* Add a test for arrays and skip it.

* Add a test for the complex case wrapped in an arra

* Add a test case for an array without name/value.

* Add another test for name/value pair

* Change the test case involving a name/value pair

* Add two simple test cases for excludeFromIndexes

* Add another unit test for findLargeProperties_

* Remove if block that stops recursion

* Add a test for save with a `name/value` pair

* Add some test code that ensures name/value encoded

Against the current source code, this test fails because the code throws an error, but it should pass.

* Add header

* Remove only

* Add a test that saves a long string value property

* Add a unit test checking longString for value

* Remove only

* TODO is done

* Refactor the save function

Pull out the code that extends the excludeFromIndexes list

* Add TODO

* Write unit tests for the new excludeFromIndexes fn

* Add the header

* Refactor the code for building the entity proto

* Rename it buildEntityProto

* The tests need another mock due to the structure

The structure change requires another mock.

* First two tests for buildEntityProto

* Reintroduce extendExcludeFromIndexes.ts tests

* Adjust the test to match expected proto

* Add another test for an entity in an array

* Add headers

* Add another header

* Eliminate space. Simplify diff
…Proto always excludes large properties from indexing (#1355)

* Add some test cases for findLargeProperties_

* Add a test for arrays and skip it.

* Add a test for the complex case wrapped in an arra

* Add a test case for an array without name/value.

* Add another test for name/value pair

* Change the test case involving a name/value pair

* Add two simple test cases for excludeFromIndexes

* Add another unit test for findLargeProperties_

* Remove if block that stops recursion

* Add a test for save with a `name/value` pair

* Add some test code that ensures name/value encoded

Against the current source code, this test fails because the code throws an error, but it should pass.

* Add header

* Remove only

* Add a test that saves a long string value property

* Add a unit test checking longString for value

* Remove only

* TODO is done

* Refactor the save function

Pull out the code that extends the excludeFromIndexes list

* Add TODO

* Write unit tests for the new excludeFromIndexes fn

* Add the header

* Refactor the code for building the entity proto

* Rename it buildEntityProto

* The tests need another mock due to the structure

The structure change requires another mock.

* First two tests for buildEntityProto

* Reintroduce extendExcludeFromIndexes.ts tests

* Adjust the test to match expected proto

* Add another test for an entity in an array

* Add headers

* Add another header

* Add some tests for checkEntityProto

Make sure that checkEntityProto is working correctly.

* Empty commit

* Pull out complexCaseEntities

* Add a few more tests to excludeIndexesAndBuildProto

* Add generated test cases ensuring completeness

* Add a few comments that explain behaviour of block

* Add comments explaining code blocks

* Add a bunch of other generated tests

* Make this test more meaningful for name/value chek

* Fix the generator

* Remove console logs

* Add better test name descriptions

* Add TODO

* Add a comment about the array of arrays test case

* Increase the max depth

* Add headers to the codebase

* Update parameter descriptions

* Add a bunch of parameter documentation

Correct only as well.
@danieljbruce danieljbruce requested review from a team as code owners November 5, 2024 22:24
@product-auto-label product-auto-label bot added size: xl Pull request size is extra large. api: datastore Issues related to the googleapis/nodejs-datastore API. labels Nov 5, 2024
@danieljbruce danieljbruce merged commit ceaff7e into main Nov 6, 2024
17 checks passed
@danieljbruce danieljbruce deleted the exclude-from-indexes-cleanup branch November 6, 2024 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the googleapis/nodejs-datastore API. size: xl Pull request size is extra large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants