-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Implement TODOs and add tests #15535
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
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 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 counter productive. 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. |
Generated by 🚫 Danger |
|
/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 is a great improvement, replacing fatalError calls with proper error handling through a new DecodingError enum. This makes the Generable decoding much more robust. The addition of a comprehensive test suite is also a valuable contribution, covering various success and failure scenarios for decoding. My feedback focuses on a few minor points: removing a couple of leftover TODO comments, simplifying some code for better clarity, and removing a redundant test case.
|
/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 is a significant improvement, addressing TODOs by replacing fatalError calls with proper, typed error handling. The introduction of ModelOutput.DecodingError and its usage throughout the Generable initializers makes the decoding process more robust. The addition of a comprehensive test suite in GenerableTests.swift is excellent, covering success cases, various error conditions, and schema validation. My feedback includes a few suggestions to further refine error reporting for numeric conversions to be more descriptive, and a minor cleanup to remove a redundant check.
59c70a6 to
bcd9e06
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 is an excellent pull request that significantly improves the robustness and test coverage of the codebase. Replacing fatalError with proper error handling is a crucial change, and the new DecodingError enum is well-designed. The addition of comprehensive unit tests for various decoding scenarios, including nested objects and error conditions, is a great contribution. The code is now cleaner and more reliable. I have one minor suggestion to make a test assertion more robust.
| _ = try Person(modelOutput) | ||
| Issue.record("Did not throw an error.") | ||
| } catch let GenerativeModel.GenerationError.decodingFailure(context) { | ||
| #expect(context.debugDescription.contains("\"forty\" does not contain Int")) |
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 assertion on the debugDescription of the error seems to be checking for a substring that won't be present. The decodingFailure helper creates a message like FirebaseAILogic.ModelOutput does not contain Int.\nContent: "forty". The current check for \"forty\" does not contain Int will likely fail. It's better to check for the relevant parts of the error message separately to make the test more robust.
#expect(context.debugDescription.contains("does not contain Int") && context.debugDescription.contains("\"forty\""))bcd9e06 to
0db7eda
Compare
@andrewheard Feel free to merge if close or useful.