GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chore(librariangen): languagecontainer package to parse release-init request by suztomo · Pull Request #3965 · googleapis/sdk-platform-java

This repository was archived by the owner on Oct 29, 2026. It is now read-only.

Conversation

@suztomo

@suztomo suztomo commented Oct 21, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Introducing languagecontainer package.

  • New languagecontainer package: A new languagecontainer package has been introduced to encapsulate language-specific container operations and command execution logic, promoting modularity. This package parses the request JSON file and calls the
    corresponding implementation method in each language container. The languagecontainer package itself should not have language-specific implementation.

    • release-init command parsing: The languagecontainer.Run function now includes robust logic to parse release-init requests from JSON files, handle command-line flags, and invoke the ReleaseInit function.
    • Why isn't this providing an interface? It's because if LanguageContainer is an interface, then there would be package name conflict of languagecontainer/release package (language agostic) and release package (language-specific. In this case Java-specific). Here is a piece of code.
  • Main command dispatch refactor: The librariangen main.go has been refactored to delegate non-generate commands to the new languagecontainer.Run function, centralizing command execution and wiring up release.Init for the release-init command.

  • message.Change struct update: The SourceCommitHash field in the message.Change struct has been renamed to CommitHash for improved clarity and consistency. This is due to the recent renaming of the field and google-cloud-go/internal/librariangen/request.Change already has the field.

