Skip to content

fix(devtools/cmd/migrate-sidekick): fix mismatch in newline handling for documentationoverrides#3341

Merged
zhumin8 merged 2 commits intomainfrom
fix-newline
Dec 23, 2025
Merged

fix(devtools/cmd/migrate-sidekick): fix mismatch in newline handling for documentationoverrides#3341
zhumin8 merged 2 commits intomainfrom
fix-newline

Conversation

@zhumin8
Copy link
Copy Markdown
Contributor

@zhumin8 zhumin8 commented Dec 23, 2025

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

@zhumin8 zhumin8 requested a review from a team as a code owner December 23, 2025 20:23
@zhumin8 zhumin8 requested a review from ldetmer December 23, 2025 20:23
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @zhumin8, 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 implements a targeted, temporary fix within the migrate-sidekick tool to resolve an inconsistency in newline handling for documentation_overrides, specifically impacting google-cloud-orgpolicy-v1. The adjustment ensures that the match field's formatting correctly reflects the newline presence in its corresponding replace field, preventing unwanted diffs in generated librarian.yaml files. This change is designed as a one-time migration solution.

Highlights

  • Newline Handling Logic: Modified the fixDocumentOverrideNewLines function to base the newline formatting of the match field on the presence of newlines in the replace field, rather than the match field itself.
  • Test Case Refinement: Updated the TestRunMigrateCommand to introduce distinct test parameters for verifying both match and replace values within documentation_overrides, enhancing test coverage for the new newline logic.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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 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 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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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 provides a targeted fix for newline handling in documentation_overrides during migration. The changes in main.go implement the desired logic, and the tests in main_test.go are appropriately updated to validate it. I've added a couple of suggestions to improve comment clarity and make test failure messages more informative. Overall, the changes are solid and achieve the intended goal.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.20%. Comparing base (d6718d1) to head (3d582d3).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3341      +/-   ##
==========================================
+ Coverage   80.72%   81.20%   +0.48%     
==========================================
  Files         163      163              
  Lines       13935    14341     +406     
==========================================
+ Hits        11249    11646     +397     
- Misses       2098     2106       +8     
- Partials      588      589       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@ldetmer ldetmer left a comment

Choose a reason for hiding this comment

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

Agreed we're just trying to get this to work for the 1 time migration

@zhumin8 zhumin8 enabled auto-merge (squash) December 23, 2025 21:52
@zhumin8 zhumin8 requested a review from ldetmer December 23, 2025 21:53
@zhumin8 zhumin8 merged commit 1328cd1 into main Dec 23, 2025
11 checks passed
@zhumin8 zhumin8 deleted the fix-newline branch December 23, 2025 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

devtools/cmd/migrate-sidekick: diff in generate --all in orgpolicy, longrunning and pubsub

2 participants