Skip to content

Conversation

@doringeman
Copy link
Contributor

@doringeman doringeman commented Oct 6, 2025

  • Added a go.work for model-runner and model-runner/cmd/cli. Ref: https://go.dev/doc/tutorial/workspaces.
  • Fixed the validate-tests target.
  • Added a new step in the CI workflow to check that go mod tidy and go work sync are run.

This PR should help with the errors in #194 and also ease the importing (using of) github.com/docker/model-runner in github.com/docker/model-runner/cmd/cli (model-cli).


Summary by Sourcery

Add go.work workspace and switch CLI to use local module while upgrading dependencies and test tooling

Enhancements:

  • Refactor CLI imports to use local model-runner/pkg/distribution paths instead of external model-distribution module
  • Upgrade a variety of dependencies in the root and CLI modules including containerd, ghw, Prometheus, OpenTelemetry, go-ole, gogo/protobuf, and more
  • Modify the CLI Dockerfile to run unit tests within the cmd/cli directory
  • Adjust docker-bake configuration to specify the Dockerfile for the validate-tests target

Chores:

  • Add go.work and go.work.sum to manage the repository as a Go workspace
  • Add replace directive for the local model-runner module in cmd/cli/go.mod and remove the legacy model-distribution requirement

Summary by Sourcery

Add Go workspace support, refactor CLI to use local module, bump dependencies, and enforce module hygiene in CI

Enhancements:

  • Update various dependencies in root and CLI modules to latest patch versions
  • Refactor CLI commands to import distribution packages from local model-runner module

Build:

  • Modify CLI Dockerfile to run unit tests within the cmd/cli directory

CI:

  • Add CI step to run go mod tidy, go work sync, and verify no mod file diffs

Chores:

  • Add go.work and go.work.sum for Go workspace setup and add local replace directive in cmd/cli/go.mod
  • Fix validate-tests target by specifying the correct Dockerfile in docker-bake.hcl

Copilot AI review requested due to automatic review settings October 6, 2025 15:29
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 6, 2025

Reviewer's Guide

Introduces a Go workspace for multi-module management, upgrades core dependencies, refactors the CLI to use the local model-runner module, and strengthens CI/build configurations to enforce module hygiene and correct test execution.

Class diagram for CLI import refactor

classDiagram
  class "cmd/cli/commands/package.go" {
    +builder (from model-runner/pkg/distribution)
    +registry (from model-runner/pkg/distribution)
    +tarball (from model-runner/pkg/distribution)
    +types (from model-runner/pkg/distribution)
  }
  class "cmd/cli/desktop/desktop.go" {
    +distribution (from model-runner/pkg/distribution/distribution)
    +inference (from model-runner/pkg/inference)
    +models (from model-runner/pkg/inference/models)
    +scheduling (from model-runner/pkg/inference/scheduling)
  }
  "cmd/cli/commands/package.go" --|> "model-runner/pkg/distribution"
  "cmd/cli/desktop/desktop.go" --|> "model-runner/pkg/distribution/distribution"
  "cmd/cli/desktop/desktop.go" --|> "model-runner/pkg/inference"
  "cmd/cli/desktop/desktop.go" --|> "model-runner/pkg/inference/models"
  "cmd/cli/desktop/desktop.go" --|> "model-runner/pkg/inference/scheduling"
Loading

File-Level Changes

Change Details Files
Establish Go workspace and enforce module hygiene
  • Add go.work and go.work.sum to root
  • Introduce CI step for go mod tidy and go work sync with exit-code diff check
go.work
go.work.sum
.github/workflows/ci.yml
Upgrade root module dependencies
  • Bump versions of key dependencies (containerd, ghw, Prometheus, OpenTelemetry, etc.)
  • Update indirect dependencies and replace directive for go-winjob
go.mod
go.sum
Refactor CLI to use local model-runner module
  • Replace external model-distribution imports with model-runner/pkg/distribution
  • Add replace directive in cmd/cli/go.mod pointing model-runner to local path
  • Remove legacy model-distribution requirement and adjust module version
cmd/cli/commands/package.go
cmd/cli/desktop/desktop.go
cmd/cli/go.mod
Adjust CLI build and test configuration
  • Modify Dockerfile to run unit-tests in cmd/cli
  • Update docker-bake validate-tests to reference correct Dockerfile
cmd/cli/Dockerfile
cmd/cli/docker-bake.hcl

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds Go workspace configuration to support multi-module development by introducing go.work and go.work.sum files. It restructures the project to use local module dependencies instead of external ones and updates build configuration.

Key changes:

  • Introduces Go workspace with go.work file containing root module and cmd/cli module
  • Removes external dependency on github.com/docker/model-distribution and replaces with local package paths
  • Updates build configuration to use workspace-relative paths

Reviewed Changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
go.work New Go workspace file defining workspace modules
go.work.sum Generated workspace checksums for dependencies
go.mod Updated dependency versions and removed unused dependencies
cmd/cli/go.mod Removed external model-distribution dependency, added local replace directive
cmd/cli/docker-bake.hcl Fixed Dockerfile path in build configuration
cmd/cli/desktop/desktop.go Updated import path from external to local package
cmd/cli/commands/package.go Updated import paths from external to local packages
cmd/cli/Dockerfile Fixed make command to run in correct directory

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Signed-off-by: Dorin Geman <[email protected]>
Signed-off-by: Dorin Geman <[email protected]>
Copilot AI review requested due to automatic review settings October 6, 2025 15:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@doringeman doringeman requested review from a team and ilopezluna October 6, 2025 15:43
@doringeman doringeman marked this pull request as ready for review October 6, 2025 15:43
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ericcurtin ericcurtin merged commit 10f1b1e into docker:main Oct 7, 2025
6 checks passed
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.

3 participants