Skip to content

fix!: Pass UpdateHostedRunnerRequest to UpdateHostedRunner#3973

Open
alexandear wants to merge 2 commits intogoogle:masterfrom
alexandear-org:fix/update-hosted-runner
Open

fix!: Pass UpdateHostedRunnerRequest to UpdateHostedRunner#3973
alexandear wants to merge 2 commits intogoogle:masterfrom
alexandear-org:fix/update-hosted-runner

Conversation

@alexandear
Copy link
Contributor

BREAKING CHANGE: ActionsService.UpdateHostedRunner and EnterpriseService.UpdateHostedRunner now accept UpdateHostedRunnerRequest.

While working on #3972, I found that ActionsService.UpdateHostedRunner accepts HostedRunnerRequest as a body. But it's wrong according to the docs for actions and enterprise.

Current:

type HostedRunnerRequest struct {
	Name           string            `json:"name,omitempty"`
	Image          HostedRunnerImage `json:"image,omitempty"`
	RunnerGroupID  int64             `json:"runner_group_id,omitempty"`
	Size           string            `json:"size,omitempty"`
	MaximumRunners int64             `json:"maximum_runners,omitempty"`
	EnableStaticIP bool              `json:"enable_static_ip,omitempty"`
	ImageVersion   string            `json:"image_version,omitempty"`
}

Should be image_id (optional) instead of the Image. So, I created a separate struct UpdateHostedRunnerRequest with an optional image_id and the rest of the fields (all optional).

@codecov
Copy link

codecov bot commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.53%. Comparing base (3260322) to head (2a1215b).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3973   +/-   ##
=======================================
  Coverage   93.52%   93.53%           
=======================================
  Files         207      207           
  Lines       17600    17590   -10     
=======================================
- Hits        16461    16453    -8     
+ Misses        938      937    -1     
+ Partials      201      200    -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
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

So HostedRunnerRequest has both image_version and image.version? That seems odd.

In other parts of this repo, we reuse structs and add comments for fields that are used by one endpoint and not another... so are you thinking that splitting this struct into two separate use cases is going to reduce end-user confusion, and therefore is a desirable change?

@alexandear
Copy link
Contributor Author

We can't reuse structs in this case. They are different. And yes, splitting this struct into two separate use cases:

  1. fixes Update methods.
  2. reduces end-user confusion (optional-required fields).

Here are comparison with Copilot:

Field Create Update Required in Create Required in Update
name Required Optional
image (object with id and source) - Required -
size Required Optional
runner_group_id Required Optional
maximum_runners Optional Optional
enable_static_ip Optional Optional
image_gen - Optional (default: false) -
image_id - - Optional
image_version - - Optional (can be null)
Raw doc screenshots

Create body:

image image

Update body:

image

@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Feb 5, 2026
@@ -101,6 +100,17 @@ type HostedRunnerRequest struct {
ImageVersion string `json:"image_version,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

So can image_version now be removed from HostedRunnerRequest?

Copy link
Collaborator

Choose a reason for hiding this comment

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

And since this is a breaking change, how about completely cleaning up HostRunnerRequest by removing omitempty from all the required fields and adding pointers to the optional fields... also to be more consistent with the rest of the repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants