Text chat 71: fluxer-core updater: settings, status machine, checks, apply rules, selectors (#433) #457

Manually merged
charles merged 2 commits from textchat-71-core-updater into textchat 2026-11-13 15:32:31 +00:00
Owner

Stacked on: textchat-69-proto-update-manifest

What this builds

fluxer_core::update (update spec §4) and its selectors (§4.7):

  • State: UpdateSettings { channel, automatic } (default None, true) as LocalSettings.update; BuildInfo, InstallCapability { Restart, Manual(ManualReason) } (+ InstallMode alias for the spec's name), ManualReason, DisabledReason { DevBuild, NoPlatform }, UpdateStatus as §4.2, UpdatePhase, OfferedRelease, UpdateError, App.update: UpdateState { status, settings_view, failures_by_version, next_check, confirm_restart, manual_result, … }.
  • Commands/events: Effect::Update(UpdateCommand { Check, Download { release, to: Staging | Downloads }, CancelDownload, Apply { relaunch }, RevealDownload }), CoreEvent::Update(UpdateEvent { Started, Checked, Progress, Downloaded, ApplyFailed, Quitting }), UserAction::Update(UpdateAction).
  • Rules: first check 10 s after Started, then CHECK_INTERVAL 2 h; background failures silent with 15 min backoff doubling to 2 h; manual checks never back off; dev build disabled and schedules nothing; newer = strictly greater version and commit not a prefix match; minimum_version → Manual(BelowMinimumVersion); unknown kind → Manual(UnknownKind); background download only with automatic && Restart; three verification failures stop background downloads of that version; channel change re-checks at once and cancels the other channel's download (late answers of the old channel are dropped); button on Ready during a call/own stream (selectors::voice_status / is_streaming) sets confirm_restart; Quitting returns Apply { relaunch: false } only when Ready and automatic; settings changes are saved with PersistOp::SaveSettings.
  • Selectors: update_button, update_settings, client_info(app, product, os).

Tests

crates/fluxer-core/tests/update.rs: all 29 tests the plan lists (manifests parsed from Task 69's fixtures/update/ with parse_manifest). They failed to compile before the implementation, pass after. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally (base after the stack merge was green too).

Deviations (reviewer please look)

  1. UpdateAction gains RevealDownload ("Show in folder" of the manual download modal); the plan's list has UpdateCommand::RevealDownload but no action to trigger it.
  2. UpdateState has one extra public field, error_open (the error modal of a user-started failure), plus stable_published. ButtonClicked on a user-started Failed opens the modal; clicked again with the modal open it is "Try again". DismissError closes the error and the manual download modals.
  3. LocalSettings.update is a plain UpdateSettings (2 bytes), not boxed: a Box pushed PersistOp over clippy's large_enum_variant limit (the field fits in existing padding). The save is done in App::apply right after persist::reduce, which would otherwise have needed a 9th argument (too_many_arguments).
  4. client_info returns the build line, then os on a second line (ClientInfo.tsx shows them as separate lines); a dev build reads Development <product> (<commit>).
  5. A release with no asset for this platform is UpToDate { latest: None } (logged); the spec's NoAssetForPlatform is not a DisabledReason in the plan.
  6. Outside the crate: apps/fluxer/src/runtime.rs gets a one-line Effect::Update(_) debug arm so the exhaustive match compiles (the runtime is Text chat 74); messages.rs/session.rs exhaustive matches get CoreEvent::Update(_).

Closes #433

🤖 Generated with Claude Code

Stacked on: textchat-69-proto-update-manifest ## What this builds `fluxer_core::update` (update spec §4) and its selectors (§4.7): - **State**: `UpdateSettings { channel, automatic }` (default `None`, `true`) as `LocalSettings.update`; `BuildInfo`, `InstallCapability { Restart, Manual(ManualReason) }` (+ `InstallMode` alias for the spec's name), `ManualReason`, `DisabledReason { DevBuild, NoPlatform }`, `UpdateStatus` as §4.2, `UpdatePhase`, `OfferedRelease`, `UpdateError`, `App.update: UpdateState { status, settings_view, failures_by_version, next_check, confirm_restart, manual_result, … }`. - **Commands/events**: `Effect::Update(UpdateCommand { Check, Download { release, to: Staging | Downloads }, CancelDownload, Apply { relaunch }, RevealDownload })`, `CoreEvent::Update(UpdateEvent { Started, Checked, Progress, Downloaded, ApplyFailed, Quitting })`, `UserAction::Update(UpdateAction)`. - **Rules**: first check 10 s after `Started`, then `CHECK_INTERVAL` 2 h; background failures silent with 15 min backoff doubling to 2 h; manual checks never back off; dev build disabled and schedules nothing; newer = strictly greater version and commit not a prefix match; `minimum_version` → `Manual(BelowMinimumVersion)`; unknown kind → `Manual(UnknownKind)`; background download only with `automatic && Restart`; three verification failures stop background downloads of that version; channel change re-checks at once and cancels the other channel's download (late answers of the old channel are dropped); button on `Ready` during a call/own stream (`selectors::voice_status` / `is_streaming`) sets `confirm_restart`; `Quitting` returns `Apply { relaunch: false }` only when `Ready` and `automatic`; settings changes are saved with `PersistOp::SaveSettings`. - **Selectors**: `update_button`, `update_settings`, `client_info(app, product, os)`. ## Tests `crates/fluxer-core/tests/update.rs`: all 29 tests the plan lists (manifests parsed from Task 69's `fixtures/update/` with `parse_manifest`). They failed to compile before the implementation, pass after. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally (base after the stack merge was green too). ## Deviations (reviewer please look) 1. `UpdateAction` gains `RevealDownload` ("Show in folder" of the manual download modal); the plan's list has `UpdateCommand::RevealDownload` but no action to trigger it. 2. `UpdateState` has one extra public field, `error_open` (the error modal of a user-started failure), plus `stable_published`. `ButtonClicked` on a user-started `Failed` opens the modal; clicked again with the modal open it is "Try again". `DismissError` closes the error and the manual download modals. 3. `LocalSettings.update` is a plain `UpdateSettings` (2 bytes), not boxed: a `Box` pushed `PersistOp` over clippy's `large_enum_variant` limit (the field fits in existing padding). The save is done in `App::apply` right after `persist::reduce`, which would otherwise have needed a 9th argument (`too_many_arguments`). 4. `client_info` returns the build line, then `os` on a second line (`ClientInfo.tsx` shows them as separate lines); a dev build reads `Development <product> (<commit>)`. 5. A release with no asset for this platform is `UpToDate { latest: None }` (logged); the spec's `NoAssetForPlatform` is not a `DisabledReason` in the plan. 6. Outside the crate: `apps/fluxer/src/runtime.rs` gets a one-line `Effect::Update(_)` debug arm so the exhaustive match compiles (the runtime is Text chat 74); `messages.rs`/`session.rs` exhaustive matches get `CoreEvent::Update(_)`. Closes #433 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Shaped like the schema-1 manifest of
docs/superpowers/specs/2026-11-13-fluxer-native-autoupdate-design.md §3.2
(lines 122-200: the example document and its rules); the manifest is
written by our own release workflow (tools/release/manifest.jq, Text chat
70), not by the Fluxer server. Same-origin rule as the fork's
fluxer_desktop/src/common/UpdateFeed.ts:44 (resolveUpdateFeedFileUrl).

Refs #431

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #431

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fluxer_proto::update: ReleaseVersion (YYYY.MMDD.N, Velopack mapping),
Channel, PlatformKey, AssetKind, Asset, Manifest and parse_manifest
applying every rule of auto-update spec §3.2. fluxer-proto gains the
workspace url dependency for the asset URLs.

Refs #431

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #433

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Author
Owner

Independent review: Text chat 71 (core updater), commit 643e3d3

Scope: git diff 37a8c6f..origin/textchat-71-core-updater (13 files, fluxer-core plus a one-line debug arm in apps/fluxer/src/runtime.rs).

Checks

  1. Tests: all 29 tests that the plan names are in crates/fluxer-core/tests/update.rs. They assert what the plan and update §4/§6 say: 10 s first check, CHECK_INTERVAL of 2 h, backoff 15/30/60/120/120/120 min that resets on success, manual check never backs off, prefix-commit match, 404 → UpToDate { latest: None }, BelowMinimumVersion/UnknownKind/ReadOnlyLocation → Manual, a call from the fixture connected through the real gateway and voice events → confirm_restart, quit applies with relaunch: false only when automatic is on, 3 verification failures block that version and a newer one downloads again, the channel switch sends CancelDownload then Check{Stable} and drops the late nightly answer, the tooltips "Update available" / "Updating… 42%" / "Updating…" / "Update failed", and "Nightly Flaxative 2026.1113.412 (5817ae6c0d1e)".
  2. Interfaces: UpdateSettings, BuildInfo, InstallCapability/ManualReason (incl. Unsupported), DisabledReason { DevBuild, NoPlatform }, UpdateStatus (as §4.2), OfferedRelease, UpdateError, UpdateState (all of the plan's public fields), UpdateCommand, DownloadTo, UpdateEvent, DownloadedFile, UpdateAction, Effect::Update, CoreEvent::Update, UserAction::Update and the three selectors with their model structs all exist as written. The deviations only add things (UpdateAction::RevealDownload, UpdateCommand::RevealDownload was already in the plan, error_open, stable_published), except the two in the findings below.
  3. Invariants: no new dependency (Cargo.toml/Cargo.lock unchanged; url and tracing were already used). No iced, wgpu, winit, reqwest or tungstenite, and no I/O. UpdateError's strings are runtime-supplied plain words. The only path-like data are path_display/location_display, which the plan prescribes, and no log line logs them (the wrong-version warning logs versions only; the runtime stub does not log the command). OpenNotes only opens http(s) URLs. No secrets in the fixtures.
  4. Review Focus: no item belongs to Text chat 71.
  5. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci run in the review worktree: green ("all steps passed"; tests/update.rs 29/29).

Findings

  • minor: stable_published is only learned when the user already follows stable (on_checked records it, but the core issues Check { channel: Stable } only for the followed channel). For a nightly user it stays None, so the Stable option can never be disabled with "No stable release yet" before it is picked (update §6.2). Suggestion: one probe Check { Stable } after the first nightly check (the recording in on_checked already happens before the pending-channel filter), or Task 73/74 decide it. Worth a follow-up issue if not fixed here.
  • minor (interface deviation, documented): LocalSettings.update is a plain UpdateSettings, not boxed as the plan says. Field access is unchanged. Task 72 must construct it unboxed. Acceptable given clippy's large_enum_variant.
  • minor (interface deviation, documented): client_info(app, product, os) returns "<line>\n<os>", while the plan's example is a single line. Task 73's client_info::view(line) must handle the two lines, or pass an empty os to get only the first line.
  • minor: a manual "Check for updates" while a release is Available that fails gives Failed { release: None }. DismissError then goes to Idle, so the offered release's button disappears until the next 2 h check (the background path restores before_check, the manual path does not).
  • minor: SetChannel(c) where c is the build's own channel and the setting is None stores Some(c). The user is then pinned instead of following the build's default. This is harmless today (every build is nightly).

Also noted, no action needed: the [update] table is not read or written by fluxer-platform yet (Task 72), so changes reach SaveSettings but are not on disk until 72 lands. The implementer's stash incident does not touch this branch's tree.

Verdict: approved. Zero blocking findings, local ci green.

## Independent review: Text chat 71 (core updater), commit 643e3d3 Scope: `git diff 37a8c6f..origin/textchat-71-core-updater` (13 files, fluxer-core plus a one-line debug arm in `apps/fluxer/src/runtime.rs`). **Checks** 1. Tests: all 29 tests that the plan names are in `crates/fluxer-core/tests/update.rs`. They assert what the plan and update §4/§6 say: 10 s first check, `CHECK_INTERVAL` of 2 h, backoff 15/30/60/120/120/120 min that resets on success, manual check never backs off, prefix-commit match, 404 → `UpToDate { latest: None }`, `BelowMinimumVersion`/`UnknownKind`/`ReadOnlyLocation` → `Manual`, a call from the fixture connected through the real gateway and voice events → `confirm_restart`, quit applies with `relaunch: false` only when `automatic` is on, 3 verification failures block that version and a newer one downloads again, the channel switch sends `CancelDownload` then `Check{Stable}` and drops the late nightly answer, the tooltips "Update available" / "Updating… 42%" / "Updating…" / "Update failed", and "Nightly Flaxative 2026.1113.412 (5817ae6c0d1e)". 2. Interfaces: `UpdateSettings`, `BuildInfo`, `InstallCapability`/`ManualReason` (incl. `Unsupported`), `DisabledReason { DevBuild, NoPlatform }`, `UpdateStatus` (as §4.2), `OfferedRelease`, `UpdateError`, `UpdateState` (all of the plan's public fields), `UpdateCommand`, `DownloadTo`, `UpdateEvent`, `DownloadedFile`, `UpdateAction`, `Effect::Update`, `CoreEvent::Update`, `UserAction::Update` and the three selectors with their model structs all exist as written. The deviations only add things (`UpdateAction::RevealDownload`, `UpdateCommand::RevealDownload` was already in the plan, `error_open`, `stable_published`), except the two in the findings below. 3. Invariants: no new dependency (Cargo.toml/Cargo.lock unchanged; `url` and `tracing` were already used). No iced, wgpu, winit, reqwest or tungstenite, and no I/O. `UpdateError`'s strings are runtime-supplied plain words. The only path-like data are `path_display`/`location_display`, which the plan prescribes, and no log line logs them (the wrong-version warning logs versions only; the runtime stub does not log the command). `OpenNotes` only opens http(s) URLs. No secrets in the fixtures. 4. Review Focus: no item belongs to Text chat 71. 5. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` run in the review worktree: **green** ("all steps passed"; `tests/update.rs` 29/29). **Findings** - **minor**: `stable_published` is only learned when the user already follows stable (`on_checked` records it, but the core issues `Check { channel: Stable }` only for the followed channel). For a nightly user it stays `None`, so the Stable option can never be disabled with "No stable release yet" *before* it is picked (update §6.2). Suggestion: one probe `Check { Stable }` after the first nightly check (the recording in `on_checked` already happens before the pending-channel filter), or Task 73/74 decide it. Worth a follow-up issue if not fixed here. - **minor (interface deviation, documented)**: `LocalSettings.update` is a plain `UpdateSettings`, not boxed as the plan says. Field access is unchanged. Task 72 must construct it unboxed. Acceptable given clippy's `large_enum_variant`. - **minor (interface deviation, documented)**: `client_info(app, product, os)` returns `"<line>\n<os>"`, while the plan's example is a single line. Task 73's `client_info::view(line)` must handle the two lines, or pass an empty `os` to get only the first line. - **minor**: a manual "Check for updates" while a release is `Available` that fails gives `Failed { release: None }`. `DismissError` then goes to `Idle`, so the offered release's button disappears until the next 2 h check (the background path restores `before_check`, the manual path does not). - **minor**: `SetChannel(c)` where `c` is the build's own channel and the setting is `None` stores `Some(c)`. The user is then pinned instead of following the build's default. This is harmless today (every build is nightly). Also noted, no action needed: the `[update]` table is not read or written by `fluxer-platform` yet (Task 72), so changes reach `SaveSettings` but are not on disk until 72 lands. The implementer's stash incident does not touch this branch's tree. **Verdict: approved.** Zero blocking findings, local ci green.
charles manually merged commit 8a6b78d3ba into textchat 2026-11-13 15:32:24 +00:00
Sign in to join this conversation.
No description provided.