Skip to content

feat: support channel in CLI cut command - #22

Open
upils wants to merge 13 commits into
mainfrom
track-in-cli
Open

feat: support channel in CLI cut command#22
upils wants to merge 13 commits into
mainfrom
track-in-cli

Conversation

@upils

@upils upils commented Jul 27, 2026

Copy link
Copy Markdown
Owner
  • Have you signed the CLA?

Allow selecting a channel when cutting slices from store packages (bins), via a pkg_slice@channel suffix on the command line.

Unlike debs, bins are published per channel, so users need to pick which one to fetch; a bare @3.0 is treated as a track and gets the default risk (stable), while @3.0/edge is used as given. When no suffix is provided, the channel is derived from the package's default-track in the slice definition, which stays a track — the risk remains implicit on the YAML side. The channel is kept strictly separate from slice identity: it flows only from the reference through setup.Select into Selection.Channels for the slicer to consume at fetch time, leaving dependency resolution, conflict checks and the manifest untouched. Conflicting channels for slices of the same package and channels on non-store packages are rejected, info/find commands reject the @ suffix since it is only meaningful when cutting, and channel validation is intentionally loose so longer forms such as track/risk/branch are not rejected today.

NOTE: This PR only prepares a Channels map in the Selection. Subsequent work to fetch bins from the store will consume it to get the right revision.

@letFunny letFunny left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It also looks very good. I have to admit channel + risk + track are not the simplest concepts to keep in mind but I think it has been a good job mapping those into Chisel.

Comment thread cmd/chisel/cmd_cut.go Outdated
Slices are named <package>_<slice>. For packages coming from a store, a
channel may be appended to select which one to fetch, as in
mybin_myslice@2.0/edge. A channel with no risk, such as @2.0, uses the
stable risk.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should you mention if not the default track in the package yaml is used?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

This is already in the last sentence of the next paragraph. Is it too disjointed?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The first time I read it I thought it referred to multiple slices of the same package. This is up to personal opinion but I would move it to before you talk about multiple slices.

@upils upils Jul 31, 2026

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I reworked it a bit, also trying to clarify how the channel is composed.

Comment thread cmd/chisel/cmd_find.go Outdated
Comment thread internal/setup/setup.go Outdated
Comment thread internal/setup/setup.go Outdated
Comment thread internal/setup/setup.go Outdated
Comment on lines +604 to +605
// Only report the channels of the selected packages.
selection.Channels = make(map[string]string)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this necessary, it seems that channels is already built from the references of the selection and nothing more.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

No, it also contains entries for all store packages (see the loop discussed above) because this is done before the call to order that will need the channels map in the follow-up PR (to pick essentials or not). I don't want to merge something in this PR that will be immediately reworked in the next one, hence the loop above.

Comment thread internal/setup/setup.go Outdated
@upils
upils requested a review from letFunny July 30, 2026 13:55

@letFunny letFunny left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just one more comment

Comment thread internal/setup/channel.go Outdated
}

func (c Channel) String() string {
if c.Track == "" {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How can this be empty? I suspect it is the upper layer that has the channel unset, right? If that is the case another approach is to use nil vs channel, I don't know which one is more readable.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

The function was misrepresenting a Channel. This is now fixed, also making it obvious when the Channel object is "wrong".

Comment thread internal/setup/setup.go Outdated
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