chore: add handling for converting newlines in documentoverrides from toml to yaml#3284
chore: add handling for converting newlines in documentoverrides from toml to yaml#3284
Conversation
Summary of ChangesHello @ldetmer, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a crucial fix for the Highlights
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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds a post-processing step to the sidekick migration tool to handle newlines in documentoverrides when converting from TOML to YAML. While the intent is correct, the implementation manually parses the YAML file using string manipulation, which is highly fragile and prone to breaking. My review includes a critical comment suggesting a refactor to use the YAML library's AST manipulation features for a more robust and maintainable solution.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3284 +/- ##
=======================================
Coverage 80.28% 80.29%
=======================================
Files 162 162
Lines 13724 13785 +61
=======================================
+ Hits 11018 11068 +50
- Misses 2137 2143 +6
- Partials 569 574 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…for documentationoverrides (#3341) Add on a temp fix on top of the previous fix #3284. This fix tries to align the expected format for `documentation_overrides` for `google-cloud-orgpolicy-v1`. This is a brittle change, but as we don't expect new `documentation_overrides` in the next few days and this is a one time migration, it should be acceptable. Verified locally after this change, `librarian generate google-cloud-orgpolicy-v1` produces no diff. And the only diff it produced for librarian.yaml is the following: ``` --- a/librarian.yaml +++ b/librarian.yaml @@ -1084,14 +1084,16 @@ libraries: title_override: Organization Policy Types documentation_overrides: - id: .google.cloud.orgpolicy.v1.Policy.ListPolicy - match: 'Ancestry subtrees must be in one of the following formats:' + match: | + Ancestry subtrees must be in one of the following formats: replace: | - + Ancestry subtrees must be in one of the following formats: - id: .google.cloud.orgpolicy.v1.Policy.ListPolicy - match: The `supports_under` field of the associated `Constraint` defines whether + match: | + The `supports_under` field of the associated `Constraint` defines whether replace: | - + The `supports_under` field of the associated `Constraint` defines whether ``` Additional context about this fix: #3330 (comment) Fix #3330
Newlines were getting stripped from documentoverrides field. Originally I had tried the "proper" solution to set this field to LiteralStyle in yaml which should then keep the newlines. However that was not working properly when we read and wrote back to the file.. Since this is a 1 time migration script I decided just to go with a brute force solution to unblock us as this code will not be used once we migrate the sidekick repo.
Fix #3136