Text chat 74: apps/fluxer and devserver: updater runtime, Velopack startup hook, fake feed, parity (#436) #481
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "textchat-74-app-updater-runtime"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacked on: textchat-69-proto-update-manifest, textchat-70-release-update-feed, textchat-71-core-updater, textchat-72-platform-updater (69–71 were already on
textchat; 72 is merged into this branch).What it builds
Devserver (first commit):
fluxer-devserver/src/updates.rs, the fake update feed.GET /_update/feed/{channel}.json: a schema-1 manifest generated at run time with the real size and SHA-256 of a small fake asset (crates/fluxer-devserver/fixtures/updates/fake-update.sh, built in withinclude_bytes!, never run).stable.jsonis always 404.GET /_update/assets/{name}:Accept-Ranges: bytes,ETag,206+Content-Range,If-Range, and416withbytes */<size>.--update-scenario newer|same|bad-sha|malformed|none(defaultnewer:2026.0101.2against the faked2026.0101.1).DevServer::update_feed()exposesset_scenario,feed_base, andrequests(), which records whether each request carriedAuthorizationorCookie.App (second commit):
apps/fluxer/src/update_rt.rsand its wiring inruntime.rs.Start: sends
UpdateEvent::Started. The build comes fromdebug_info::RELEASE+GIT_SHA+PlatformKey::current();--devserverfakes2026.0101.1nightly. The capability comes fromdetect_installwithVelopackInstallProbe. Old AppImage staging folders are swept once.Check:
UpdateHttp::fetch_manifestagainst theFeedBase: the devserver's feed, elseFLUXER_UPDATE_FEED_BASE(logged once, host and port only), elseFEED_BASE. A 404 becomesOk(None).Download: runs on a task through the
Installertrait, chosen bychoose_installer(target, capability, devserver):AppImageInstaller:Downloaderinto the staging dir, thenappimage::apply+relaunch.VelopackInstaller(#[cfg(windows)]):VelopackUpdater::downloadon a blocking task, thenapply_on_exit.ManualInstaller:Downloaderinto Downloads; also handlesRevealDownload.DryRunInstaller: a real download into a scratch dir that is removed afterwards; installs nothing.DownloadTo::Downloadsalways goes to the manual installer. Progress reaches the store at most 4 times a second. A generation counter drops the progress and the result of a cancelled or superseded download.Apply:
Installer::prepareruns while the client is still up; a failure comes back asUpdateEvent::ApplyFailed. Then the run loop ends, the shutdown runs as for a closed window (gateway closed, persistence flushed), andInstaller::apply(relaunch, args)runs.Handle::stopped_for_update()letsmainexit with success.Install on quit: when the loop ends for any other reason (window closed, Ctrl-C, senders gone), the executor first dispatches
UpdateEvent::Quittingand carries out the resultingApply { relaunch: false }.main.rs:fluxer_platform::update::velopack::startup_hook()is the very first call (a no-op off Windows).--debug-info: a new Updates section with four lines:update channel,update feed,install: AppImage <path> | Velopack <root> | Unsupported,update capability.Config:
FLUXER_UPDATE_FEED_BASE(validated like--instance) and--update-scenario.Test hooks:
Runtime::with_update_buildandRuntime::with_installer.Parity:
advanced-automatic-updatesisdone, with the note from update §9. New rownative-update-channel. The tray "Check for updates" note is indocs/parity/README.mdunder "Desktop shell"; there was no shell list to put it in.Tests
crates/fluxer-devserver/tests/updates.rs(5 tests) and a unit test for range parsing.apps/fluxer/tests/update_runtime.rs(16 tests): every test the plan names, plus the Windows-onlyvelopack_startup_hook_runs_first_and_returns_for_a_normal_start(see below).NullHost, so no WebRTC runtime starts.CheckNow, orCoreEvent::Timer(app.update.next_check), instead of waiting 10 s for the first background check._update/or the asset name, and the override line appears exactly once per runtime.update_rt(feed base resolution, build info, progress throttle, error mapping) and inconfig.FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciis green locally on Linux. One earlier run hit the known exit-time abort of thefluxerlib tests (#338, "futex facility returned an unexpected error code"); all 78 tests had passed, and the rerun was green.FLUXER_DESKTOP_TESTSand I did not run the GUI by hand.Deviations from the plan / for the reviewer
Readyat startup. The plan sendsUpdateEvent::Downloaded(Ok(..))at start for a pending package. The core (Text chat 71) drops aDownloadedunless it isDownloading, andDownloadedFilecarries no release to build anOfferedReleasefrom, so that event would do nothing. Instead, every stagingDownloadfirst asksInstaller::pending(). A package of the same version finishes at once, so after the first check the update isReadywithout downloading again.pending_velopack_package_starts_as_readytests that path. ShowingReadybefore any check needs a core change.Readyfrom the runtime. The core has no event that leads fromApplyingback toReady. With--devserver, the executor setsapp.update.statusback toReadydirectly, documented at the call site. This is the only place the runtime writes the store outsideapply.native-update-channelhas owner 7, not 6. Thesettings_navskeleton test requires a setting outside a section to take its tab's owner (advanced_settings→ 7). Same pattern as the existing owner-4 rows; the row's note says so.VelopackInstalleror the Windows test on this machine. Please watch the Windows runner.velopack_startup_hook_runs_first_and_returns_for_a_normal_startspawnsflaxative.exe --debug-info. That binary importsopengl32.dllthrough the renderer (#93), so the test skips itself with a message whereSystem32\opengl32.dllis missing, which is the case on the runner.crates/fluxer-devserver/Cargo.tomlgainssha2, which is already a workspace dependency, so thecargo denygraph is unchanged.apps/fluxer/src/debug_info.rsgets the Updates section.fixtures/update/nightly_v1.json(Text chat 69). The feed is our own release file, not a Fluxer server endpoint.Manual checks for Charles
~/Applicationsupdates itself after the next CI build: the button appears, a click restarts into the new version, and the settings show it.cargo run -p fluxer-devserver -- --update-scenario newerand pointFLUXER_UPDATE_FEED_BASE=<instance>/_update/feedat it.cargo run -p fluxer -- --devserver [--update-scenario bad-sha]runs the whole flow locally. Run "Check for updates" in the settings to skip the 10 s wait.Closes #436
🤖 Generated with Claude Code
GET /_update/feed/{channel}.json serves a schema-1 manifest generated at run time with the fake asset's real size and SHA-256 (shaped like update §3.2 and the fixtures of Text chat 69, fixtures/update/nightly_v1.json; there is no Fluxer server source for this feed: it is our own Forgejo release file). GET /_update/assets/{name} serves the asset with Accept-Ranges, ETag, 206 + Content-Range, If-Range and 416. --update-scenario newer|same|bad-sha|malformed|none; stable is 404. Refs #436 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>Independent review: Text chat 74 (app updater runtime)
Scope:
git diff da4dee8..fa17e5c(commits100189candfa17e5c).Local gate:
FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciin a fresh review worktree: green ("all steps passed"). The Windows-only code (VelopackInstaller, the startup-hook test) was not compiled here. I checked it by hand againstfluxer_platform::update::velopackand velopack 1.2.161:open,download,pending,PendingUpdate::versionandapply_on_exitmatch, andUpdateManagerisArc-backed withUpdateSource: Send + Sync. Watch the Windows runner anyway.Checks
2026.0101.2against2026.0101.1, stable is 404, the 416 response carriesContent-Range: bytes */<size>,If-Rangewith another validator gets a 200, and manifests carry the asset's real SHA-256. Exceptions are listed below (minor 1 and minor 3).--update-scenario newer|same|bad-sha|malformed|noneare present. So areUpdateRuntime, theInstallertrait, theAppImage/Velopack/Manual/DryRuninstallers, progress throttled to 4 Hz,CancelDownloadwith a generation guard,StartedwithBuildInfofromRELEASE/GIT_SHA/PlatformKey::current(), andsweep_leftoversonce. The feed base resolves in the order devserver, thenFLUXER_UPDATE_FEED_BASE(logged once, host and port only), thenFEED_BASE, and it is also the Velopack base.Applyrunspreparefirst, then the clean shutdown, then the install after persistence has flushed. Closing the window or pressing Ctrl-C sendsQuittingfirst.startup_hook()is the first call inmain, and there is no--apply-updateflag.--debug-infohas an Updates section.fluxer-core,fluxer-uiorfluxer-emoji. The only new dependency issha2in the devserver (already a workspace dependency). Feed requests carry no auth or cookie header (tested). Nothing logged contains a URL path or query, or an asset name (tested).--recordcovers only gateway and REST, so update paths never reach it.FeedError,DownloadErrorandUpdateErrorcarry no URL. Bad server data (a malformed feed) stays silent.Findings
pending_velopack_package_starts_as_readydoes not test what the plan says. The plan has the runtime sendDownloaded(Ok)at start, so a pending Velopack package shows as Ready straight away. The runtime instead consultsInstaller::pending()only when aDownloadcomes in. The test runs CheckNow and then checks that no download happened. Effect on Windows when install on quit is off: the pending package shows as Ready only after the first check (about 10 s), and only through Available plus a click when "automatic" is off. Nothing is lost. Suggest afollow-upissue for a core event that accepts an already-downloaded package outsideDownloading.runtime.rs::apply_updatewritesapp.update.status = Ready { install: Restart }directly throughArc::make_mut, so the change bypasses the reducer. It is devserver-only and harmless today, but it is the only place where the runtime mutates core state. Suggest afollow-upfor anUpdateEventthat means "installed nothing".velopack_startup_hook_runs_first_and_returns_for_a_normal_startalways skips itself because there is noopengl32.dll(#93). So the plan's only Windows check of the startup hook never runs in CI. Worth noting in the PR's manual Windows steps.debug_info::UpdatesInfo::collect,FLUXER_UPDATE_FEED_BASEis parsed with a plainUrl::parse, whileConfigusesparse_instance. The report prints the whole URL, including any query or userinfo, and can show a base that the app itself would refuse at startup. This is cosmetic for a feed URL.crates/fluxer-devserver/tests/updates.rs(feed_serves_a_manifest_with_the_assets_real_sha256) says "the feed was asked twice" next toassert_eq!(requests.len(), 2)(one feed request and one asset request).native-update-channelhas owner 7, not 6) is explained in the row's note and is what parity-check requires.Verdict: approve. No blocking findings, local CI is green, and the Windows runner should be watched for the Velopack code that was never compiled here.