codeconsole commented on PR #16297:
URL: https://github.com/apache/grails-core/pull/16297#issuecomment-5529932700
Thanks — added in 87219f1530.
**`MongoIdCoercionSpec`** (12 cases, no live MongoDB) covers both coercion
directions and their fallback branches directly: null key, null entity, a value
already of the target type, the non-hex natural key that must stay a String
rather than produce a `{_id: null}` filter, an `ObjectId id` domain being left
alone, and a round trip. This was the weakest file in the coverage report at
33%.
**`StringIdAssociationStorageSpec`** (8 cases) asserts the BSON that
actually lands on disk rather than only that traversal works — traversal passed
the whole time the stored type was wrong, which is why this went unnoticed. It
covers to-one and to-many reference storage, resolution through GORM, a
bidirectional one-to-many, `findAllById`, `findAllByIdInList`, and a reference
written as a BSON String so pre-existing data keeps decoding.
Each case was checked against reverted production code so it fails without
the fix:
- reverting the encoders + `MongoQuery` fails the two reference-storage
cases and `findAllById`
- reverting **only** `MongoQuery` fails the bidirectional one-to-many and
`findAllById`
The second check turned out to matter: with everything reverted the
bidirectional case still passes, because references written as String and
queried as String are self-consistent. It only fails in the mixed state that
the encoder fix creates, which is the real-world one.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]