feat(gateway): in-app version check + upgrade dialog (RFC #8170 phase 1)#8173
Draft
NiuBlibing wants to merge 1 commit into
Draft
feat(gateway): in-app version check + upgrade dialog (RFC #8170 phase 1)#8173NiuBlibing wants to merge 1 commit into
NiuBlibing wants to merge 1 commit into
Conversation
…bs#8170 phase 1) Phase 1 (read-only) of the dashboard upgrade affordance: the sidebar version tag becomes a clickable button that opens an Upgrade dialog showing current vs. latest release and release notes. No upgrade execution or restart yet — those are later RFC phases. - update: add `--json` to `zeroclaw update --check`, and surface release notes/url/published_at in UpdateInfo so the gateway can render them (keeps the CLI as the single source of truth). - config: new `gateway.check_updates` (default true) and `gateway.allow_self_upgrade` (default false), both exposed in the dashboard config UI. - gateway: new `version.rs` with `GET /api/version/check` (spawns `zeroclaw update --check --json`, cached 1h) plus read-only restart classification; `/api/status` gains `restart_mode`/`restart_hint` and the two config flags. - web: `checkVersion` API + types, `useVersionCheck` hook, sidebar update dot, and the `UpgradeDialog` Info view. Related zeroclaw-labs#8170
d301a6f to
77a29f9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
masterzeroclaw update --checkgains a--jsonmode andUpdateInfonow carries release notes/url/published_at, so the gateway renders real release info while the CLI stays the single source of truth for update logic.version.rs:GET /api/version/checkspawnszeroclaw update --check --json(cached 1h, never fails the dashboard) and a read-only restart classification (cached for the process lifetime);/api/statusgainsrestart_mode/restart_hint+ the two config flags.gateway.check_updates(default true) andgateway.allow_self_upgrade(default false), both exposed in the dashboard config UI.checkVersionAPI + types,useVersionCheckhook (mount / 6h / visibility refresh), sidebar update dot, and theUpgradeDialogInfo view.allow_self_upgradeis wired into config/status but gates nothing yet (no upgrade endpoint in this PR). OpenAPI registration for the new route is deferred (the spec is hand-curated and has no completeness test).GET /api/statusresponse shape (additive fields), one new GET endpoint, the sidebar footer component, two additive config keys, and a new--jsonflag onzeroclaw update --check. The version check shells out to the running binary's ownupdate --check.type: feature,scope: gateway,scope: web.Validation Evidence (required)
Ran in a git worktree off
master.```
$ cargo fmt --all -- --check
(no output, exit 0)
$ cargo clippy --all-targets -- -D warnings # full workspace
Finished `dev` profile [unoptimized + debuginfo] target(s) in 9m 18s
exit 0, no warnings (recompiled clean after the restart-info caching change too)
$ cargo test -p zeroclaw-gateway --lib # after forced rebuild
test version::tests::cli_check_json_roundtrips ... ok
test version::tests::detect_restart_returns_a_nonempty_hint ... ok
test version::tests::restart_mode_as_str_is_stable ... ok
test result: ok. 277 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
$ cargo test -p zeroclaw-config --lib checklist_gateway_serde_roundtrip
test schema::tests::checklist_gateway_serde_roundtrip ... ok
test result: ok. 1 passed; 0 failed
$ npm run build # web/ (tsc -b && vite build)
✓ built in 2.32s
exit 0; only the pre-existing >500 kB chunk-size advisory
```
cargo clippy --all-targetscompiled the whole workspace including the mainzeroclawlabsbinary (theupdate.rs/main.rschanges), so those are type-/lint-checked.version.rsunit tests (restart classification + CLI-JSON parse) and the gateway-config serde roundtrip with the two new keys, all passing. I did not run a live gateway end-to-end against the real GitHub API, and did not exercise the dashboard in a browser.cargo test -p zeroclaw-gateway -p zeroclaw-configinstead of a full-workspacecargo test— a full run is prohibitively long locally; the touched Rust lives in these two crates plus the main binary (covered byclippy --all-targets). CI runs the full battery.Security & Privacy Impact (required)
GET /api/version/checkspawnszeroclaw update --check, which reaches the GitHub releases API. This call already existed in the CLI; this PR makes it reachable from the authenticated dashboard. Mitigations: behindrequire_auth, gated bygateway.check_updates(read-only), and cached 1h to stay under GitHub's unauthenticated rate limit.Compatibility (required)
gateway.check_updates(default true),gateway.allow_self_upgrade(default false), and a new--jsonflag onzeroclaw update --check. Older configs deserialize unchanged (serde defaults); no migration needed.Rollback (required for
risk: mediumandrisk: high)Low risk:
git revert <sha>.allow_self_upgradedefaults off and gates nothing yet;check_updatesis read-only.