- Notifications
You must be signed in to change notification settings - Fork 1.7k
[realppl 8] realppl spec tests #14861
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
base: wuandy/RealPpl_7
Are you sure you want to change the base?
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either
Customization To customize 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 is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback. |
Generated by 🚫 Danger |
8139cf4 to f164452 Compare 38b72bd to c2bf5ec Compare bcf6c5f to 7865fe4 Compare c2bf5ec to b5ad143 Compare 22651c5 to e0ccb49 Compare 5a19c8f to 8b8d4a2 Compare 0a8821c to 9292af4 Compare 8b8d4a2 to 70c3278 Compare 9292af4 to 958cee7 Compare 70c3278 to 27a4b92 Compare 958cee7 to affb6e1 Compare 27a4b92 to bf5a534 Compare affb6e1 to cc0e1cd Compare bf5a534 to e059610 Compare cc0e1cd to 531ba2a Compare e059610 to 8d1e709 Compare 531ba2a to 82b77f2 Compare 8d1e709 to 587b678 Compare 587b678 to c6f2775 Compare 82b77f2 to a2c7960 Compare c6f2775 to 0e39951 Compare a2c7960 to 68e64f0 Compare 0e39951 to 042515a Compare | /gemini review |
There was a problem hiding this 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 significant changes to enable running Firestore spec tests in a new "pipeline mode". The core logic involves adding a usePipelineMode flag and updating test infrastructure, including FSTSpecTests and FSTSyncEngineTestDriver, to handle both traditional queries and new pipeline-based queries. This includes new validation, sorting, and comparison logic. The changes also enable pipeline support in EventManager and remote_event.cc. Numerous JSON spec tests have been added and updated to cover pipeline scenarios and fix existing issues. The overall approach is solid, but I've identified a potential compilation error, an unused variable, and an opportunity for refactoring to improve code clarity.
| // Assuming self.driver.databaseInfo is accessible and provides it. | ||
| // This might require making databaseInfo public or providing a getter in | ||
| // FSTSyncEngineTestDriver. For now, proceeding with the assumption it's available. | ||
| auto serializer = absl::make_unique<remote::Serializer>(self.driver.databaseInfo.database_id()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment on the preceding lines correctly identifies that databaseInfo is needed, but the implementation self.driver.databaseInfo will not compile as databaseInfo is not a public property on FSTSyncEngineTestDriver. You'll need to expose this, perhaps by adding a read-only property to FSTSyncEngineTestDriver.h. This issue is also present in validateExpectedSnapshotEvents.
| expectedEvents = [expectedEvents sortedArrayUsingComparator:^NSComparisonResult( | ||
| NSDictionary *left, NSDictionary *right) { | ||
| // Expected query from JSON is always a core::Query. | ||
| // For sorting consistency with actual events (which might be pipelines), | ||
| // we convert the expected query to QueryOrPipeline then get its CanonicalId. | ||
| // If _convertToPipeline is true, this will effectively sort expected items | ||
| // by their pipeline canonical ID. | ||
| Query leftJSONQuery = [self parseQuery:left[@"query"]]; | ||
| core::QueryOrPipeline leftQoP; | ||
| if (self->_convertToPipeline) { | ||
| std::vector<std::shared_ptr<api::EvaluableStage>> stages = | ||
| core::ToPipelineStages(leftJSONQuery); | ||
| auto serializer = | ||
| absl::make_unique<remote::Serializer>(self.driver.databaseInfo.database_id()); | ||
| leftQoP = | ||
| core::QueryOrPipeline(api::RealtimePipeline(std::move(stages), std::move(serializer))); | ||
| } else { | ||
| leftQoP = core::QueryOrPipeline(leftJSONQuery); | ||
| } | ||
| | ||
| Query rightJSONQuery = [self parseQuery:right[@"query"]]; | ||
| core::QueryOrPipeline rightQoP; | ||
| if (self->_convertToPipeline) { | ||
| std::vector<std::shared_ptr<api::EvaluableStage>> stages = | ||
| core::ToPipelineStages(rightJSONQuery); | ||
| auto serializer = | ||
| absl::make_unique<remote::Serializer>(self.driver.databaseInfo.database_id()); | ||
| rightQoP = | ||
| core::QueryOrPipeline(api::RealtimePipeline(std::move(stages), std::move(serializer))); | ||
| } else { | ||
| rightQoP = core::QueryOrPipeline(rightJSONQuery); | ||
| } | ||
| return WrapCompare(leftQoP.CanonicalId(), rightQoP.CanonicalId()); | ||
| }]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic to convert a JSON query description into a QueryOrPipeline is duplicated for left and right inside this comparator. This could be extracted into a helper method to improve readability and reduce code duplication. For example, you could create a method like (core::QueryOrPipeline)queryOrPipelineFromQuerySpec:(NSDictionary *)querySpec.
| NSArray *queriesJson = queryData[@"queries"]; | ||
| std::vector<TargetData> queries; | ||
| for (id queryJson in queriesJson) { | ||
| core::QueryOrPipeline qop; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.