Skip to content

chore: reflow long string literals to fix librarian generation diff check - #14896

Merged
zhumin8 merged 1 commit into
mainfrom
fix-librarian-diff-14862
Nov 2, 2026
Merged

zhumin8 merged 1 commit into
mainfrom
fix-librarian-diff-14862

Conversation

@zhumin8

@zhumin8 zhumin8 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Fix generation diff, unblocks the Librarian upgrade and API sources regen.

What

Runs google-java-format 1.25.2 on two handwritten test files, so their long string literals are reflowed the same way librarian generate --all reflows them:

The result is identical to the diff in the failing generation check run (same blob hashes: 06333bef, bc58e312). These are formatting-only changes, with no behavior change.

Why the PRs passed lint but broke main

  • PR lint job: runs fmt-maven-plugin 2.25. Its Formatter calls formatSource() and then only fixes imports. It never reflows long strings (StringWrapper.wrap).
  • librarian generate: runs the google-java-format --replace CLI, where reflowLongStrings defaults to true. It runs on every .java file in each library, including handwritten tests.
  • librarian_generation_check.yaml: runs only on push to main, so the mismatch shows up only after merge.

Both tools use google-java-format 1.25.2, so the version isn't the cause. The difference is the long-string reflow step. This will happen again whenever a handwritten string literal is longer than 100 columns, until the two formatters agree. That follow-up is out of scope for this PR.

Fixes #14862

…heck

Run google-java-format 1.25.2 (with long-string reflow, as used by
'librarian generate') on two handwritten test files whose string
literals exceeded the line limit. fmt-maven-plugin does not reflow long
strings, so these passed the PR lint check but fail the post-merge
generation diff check on main.

Fixes #14862

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request formats long string literals in AbstractReadContextTest.java and ITGrpcDirectPathTest.java by splitting them into concatenated substrings to adhere to line length limits. There are no review comments, and I have no feedback to provide.

@zhumin8
zhumin8 marked this pull request as ready for review November 2, 2026 21:20
@zhumin8
zhumin8 requested review from a team as code owners November 2, 2026 21:20
@zhumin8
zhumin8 enabled auto-merge (squash) November 2, 2026 21:54
@zhumin8
zhumin8 merged commit 01a74b2 into main Nov 2, 2026
192 of 208 checks passed
@zhumin8
zhumin8 deleted the fix-librarian-diff-14862 branch November 2, 2026 23:00
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.

Librarian generate diff check failed on main branch

2 participants