Skip to content

Add --channel flag for netclaw update#1395

Merged
Aaronontheweb merged 4 commits into
netclaw-dev:devfrom
codymullins:dev
Jun 11, 2026
Merged

Add --channel flag for netclaw update#1395
Aaronontheweb merged 4 commits into
netclaw-dev:devfrom
codymullins:dev

Conversation

@codymullins

Copy link
Copy Markdown
Contributor

Adds a flag to switch the update channel before checking for updates.

Copilot AI review requested due to automatic review settings June 11, 2026 15:12
@codymullins codymullins changed the title Add --channel flag for Netclaw is up to date (v0.24.0-beta.3). Add --channel flag for netclaw update Jun 11, 2026

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a --channel option to netclaw update to switch/persist the update channel (stable/beta, with dev as a beta alias), and updates docs/tests accordingly.

Changes:

  • Added CLI parsing for --channel and persisted the selection to netclaw.json.
  • Implemented channel parsing/persistence helpers and extended update help text.
  • Added unit tests for persistence and rejection of unknown channels; updated skill documentation/version.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/Netclaw.Cli/Update/UpdateCommand.cs Adds --channel argument handling, persists the channel to config, and updates help text.
src/Netclaw.Cli.Tests/Cli/UpdateCommandTests.cs Adds tests covering channel persistence (including dev alias) and invalid channel handling.
feeds/skills/.system/files/netclaw-operations/SKILL.md Bumps skill version and documents the new --channel usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +87 to +106
UpdateCommand.TestHttpMessageHandlerFactory = () => CreateSignedHandler(manifest);

using var stdout = new StringWriter();
var originalOut = Console.Out;
Console.SetOut(stdout);

try
{
// --check short-circuits before install, so this exercises only parsing + persistence.
var exitCode = await UpdateCommand.RunAsync(
["update", "--check", "--channel", arg], _paths);

Assert.Equal(0, exitCode);
Assert.Equal(expectedWire, ReadPersistedChannel());
Assert.Contains($"Update channel set to '{expectedWire}'", stdout.ToString());
}
finally
{
Console.SetOut(originalOut);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

seems over zealous, will not fix

Comment thread src/Netclaw.Cli/Update/UpdateCommand.cs Outdated
Comment thread src/Netclaw.Cli/Update/UpdateCommand.cs Outdated
Comment thread src/Netclaw.Cli/Update/UpdateCommand.cs
@Aaronontheweb Aaronontheweb added the tui Terminal UI (Termina) issues label Jun 11, 2026
Persisting the channel via enum.ToString().ToLowerInvariant() coupled the
on-disk config schema to the enum member names, so a future rename would
silently change the persisted values. Add UpdateChannelExtensions.ToWireValue()
with an explicit Stable->"stable"/Beta->"beta" mapping (inverse of
ParseUpdateChannel) and route the three call sites through it. A round-trip
test pins the wire strings.
Channels are now strictly stable and beta. Remove the dev->beta alias from
the --channel parser, its error/help text and doc comments, and the
corresponding test case.
- --check + --channel now previews the channel for the run without
  persisting to netclaw.json; persistence only happens on a real switch
  (non-check). Read-only verbs must not mutate config.
- Replace UpdateCommand.TryParseChannelArg with a shared
  DaemonConfig.TryParseUpdateChannel so the valid channel set lives in
  one place (alongside ParseUpdateChannel / ToWireValue) instead of a
  third hand-maintained copy. The Try variant rejects null/empty so
  '--channel ""' still fails loudly.
- Update tests: split persist-on-switch vs no-persist-under-check, and
  cover TryParseUpdateChannel's empty/unknown rejection.
@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Thanks for this @codymullins — nice, well-tested addition. The ToWireValue() extension (pinned independently of the enum names, with a round-trip test) is exactly the right call, and switching WizardConfigBuilder over to it is a good latent-correctness fix.

I pushed two small follow-ups directly to the branch (64dcb59c) rather than round-tripping review comments:

  1. --check is now read-only. Previously netclaw update --check --channel beta persisted the channel to netclaw.json as a side effect — so a "check" silently and permanently switched channels, with no way to preview beta without committing. Now --channel only persists on a real switch (non---check); under --check it evaluates against the requested channel for that run and prints Checking 'beta' channel (run without --check to switch) without writing config.

  2. Reuse the channel parser. Replaced UpdateCommand.TryParseChannelArg with a shared DaemonConfig.TryParseUpdateChannel, so the valid-channel set lives in one place next to ParseUpdateChannel/ToWireValue instead of a third hand-maintained copy that could drift when a channel is added. The Try variant rejects null/empty so --channel "" still fails loudly (the config-binding ParseUpdateChannel keeps its null/empty → Stable default).

Tests updated accordingly: split persist-on-switch vs. no-persist-under-check, plus direct coverage of the empty/unknown rejection. slopwatch clean, headers verified.

One thing I left out of this PR: WriteHelp() writes usage to stdout even on usage errors, while the error text itself is split across stdout/stderr inconsistently. That's pre-existing and likely spans multiple command handlers, so I filed it separately as #1396 rather than scope-creep this branch.

@Aaronontheweb Aaronontheweb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) June 11, 2026 17:46
@Aaronontheweb Aaronontheweb merged commit 27c3430 into netclaw-dev:dev Jun 11, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tui Terminal UI (Termina) issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants