feat(firestore): added minimum and maximum FieldValue operations#16159
feat(firestore): added minimum and maximum FieldValue operations#16159MarkDuckworth wants to merge 7 commits into
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request implements numeric minimum and maximum field transforms across the Firestore iOS SDK and core library. It introduces new FieldValue types, refactors the core TransformOperation hierarchy to include a NumericTransform base class, and adds the necessary serialization and parsing logic. Review feedback highlights that since these transforms are idempotent, they should not provide a base value in ComputeBaseValue. The reviewer recommends moving the base value logic to NumericIncrementTransform, removing the unused OperandAsLong method, and updating unit tests to align with the idempotent behavior.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for 'minimum' and 'maximum' FieldValue operations in Firestore. The changes include updates to the internal model, serialization logic, and public API, along with comprehensive unit tests. The review identifies potential memory management issues in the serializer regarding double-free risks when decoding transforms, as well as logic errors in the local view application where mixed integer and double types are not correctly promoted to double, leading to potential type mismatches.
| - (void)expectLocalAndRemoteNaN { | ||
| FIRDocumentSnapshot *snap = [_accumulator awaitLocalEvent]; | ||
| XCTAssertTrue([snap[@"sum"] isKindOfClass:[NSNumber class]]); | ||
| XCTAssertTrue(isnan([snap[@"sum"] doubleValue])); |
There was a problem hiding this comment.
small: This is using isnan() from <math.h>. In a C++ context, it is usually preferred to use std::isnan() from .
No description provided.