The user (Java's language container in this case) doesn't have to implement the parsing logic and the tests. I moved the argument parsing tests to languagecontainer/languagecontainer_test.go from main_test.go.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@suztomo
chore: release init command stub
8d9e83e
@product-auto-label product-auto-label Bot added the size: l Pull request size is large. label Oct 21, 2025
@gemini-code-assist

gemini-code-assist Bot commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @suztomo, 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 significant architectural change by creating a new languagecontainer package. This package is designed to provide a standardized interface and execution environment for language-specific operations within the librariangen tool. The initial implementation focuses on integrating the release-init command, allowing it to parse requests, execute language-specific logic, and write responses in a structured manner. This refactoring aims to improve modularity and prepare the librariangen tool for future expansion with other language-specific commands like generate and build.

Highlights

  • New languagecontainer package: A new languagecontainer package has been introduced to encapsulate language-specific container operations and command execution logic, promoting modularity.
  • release-init command parsing: The languagecontainer.Run function now includes robust logic to parse release-init requests from JSON files, handle command-line flags, and invoke the ReleaseInit function.
  • Main command dispatch refactor: The librariangen main.go has been refactored to delegate non-generate commands to the new languagecontainer.Run function, centralizing command execution and wiring up release.Init for the release-init command.
  • message.Change struct update: The SourceCommitHash field in the message.Change struct has been renamed to CommitHash for improved clarity and consistency.
  • Comprehensive testing: New unit tests have been added for the languagecontainer package, thoroughly covering command execution, flag parsing, and the request/response flow for release-init.
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. ↩

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Oct 21, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.27%. Comparing base (f22935d) to head (e0cf405).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3965      +/-   ##
==========================================
- Coverage   88.37%   80.27%   -8.11%     
==========================================
  Files           6        8       +2     
  Lines         370      441      +71     
==========================================
+ Hits          327      354      +27     
- Misses         30       68      +38     
- Partials       13       19       +6     
Flag Coverage Δ
librariangen 80.27% <ø> (-8.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

suztomo
suztomo commented Oct 21, 2025
View reviewed changes
Comment thread internal/librariangen/languagecontainer/languagecontainer.go
cmd := args[0]
flags := args[1:]
switch cmd {
case "generate":

@suztomo suztomo Oct 21, 2025

Copy link
Copy Markdown
Member Author

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.

I'll move the generate command parsing here. Once Mike's generate command work stop having conflict.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@meltsufin meltsufin Oct 22, 2025

Copy link
Copy Markdown
Contributor

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.

I don't have any outstanding PRs right now. I think it's OK to move it. I can deal with the merge with my WIP.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@suztomo suztomo Oct 22, 2025

Copy link
Copy Markdown
Member Author

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.

I'll change that in a subsequent pull request.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gemini-code-assist[bot]
gemini-code-assist Bot reviewed Oct 21, 2025
View reviewed changes

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

Copy link
Copy Markdown
Contributor

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 introduces a new languagecontainer package to abstract command execution, starting with the release-init command. The refactoring in main.go delegates command handling to this new package, which is a good step towards modularity. My feedback focuses on improving robustness by avoiding panics, adhering to structured logging best practices, enhancing test clarity, and addressing a regression in test coverage in main_test.go.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
suztomo
suztomo commented Oct 21, 2025
View reviewed changes
Comment thread internal/librariangen/languagecontainer/languagecontainer_test.go
"github.com/google/go-cmp/cmp"
)

func TestRun(t *testing.T) {

@suztomo suztomo Oct 21, 2025

Copy link
Copy Markdown
Member Author

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.

This test is from main_test.go

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
suztomo
suztomo commented Oct 21, 2025
View reviewed changes
Comment thread internal/librariangen/main_test.go
"cloud.google.com/java/internal/librariangen/generate"
)

func TestRun(t *testing.T) {

@suztomo suztomo Oct 21, 2025

Copy link
Copy Markdown
Member Author

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.

This goes to languagecontainer_test.go.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@suztomo
suztomo requested a review from meltsufin October 21, 2025 23:29
@suztomo
suztomo force-pushed the release_init_signature branch from 2d0b042 to 28cb6cd Compare October 21, 2025 23:32
@suztomo
chore(librariangen): languagecontainer package to parse release-init …
75337ca
…request

The languagecontainer package parses the request JSON file and calls the
corresponding implementation method.
The user (Java's language container in this case) doesn't have to implement the parsing logic and the tests. I moved the argument parsing tests to languagecontainer/languagecontainer_test.go from main_test.go.
@suztomo
suztomo force-pushed the release_init_signature branch from 28cb6cd to 75337ca Compare October 21, 2025 23:33
@suztomo

suztomo commented Oct 22, 2025

Copy link
Copy Markdown
Member Author

Thank you Gemini Code Assist. I added that to the PR description.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

meltsufin
meltsufin suggested changes Oct 22, 2025
View reviewed changes

@meltsufin meltsufin left a comment

Copy link
Copy Markdown
Contributor

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.

I think ideally this would be two separate PRs, one for introducing languagecontainer, and another for adding release-init command support.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread internal/librariangen/languagecontainer/languagecontainer.go
case "configure":
slog.Warn("librariangen: configure command is not yet implemented")
return 1
case "release-init":

@meltsufin meltsufin Oct 22, 2025

Copy link
Copy Markdown
Contributor

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.

I think this is a lot code to put into a switch statement. Do you think it would make sense to move it to a separate function, like it was done for generate?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@suztomo suztomo Oct 22, 2025

Copy link
Copy Markdown
Member Author

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.

Let me work on that.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@suztomo suztomo Oct 22, 2025

Copy link
Copy Markdown
Member Author

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.

Added handleReleaseInit here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread internal/librariangen/languagecontainer/languagecontainer.go
cmd := args[0]
flags := args[1:]
switch cmd {
case "generate":

@meltsufin meltsufin Oct 22, 2025

Copy link
Copy Markdown
Contributor

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.

I don't have any outstanding PRs right now. I think it's OK to move it. I can deal with the merge with my WIP.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
meltsufin
meltsufin reviewed Oct 22, 2025
View reviewed changes
Comment thread internal/librariangen/languagecontainer/languagecontainer.go
)

// LanguageContainer defines the functions for language-specific container operations.
type LanguageContainer struct {

@meltsufin meltsufin Oct 22, 2025

Copy link
Copy Markdown
Contributor

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.

Why not use an interface here?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@suztomo suztomo Oct 22, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

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.

If this is an interface, then there would be package name conflict of languagecontainer/release package (language agostic) and release package (language-specific. In this case Java-specific). Here is a piece of code when I tried to introduce languagecontainer/release and release packages. The naming conflict happened and I had to rename one of them to release2:

package main

import (

... (omit)...

	"cloud.google.com/java/internal/librariangen/generate"
	release2 "cloud.google.com/java/internal/librariangen/languagecontainer/release"
	"cloud.google.com/java/internal/librariangen/message"
	"cloud.google.com/java/internal/librariangen/release"
)

... (omit)...

// javaContainer implements the LanguageContainer interface for Java.
type javaContainer struct{}

// ReleaseInit implements the LanguageContainer interface for Java.
func (c *javaContainer) ReleaseInit(ctx context.Context, cfg *release2.Config) (*message.ReleaseInitResponse, error) {
	return release.Init(ctx, cfg)
}

I just added this observation in the description of this pull requests.

CC: @codyoss We talked about interface v.s. a struct with functions. I now think the struct is better because we don't have to rename "languagecontainer/release" package when we use (language-specific) "release" package used in main.go.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@suztomo
handleReleaseInit function in languagecontainer
2276157
@suztomo
suztomo requested a review from meltsufin October 22, 2025 18:29
@suztomo

suztomo commented Oct 22, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

I think ideally this would be two separate PRs, one for introducing languagecontainer, and another for adding release-init command support.

I thought about that too, but I think it's more clear if the introduction of languagecontainer has one usage of the package. Subsequent pull requests will be more fine-grained.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

meltsufin
meltsufin suggested changes Oct 22, 2025
View reviewed changes
Comment thread internal/librariangen/languagecontainer/languagecontainer.go Outdated
}

// Run accepts an implementation of the LanguageContainer.
func Run(args []string, container LanguageContainer) int {

@meltsufin meltsufin Oct 22, 2025

Copy link
Copy Markdown
Contributor

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.

Should this be a pointer *LanguageContainer?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@suztomo suztomo Oct 22, 2025

Copy link
Copy Markdown
Member Author

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.

Yes, that's a good catch. Updated to use a pointer.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread internal/librariangen/languagecontainer/languagecontainer.go
cmd := args[0]
flags := args[1:]
switch cmd {
case "generate":

@meltsufin meltsufin Oct 22, 2025

Copy link
Copy Markdown
Contributor

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.

I would imagine you would check if the passed in LanguageContainer struct includes the corresponding functions, and if so invoke them, otherwise log the warning.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@suztomo suztomo Oct 22, 2025

Copy link
Copy Markdown
Member Author

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.

Yes, that's the plan. In this pull requests, LanguageContainer only has ReleaseInit function.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@suztomo suztomo Oct 23, 2025

Copy link
Copy Markdown
Member Author

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.

Added that in #3968.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@suztomo
languagecontainer.Run to take a pointer
e0cf405
@suztomo
suztomo requested a review from meltsufin October 22, 2025 19:46
meltsufin
meltsufin approved these changes Oct 22, 2025
View reviewed changes
@meltsufin
meltsufin self-requested a review October 22, 2025 23:14
meltsufin
meltsufin suggested changes Oct 22, 2025
View reviewed changes

@meltsufin meltsufin left a comment

Copy link
Copy Markdown
Contributor

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.

I approved it, but then I noticed the code coverage dropping by 8.11%. Can you look into this please?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@suztomo

suztomo commented Oct 23, 2025

Copy link
Copy Markdown
Member Author

@meltsufin I checked the coverage (go test -race -coverprofile=coverage.out -covermode=atomic ./... and go tool cover -html=coverage.out). These newly missed lines are from the main.go's run function. languagecontainer.Run will replace this function. This pull request moved the test cases from main_test.go to languagecontainer_test.go.

Screenshot 2025-10-22 at 8 57 36 PM
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

meltsufin
meltsufin approved these changes Oct 23, 2025
View reviewed changes
@suztomo
suztomo merged commit a26a6d9 into main Oct 23, 2025
@suztomo
suztomo deleted the release_init_signature branch October 23, 2025 14:15
@suztomo

suztomo commented Oct 23, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

I temporarily removed "build (11)", "build (17)", and "showcase (25)".

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@suztomo

suztomo commented Oct 23, 2025

Copy link
Copy Markdown
Member Author

I don't have any outstanding PRs right now. I think it's OK to move it. I can deal with the merge with my WIP.

@meltsufin Created #3968.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

meltsufin added a commit that referenced this pull request Oct 24, 2025
@meltsufin
Revert "chore(librariangen): languagecontainer package to parse relea…
e027550
…se-init request (#3965)"

This reverts commit a26a6d9.
lqiu96 pushed a commit that referenced this pull request Feb 12, 2026
@suztomo @lqiu96
chore(librariangen): languagecontainer package to parse release-init …
733f508
…request (#3965)

Introducing languagecontainer package.

* **New languagecontainer package**: A new `languagecontainer` package
has been introduced to encapsulate language-specific container
operations and command execution logic, promoting modularity. This
package parses the request JSON file and calls the
corresponding implementation method in each language container. The
languagecontainer package itself should not have language-specific
implementation.

* **release-init command parsing**: The `languagecontainer.Run` function
now includes robust logic to parse `release-init` requests from JSON
files, handle command-line flags, and invoke the `ReleaseInit` function.
* Why isn't this providing an interface? It's because if
`LanguageContainer` is an interface, then there would be package name
conflict of `languagecontainer/release` package (language agostic) and
`release` package (language-specific. In this case Java-specific). [Here
is a piece of
code](googleapis/librarian#2516 (comment)).
* **Main command dispatch refactor**: The `librariangen` `main.go` has
been refactored to delegate non-`generate` commands to the new
`languagecontainer.Run` function, centralizing command execution and
wiring up `release.Init` for the `release-init` command.
* **message.Change struct update**: The `SourceCommitHash` field in the
`message.Change` struct has been renamed to `CommitHash` for improved
clarity and consistency. This is due to the recent renaming of the field
and
[google-cloud-go/internal/librariangen/request.Change](https://github.com/googleapis/google-cloud-go/blob/7a85df39319e3a4870d4ad413f714ae5edd78ac8/internal/librariangen/request/request.go#L60)
already has the field.

The user (Java's language container in this case) doesn't have to
implement the parsing logic and the tests. I moved the argument parsing
tests to languagecontainer/languagecontainer_test.go from main_test.go.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
@meltsufin meltsufin meltsufin approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size: l Pull request size is large.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@suztomo @meltsufin
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.