Skip to content

feat(firestore): added minimum and maximum FieldValue operations#16159

Open
MarkDuckworth wants to merge 7 commits into
mainfrom
markduckworth/min-max-field-value
Open

feat(firestore): added minimum and maximum FieldValue operations#16159
MarkDuckworth wants to merge 7 commits into
mainfrom
markduckworth/min-max-field-value

Conversation

@MarkDuckworth
Copy link
Copy Markdown
Contributor

No description provided.

@MarkDuckworth MarkDuckworth requested a review from a team as a code owner May 6, 2026 19:03
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

@MarkDuckworth
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 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.

Comment thread Firestore/core/src/model/transform_operation.cc
Comment thread Firestore/core/src/model/transform_operation.cc
Comment thread Firestore/core/src/model/transform_operation.cc Outdated
Comment thread Firestore/core/test/unit/model/mutation_test.cc
@MarkDuckworth
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 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.

Comment thread Firestore/core/src/remote/serializer.cc
Comment thread Firestore/core/src/remote/serializer.cc
Comment thread Firestore/core/src/model/transform_operation.cc
Comment thread Firestore/core/src/model/transform_operation.cc
- (void)expectLocalAndRemoteNaN {
FIRDocumentSnapshot *snap = [_accumulator awaitLocalEvent];
XCTAssertTrue([snap[@"sum"] isKindOfClass:[NSNumber class]]);
XCTAssertTrue(isnan([snap[@"sum"] doubleValue]));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small: This is using isnan() from <math.h>. In a C++ context, it is usually preferred to use std::isnan() from .

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants