Skip to content

Implemented Tauri alike auto updater - #4

Merged
emmertex merged 12 commits into
emmertex:mainfrom
deunderscorepaul:main
Oct 13, 2026
Merged

emmertex merged 12 commits into
emmertex:mainfrom
deunderscorepaul:main

Conversation

@deunderscorepaul

Copy link
Copy Markdown
Collaborator

Adds a self-contained updater so builds can update themselves from this repository's releases,
instead of every platform relying on its own package manager (or nothing). Help ▸ Check for
Updates… reads the release feed, shows what is newer and what installing it will do, downloads the
file for your platform, and installs it.

This is fork-owned code, not parity work: the reference app updates through its own service. I've
added a row for it in docs/parity-checklist.md (MENU-HELP-UPDATES) as an explicit extra.

What it does

Platform Artifact Install
Windows .msi msiexec /passive /norestart runs the installer, then the app starts again
macOS .dmg a script mounts it, copies the .app over the running one, relaunches
Linux x86_64 / aarch64 .AppImage a script renames the running file aside and starts the new one
riscv64 / FreeBSD / portable .tar.gz, .zip downloaded and its folder shown, for a manual unpack

One check runs a few seconds after start-up (opt-out in the dialog, saved in the app's own
updates.json — one installation per machine, so it is not a catalog preference). It never opens a
window by itself; a found release is announced once with a toast. "Skip This Version" is remembered,
so nobody is asked twice. The dialog also has Check Again, the download's progress with Cancel, and
the two settings.

Where updates come from

  1. <PREFIX>_UPDATE_URL (or update.check {feed}, or Options::manifest_url) — a mirror, a fork, a
    local feed for testing;
  2. …/releases/latest/download/latest.json — the static manifest this PR adds to the release job;
  3. GET /repos/{owner}/{repo}/releases — GitHub's API, no token needed for a public repository.

Both feed shapes parse into one Release. The manifest is tried first because it is a plain asset on
the release: the check keeps working when the API is rate-limited (a 403 there is reported as such
rather than as a mystery).

The pieces

  • crates/updater — new L0 crate, native only, registered in xtask/src/layers.rs as
    ["brand", "net", "updater"]:
    • version.rs: SemVer 2.0.0 precedence (v1.2.3, 1.2.3-rc.1; a release outranks its own
      prereleases; build metadata is ignored). A tag that is not a version (nightly) is not a release
      of ours.
    • release.rs / target.rs: asset selection from the artifact names the pipeline already produces
      (<binary>-<version>-<os>-<arch>…) — an installer always wins over an archive, the portable zip is
      deliberately left for a manual install, and the SHA256SUMS.txt asset is read for the hash and
      never installed.
    • checksum.rs / download.rs: SHA256SUMS.txt parsing, resumable transfer, size cap, and the
      size + SHA-256 check before the file is given its real name. A file that fails is deleted; a
      .part that is already complete is no longer trusted if a hash is expected (see the fix below);
      an asset name like ../../… is reduced to its last path segment.
    • install.rs: plan() (what will happen, in words, before anything does) and install().
    • No unwrap/expect/panic outside tests, #![forbid(unsafe_code)]; every failure is an
      UpdateError a dialog can show, and every one of them leaves the running installation alone.
    • README.md carries the design and a Sources: line (own design from the documented GitHub
      Releases API and release asset layout; SemVer 2.0.0 for precedence; Tauri's updater as a design
      reference for the shape of the flow only).
  • engine — crates/engine/src/update.rs (the session's state: check on a worker thread, download
    in the activity stack, install, settings) and crates/engine/src/cmd/update.rs with
    update.status|check|download|downloadCancel|install|discard|prefs|dismiss. The UI, the CLI, the
    control channel and MCP all drive it through those ids like anything else.
  • ui-egui — panels/update.rs (the dialog), the two Help entries
    (app.checkForUpdates, app.installUpdate), and the start-up check with its toast.
  • crates/net/src/download.rs — see the fix below.
  • .github/workflows/release.yml — the release job builds latest.json from the artifacts and the
    SHA256SUMS it just computed and uploads it beside them. It is built after the draft exists, so the
    notes in it are the published ones (the dialog shows them as What's New). Prereleases get a manifest
    flagged as such; the app only offers one to someone who ticked "Include prereleases".

The one behavioural fix outside the feature

lcc-net's Client::download had a hole: when a .part was already the whole expected size it was
renamed into place without hashing, so a caller that asked for a SHA-256 could get an unverified file.
done_already now also requires sha256.is_none(), so a transfer with an expected hash always hashes
what it accepts. Easy to hit with the updater (a release publishes a hash) and wrong for anyone else
who passes one.

Testing

  • crates/updater: 48 tests — SemVer ordering and refusal, both feed shapes, per-platform asset
    choice, SHA256SUMS.txt parsing, sanitised file names, resume, wrong-hash and truncated files being
    thrown away, and every platform's classification. Local HTTP servers only: no internet.
  • lcc-engine: 23 tests including a hermetic end-to-end path — a local feed serving latest.json,
    SHA256SUMS.txt and an installer → check → download → verified staged file → install plan — plus the
    activity row and its cancel.
  • lcc-ui-egui: 12 tests (the dialog from the Help menu, Skip, the settings, a manual install that
    must not quit the app, and a checksum list never being offered for install).
  • i18n: the new strings are translated in all nine catalogs (overlay), and
    fork_catalogs_are_valid_json now reads locales/fork/*.json the way build.rs does and names the
    file and the parser's complaint — a merge that mangles one fails a test that says what happened
    instead of only a build script.
  • cargo xtask ci locally: fmt, brand, docs, clippy -D warnings, heif, layers, assets, parity and
    wasm all pass. cargo test --workspace on Windows fails 19 pre-existing path-separator tests in
    rename / sidecar / tests_filesystem_history (they compare /p\x.jpg with /p/x.jpg); they
    fail the same way on main before this branch, and this PR does not touch those files.

Trying it without a release

Any static file server works as a feed:

{
  "version": "9.9.9",
  "name": "App v9.9.9",
  "notes": "### Fixed\n- a thing",
  "pub_date": "2026-10-12T00:00:00Z",
  "releases": [{
    "tag": "v9.9.9", "name": "App v9.9.9", "notes": "### Fixed\n- a thing",
    "date": "2026-10-12", "prerelease": false,
    "assets": [
      {"name": "app-9.9.9-linux-x86_64.AppImage", "url": "http://127.0.0.1:8791/app.AppImage", "size": 400000},
      {"name": "SHA256SUMS.txt", "url": "http://127.0.0.1:8791/sums", "size": 90}
    ]
  }]
}
<cli> run --demo update.check feed=http://127.0.0.1:8791/latest.json wait=true \
                 update.download wait=true update.install

The last command without confirm returns the plan (summary, steps, restart) and installs nothing.
The end-to-end test in lcc-engine does exactly this against a listener it starts itself.

Decisions worth a second opinion

  • latest.json on this repository's releases is the feed by default. Once this lands and a
    release is published, builds of this project update from here. Forks that want their own channel set
    <PREFIX>_UPDATE_URL or repoint brand.toml's repository (which also moves the About window's
    website/source links) — worth a line in docs/releasing.md, which I've added.
  • Prereleases are opt-in in the dialog, and a build newer than the newest release stays quiet
    (no "downgrade to the release" nagging).
  • Not included on purpose: delta/block updates for AppImage (the pipeline already embeds
    gh-releases-zsync, so AppImageUpdate remains the block-level path), Flatpak/.deb/.rpm self
    updates, a Windows portable-zip unpack (it needs an archive reader; the file is laid out for the
    user instead), and a signature beyond the release's SHA-256 published over TLS.
  • Download cap is 4 GiB, and the transfer is cancellable with a row in the activity stack.

deunderscorepaul and others added 8 commits October 12, 2026 19:19
Help ▸ Check for Updates… reads the release's latest.json (else GitHub's
Releases API, else <PREFIX>_UPDATE_URL), compares it with this build, shows
the notes and what installing will do, downloads the artifact for this
platform (resumable, size- and SHA-256-checked, in the activity stack) and
installs it: the Windows MSI runs, the macOS disk image is mounted and its
app copied over this one, an AppImage replaces itself, and a tarball or zip
is laid out for a manual install. One check runs a few seconds after
start-up unless it is turned off; a skipped version is not offered again.

- lcc-updater (L0, native): SemVer feed parsing, platform asset choice,
  verified download, staged install. No panics: every failure is a message
  and leaves the installation alone.
- engine: the session's updater state (check, download, install, settings in
  the app's own updates.json) and the update.* commands.
- ui-egui: the dialog, the two Help entries, a start-up check that announces
  itself with a toast instead of opening a window.
- release.yml: the release job publishes latest.json beside the artifacts,
  built from the checksums it just computed.
- lcc-net: a resumed partial file is no longer trusted as complete when a
  SHA-256 is expected (the hash was never checked).

Sources: own design from the documented GitHub Releases API and release asset
layout; version precedence follows Semantic Versioning 2.0.0; the flow's shape
follows Tauri's updater as a design reference.
Help ▸ Check for Updates… reads the release's latest.json (else GitHub's
Releases API, else <PREFIX>_UPDATE_URL), compares it with this build, shows
the notes and what installing will do, downloads the artifact for this
platform (resumable, size- and SHA-256-checked, in the activity stack) and
installs it: the Windows MSI runs, the macOS disk image is mounted and its
app copied over this one, an AppImage replaces itself, and a tarball or zip
is laid out for a manual install. One check runs a few seconds after
start-up unless it is turned off; a skipped version is not offered again.

- lcc-updater (L0, native): SemVer feed parsing, platform asset choice,
  verified download, staged install. No panics: every failure is a message
  and leaves the installation alone.
- engine: the session's updater state (check, download, install, settings in
  the app's own updates.json) and the update.* commands.
- ui-egui: the dialog, the two Help entries, a start-up check that announces
  itself with a toast instead of opening a window.
- release.yml: the release job publishes latest.json beside the artifacts,
  built from the checksums it just computed.
- lcc-net: a resumed partial file is no longer trusted as complete when a
  SHA-256 is expected (the hash was never checked).

Sources: own design from the documented GitHub Releases API and release asset
layout; version precedence follows Semantic Versioning 2.0.0; the flow's shape
follows Tauri's updater as a design reference.
…ghtcraft-classic into auto-updater

# Conflicts:
#	crates/ui-egui/src/menus.rs
#	crates/ui-egui/src/panels/dialogs.rs
#	xtask/src/layers.rs
Resolving the nine `locales/fork/*.json` conflicts took both sides' blocks but dropped the
comma between them, so none of the files parsed any more. `build.rs` reads each overlay with
`serde_json` while compiling `lcc-ui-egui`, so the crate cannot be built from a clean checkout:
"expected `,` or `}` at line 1182 column 3".

Each file is now main's catalog plus the branch's updater messages, with main's wording kept
where both sides carry a key (the translation that was already there wins), and its line endings
and one-entry-per-line shape untouched.

`i18n::tests::fork_catalogs_are_valid_json` reads the overlays the same way `build.rs` does and
names the file and the parser's complaint, so a merge that mangles one fails in a test that says
what happened rather than only in a build script. It fails on the pre-fix files.
# Conflicts:
#	crates/ui-egui/locales/fork/de-formats.json
#	crates/ui-egui/locales/fork/de.json
#	crates/ui-egui/locales/fork/es-formats.json
#	crates/ui-egui/locales/fork/es.json
#	crates/ui-egui/locales/fork/fr-formats.json
#	crates/ui-egui/locales/fork/fr.json
#	crates/ui-egui/locales/fork/ja-formats.json
#	crates/ui-egui/locales/fork/ja.json
#	crates/ui-egui/locales/fork/pt-br-formats.json
#	crates/ui-egui/locales/fork/pt-br.json
#	crates/ui-egui/locales/fork/ru-formats.json
#	crates/ui-egui/locales/fork/ru.json
#	crates/ui-egui/locales/fork/uk-formats.json
#	crates/ui-egui/locales/fork/uk.json
#	crates/ui-egui/locales/fork/zh-hans-formats.json
#	crates/ui-egui/locales/fork/zh-hans.json
#	crates/ui-egui/locales/fork/zh-hant-formats.json
#	crates/ui-egui/locales/fork/zh-hant.json
… by $APPIMAGE, pass the msi path unquoted

- set_executable was dead code on Linux (clippy -D warnings failed)
- inside an AppImage current_exe is the read-only squashfs binary; replace the file in $APPIMAGE
  and refuse (with a message) when this copy was not installed as an AppImage
- Command already quotes arguments; the extra quoting handed msiexec literal quote characters

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@emmertex
emmertex enabled auto-merge October 12, 2026 22:17
emmertex and others added 4 commits October 13, 2026 11:05
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… broke ア; catalog_characters_are_paintable)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@emmertex
emmertex merged commit 14d33a8 into emmertex:main Oct 13, 2026
9 of 11 checks passed
emmertex pushed a commit that referenced this pull request Nov 27, 2026
…nd relink scope, one SHA-1 rule

Full review of 8c2de9d (pass chromaforge-20261127-20c5); fixes for every Critical-Medium finding but
the stale SHA-1 on changed bytes (spec F1), whose PR 0 worsening is fixed here:

- Reload records the SHA-1 beside its undo step (apply_system, as the back-fill does): a Reload that
  finds only the SHA-1 adds no step and keeps the redo history, and an undo keeps the SHA-1 of the bytes
  on disk. Only the newest reload started records it, so an older read of a file that changed meanwhile
  can't fix the old bytes' SHA-1 (#1's worsening, #3).
- Reload leaves Immich link-only photos out (as the preview-only recheck does): re-reading the server's
  preview cleared the flag, and the next Reload or back-fill recorded the preview's SHA-1 (#4, #14, #17).
- `Sha1To` becomes `convert::Reach`; a relink (`Reach::Target`) reaches only its target, so the old-path
  family no longer takes the new file's content hash, size, lens or white balance (spec F7) (#5).
- `takes_sha1` asks `Photo::in_library()` (deleted photos take none) (#6), and is the rule of every SHA-1
  writer: the back-fill's result (queued and counted only when recorded; a refused one is not retried)
  and the vignetting reference (no SHA-1 for a virtual copy; a malformed one no longer fails the step;
  queued) (#8, #9). Import and device sync queue through `queue_link_check` too.
- The back-fill leaves photos still to be read to read-originals (unless device sync wants them first),
  so a catalog import's files are no longer read twice (#11).
- `remote::is_link_only` is the one link-only test; the inline copies use it (#7).
- `is_sha1_hex`'s doc says how it relates to lcc_hash's parser; a parity test pins that every stored
  value parses there (#10). `Photo::sha1`'s doc states it is kept when the bytes change; a test pins
  it (#13, #18).
- Device sync moves a photo's replica record back to its content key when its SHA-1 is cleared (an
  undone Relink or Vignetting Calibration), instead of stranding it under the `sha1:` key (#12).
- Read Originals (and Reload/relink) fill an empty camera serial and lens range (#16).
- Tests for each, including a Demo-source case for the surviving `Source::File` mutant (#2).

Manual: none, no manual sentence describes these (whats-new and changelog entries added).

Review-Pass: chromaforge-20261127-20c5
Review-Findings-Closed: chromaforge-20261127-20c5#02, chromaforge-20261127-20c5#03, chromaforge-20261127-20c5#04, chromaforge-20261127-20c5#05, chromaforge-20261127-20c5#06, chromaforge-20261127-20c5#07, chromaforge-20261127-20c5#08, chromaforge-20261127-20c5#09, chromaforge-20261127-20c5#10, chromaforge-20261127-20c5#11, chromaforge-20261127-20c5#12, chromaforge-20261127-20c5#13, chromaforge-20261127-20c5#14, chromaforge-20261127-20c5#16, chromaforge-20261127-20c5#17, chromaforge-20261127-20c5#18, chromaforge-20261127-20c5#19, chromaforge-20261127-20c5#27, chromaforge-20261127-20c5#28, chromaforge-20261127-20c5#30, chromaforge-20261127-20c5#35

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants