Skip to content

Conversation

@corhere
Copy link
Contributor

@corhere corhere commented Oct 9, 2025

- What I did
- How I did it
The aforementioned packages are out of scope for the api module. They provide facilities to write streams of event messages to a sink, but those sinks are either a network socket or a terminal. There is no Engine API endpoint which consumes streams of events from a client, and rendering events to a terminal is out of scope of the api. Move the packages under daemon/internal and remove dead code.

Move the definition of the outer JSON event message to api/types and export it, dropping the deprecated ErrorMessage field. Arrange for the daemon to continue to emit that field for compatibility with docker-py v7.1.0.

Some of the code in these packages is used by github.com/docker/cli. The removals from the api module may be resolved simply by copying the code into that repository, where it belongs.

What to do with the "github.com/moby/moby/client/pkg/jsonmessage".JSONMessage struct remains to be sorted out. Its Progress field is a custom type that knows how to render a progress bar to a terminal; it will not be trivial to refactor it to reference the api jsonstream.Message type.

- How to verify it

- Human readable description for the release notes

- Go-SDK: `api/pkg/progress` and `api/pkg/streamformatter` have been removed.

- A picture of a cute animal (not mandatory but encouraged)

@corhere corhere added this to the 29.0.0 milestone Oct 9, 2025
@corhere corhere added area/api API impact/changelog kind/refactor PR's that refactor, or clean-up code impact/go-sdk Noteworthy (compatibility changes) in the Go SDK labels Oct 9, 2025
@corhere corhere force-pushed the excise-json-streams-from-api branch 2 times, most recently from c268cfc to eab4869 Compare October 9, 2025 23:27
@corhere corhere force-pushed the excise-json-streams-from-api branch from eab4869 to 4f46ba6 Compare October 10, 2025 00:07
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

Looks like we may have some work to do before we can move this internal

Comment on lines +75 to +79
// NewJSONProgressOutput returns a progress.Output that formats output
// using JSON objects
func NewJSONProgressOutput(out io.Writer, newLines bool) progress.Output {
return &progressOutput{sf: &jsonProgressFormatter{}, out: out, newLines: newLines}
}
Copy link
Member

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I had noticed. I don't see what the holdup is in this repo, though. Just make an internal copy of the progress code in those repos when you bump the api dependency, and optionally refactor later to get rid of the silly in-process JSON round trips. You've got to do that for the raw progress formatter regardless.

@austinvazquez
Copy link
Contributor

I opened docker/cli#6570 for Docker CLI to make internal copies of streamformatter and progress packages.

@morphius1

This comment was marked as off-topic.

@austinvazquez
Copy link
Contributor

I opened docker/compose#13304 for Docker compose to have copies there as well.

@ndeloof
Copy link
Contributor

ndeloof commented Oct 21, 2025

👎 Having 3 copies of this piece of code (internal + docker/cli + docker/compose) doesn't make the code cleaner

@github-actions github-actions bot added containerd-integration Issues and PRs related to containerd integration area/dependencies module/client labels Oct 23, 2025
@austinvazquez
Copy link
Contributor

Okay after discussion with the moby maintainers and feedback from common client PRs (docker/cli#6570 and docker/compose#13304).

This change now moves the streamformatter and progress packages up into the client alongside with the internal daemon copy. This is a compromise to have a common shared location outside the API module but the long term location may change.

Just for some background for folks, the first release of the client module will be v0.1.0. So this is not a long term commitment for the shape and size of these packages. Ideally long term probably something in CLI or a shared Go SDK.

Move the streamformatter package up into the client for a temporary
shared location between common clients like CLI and compose.

The streamformatter package is used by the daemon to write streams of
status and progress messages to API clients. It is completely out of
scope of the api module and not used outside the daemon. Remove the
unused rawSteamFormatter, whose purpose is to render the progress as a
TUI.

Co-authored-by: Cory Snider <[email protected]>
Signed-off-by: Austin Vazquez <[email protected]>
Move the progress package up into the client as a temporary shared location for
common clients like CLI and compose.

The progress package is used by the daemon to write progress updates to
some sink, typically a streamformatter. This package is of little use to
API clients as this package does not provide any facilities to consume
the progress updates.

Co-authored-by: Cory Snider <[email protected]>
Signed-off-by: Austin Vazquez <[email protected]>
The schema of a JSON-stream message is very pertinent to the api module.
Provide a canonical definition in the api module and refactor the daemon
code to use it. Drop the long-deprecated ErrorMessage field from the API
definition, but have the daemon continue to emit it for compatibility
with docker-py v7.1.0.

Co-authored-by: Cory Snider <[email protected]>
Signed-off-by: Austin Vazquez <[email protected]>
@austinvazquez austinvazquez force-pushed the excise-json-streams-from-api branch from 04f0c73 to 687c3d7 Compare October 24, 2025 12:58
@austinvazquez
Copy link
Contributor

Rebased. PTAL.

@austinvazquez
Copy link
Contributor

@thaJeztah , if you could give this another review; I have addressed the concern and no longer have the packages as internal based on feedback from consumers like compose. Probably we can continue this discussion further to determine the shape and location of the packages long term.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah merged commit 9e7e01e into moby:master Oct 28, 2025
254 of 255 checks passed
@vvoland vvoland added impact/api impact/go-sdk Noteworthy (compatibility changes) in the Go SDK and removed impact/go-sdk Noteworthy (compatibility changes) in the Go SDK impact/api labels Oct 29, 2025
@vvoland vvoland moved this from New to Complete in 🔦 Maintainer spotlight Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API area/builder/buildkit Build area/builder/classic-builder Build area/daemon Core Engine area/dependencies area/images Image Distribution containerd-integration Issues and PRs related to containerd integration impact/changelog impact/go-sdk Noteworthy (compatibility changes) in the Go SDK kind/refactor PR's that refactor, or clean-up code module/api module/client release-blocker PRs we want to block a release on

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants