Add --channel flag for netclaw update#1395
Conversation
There was a problem hiding this comment.
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
--channeland persisted the selection tonetclaw.json. - Implemented channel parsing/persistence helpers and extended
updatehelp 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.
| 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); | ||
| } |
There was a problem hiding this comment.
seems over zealous, will not fix
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.
|
Thanks for this @codymullins — nice, well-tested addition. The I pushed two small follow-ups directly to the branch (
Tests updated accordingly: split persist-on-switch vs. no-persist-under-check, plus direct coverage of the empty/unknown rejection. One thing I left out of this PR: |
Adds a flag to switch the update channel before checking for updates.