Repository navigation
fix: return undefined from deepValue when path is missing - #12776
Merged
Merged
Conversation
commit: |
Code Review by Qodo
1.
|
|
Cprakhar
approved these changes
Aug 13, 2026
gioboa
approved these changes
Aug 22, 2026
alumni
approved these changes
Aug 26, 2026
3 of 4 tasks
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #12774
Description
OrmUtils.deepValue()walked a dotted property path segment by segment without checking that the previous segment resolved to anything, so a path that runs off the end of the object threwTypeError: Cannot read properties of undefined.SelectQueryBuildercalls it in seven places to narrowselect,orderandrelationsdown to the part that applies to a single relation, and all seven treat a missing path as "nothing specified for this relation". The call that surfaced the throw in an ordinary query is the one in the query-strategy branch ofexecuteEntitiesAndRawResults(), which runs for every eager relation of the queried entity whenever find options are set. For a relation declared inside an embedded,relation.propertyPathis something likemeta.owner; find options of{ image: true }have nometakey, so the loop readownerofundefined.deepValue()now returnsundefinedas soon as a segment resolves tonullorundefined, which is what every call site already expects.Tests
test/functional/relations/load-strategy/embedded-eager-relationcovers the reported case: an entity with an eager relation inside an embedded, queried withrelationLoadStrategy: 'query'and find options that name a different relation, plus the same case withselectinstead ofrelations. Both throw on master and pass with the fix. It sits next to the existingload-strategy/querytests and mirrors theirdisabledDrivers: ["spanner"].OrmUtils.deepValue()intest/unit/util/orm-utils.test.tscovering a resolvable path and two unresolvable ones.Full suite passes locally against better-sqlite3 (the one failure is the Redis cache integration test, which needs a container runtime).