Skip to content

fix(internal/librariangen): release preview support#14588

Merged
noahdietz merged 1 commit into
googleapis:mainfrom
noahdietz:librariangen-preview-staging
May 15, 2026
Merged

fix(internal/librariangen): release preview support#14588
noahdietz merged 1 commit into
googleapis:mainfrom
noahdietz:librariangen-preview-staging

Conversation

@noahdietz

Copy link
Copy Markdown
Contributor

Adds support for doing version bumps and changelog updates for preview libraries.

Tested locally + unit test.

Toward googleapis/librarian#5894

@noahdietz noahdietz requested review from a team as code owners May 14, 2026 18:47
@noahdietz noahdietz requested a review from shollyman May 14, 2026 18:47
@noahdietz noahdietz enabled auto-merge (squash) May 14, 2026 18:47

@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 introduces support for releasing "preview" modules by adjusting directory paths, changelog locations, and skipping snippet updates for libraries with a "-preview" suffix. A review comment correctly identifies that the generated git tags for these modules must include the full relative path (e.g., "preview/internal/...") to be properly recognized as submodule tags in the repository, providing a specific code suggestion to resolve this.

Comment on lines +138 to +142
moduleName := lib.ID
if previewModule != "" {
moduleName = previewModule
}
tag := strings.NewReplacer("{id}", moduleName, "{version}", lib.Version).Replace(lib.TagFormat)

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.

high

The tag generated for preview modules appears to be incorrect for Go submodules. In the google-cloud-go repository, tags for submodules must be prefixed with the module's relative path from the repository root (e.g., preview/internal/secretmanager/v1.0.0).

Currently, moduleName is set to just the base name (e.g., secretmanager), which results in a tag like secretmanager/v1.16.0-preview.1. This tag would be incorrectly associated with the main module at the root instead of the preview module.

Note that applying this fix will require updating the test expectation in release_test.go to include the preview%2Finternal%2F prefix in the encoded tag URL.

Suggested change
moduleName := lib.ID
if previewModule != "" {
moduleName = previewModule
}
tag := strings.NewReplacer("{id}", moduleName, "{version}", lib.Version).Replace(lib.TagFormat)
moduleName := lib.ID
if previewModule != "" {
moduleName = "preview/internal/" + previewModule
}
tag := strings.NewReplacer("{id}", moduleName, "{version}", lib.Version).Replace(lib.TagFormat)

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.

What Gemini is describing is the intended behavior here as far as I'm aware - because it doesn't know about the switcheroo which moves the code from /preview/internal/compute to /compute when releasing.

@noahdietz noahdietz requested a review from jskeet May 14, 2026 20:08
@noahdietz noahdietz changed the title fix(internal/librariange): release preview support fix(internal/librariangen): release preview support May 14, 2026
Comment thread internal/librariangen/release/release_test.go
Comment thread internal/librariangen/release/release_test.go
@noahdietz noahdietz merged commit a42fd83 into googleapis:main May 15, 2026
11 checks passed
@jskeet

jskeet commented May 15, 2026

Copy link
Copy Markdown
Contributor

(Humbug, hadn't seen this was on automerge. Not to worry - but a new PR that makes the tests reflect the expected reality would be welcome.)

@noahdietz

Copy link
Copy Markdown
Contributor Author

(Humbug, hadn't seen this was on automerge. Not to worry - but a new PR that makes the tests reflect the expected reality would be welcome.)

Fix PR incoming :)

@noahdietz noahdietz deleted the librariangen-preview-staging branch May 15, 2026 16:24
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.

2 participants