Skip to content

fix(updates): select installable asset by priority; show version in About#99

Merged
krazyjakee merged 1 commit into
masterfrom
fix/update-asset-selection
Jun 10, 2026
Merged

fix(updates): select installable asset by priority; show version in About#99
krazyjakee merged 1 commit into
masterfrom
fix/update-asset-selection

Conversation

@krazyjakee

Copy link
Copy Markdown
Contributor

Summary

Fixes the self-updater failing with "Unsupported archive: daccord-linux-x86_64.deb" on Linux (and the same latent bug on Windows), plus surfaces the app version in Settings.

Root cause

platformAssetUrl() iterated over the release's assets and returned the first one matching any listed extension. The exts list encoded an intended priority, but iterating assets ignored it. For v0.2.1 — which ships both daccord-linux-x86_64.tar.gz and daccord-linux-x86_64.deb — the alphabetically-first .deb won. The in-place installer only extracts .tar.gz/.zip, so it threw "Unsupported archive". Windows had the identical problem: it would have selected daccord-windows-x86_64-setup.exe over the .zip and failed the same way.

Fix

Split asset selection into two priority-ordered lists in update_controller.dart:

  • _installableExts — only formats the in-place swap helper can actually apply: Linux .tar.gz, Windows .zip, macOS .dmg, Android .apk. Drives the one-click "Download & install" button.
  • _downloadExts — superset including .deb/.rpm/.appimage (Linux) and setup .exe/.msi (Windows) as manual-download fallbacks.

Selection now iterates extensions (preference) rather than assets, so:

  • A release bundling multiple formats installs the right one.
  • A package-only release falls back to a manual "Download" link instead of failing mid-install.

Also

  • Bump kAppVersion 0.2.00.2.1 to match pubspec.yaml (it was stale).
  • Show v<version> in Settings → About.

Reviewer notes

  • Windows in-place install targets the portable .zip. The Inno installer (dist/installer.iss) uses PrivilegesRequired=lowest + {autopf}, so the default install dir is user-writable %LOCALAPPDATA%\Programs\Daccord — the move-based swap works without elevation. (Only a user who manually elevates into C:\Program Files hits the same inherent limitation as macOS copying into /Applications.)
  • pubspec.lock was intentionally left out — local pub get produced unrelated transitive bumps.

Test plan

  • flutter analyze --no-fatal-infos clean on changed files
  • flutter test (settings + notifications) pass
  • Manually trigger an update check on Linux against v0.2.1 and confirm it downloads the .tar.gz and installs in place
  • Confirm Settings → About shows v0.2.1

🤖 Generated with Claude Code

…bout

The self-updater picked the wrong release asset on Linux and Windows.
platformAssetUrl() iterated over assets and returned the first one
matching any listed extension, so for v0.2.1 (which ships both a
.tar.gz and a .deb on Linux, and a .zip and setup .exe on Windows) the
alphabetically-first package format won — but the installer can only
extract .tar.gz/.zip, producing "Unsupported archive: ...deb".

Split asset selection into two priority-ordered lists:
- _installableExts: formats the in-place swap helper can actually apply
  (Linux .tar.gz, Windows .zip, macOS .dmg, Android .apk).
- _downloadExts: superset including .deb/.rpm/.appimage and setup
  .exe/.msi as manual-download fallbacks.
Selection now iterates extensions (preference) rather than assets, so a
release that bundles multiple formats installs the right one and a
package-only release falls back to a manual download link instead of
failing mid-install.

Also bump kAppVersion 0.2.0 -> 0.2.1 to match pubspec, and surface the
version in Settings -> About.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@krazyjakee krazyjakee merged commit 2745541 into master Jun 10, 2026
5 checks passed
krazyjakee added a commit that referenced this pull request Jun 16, 2026
* test(updates): guard against re-selecting unextractable .deb for in-place install

The self-updater's in-place install can only extract a .tar.gz/.zip, mount a
.dmg, or hand off a .apk; package formats (.deb/.rpm/.appimage) and setup
installers are download-only. #99 fixed asset selection picking the alphabetically
-first .deb over the .tar.gz on Linux ("Unsupported archive: daccord-linux-x86_64.deb")
but shipped no test, so the regression silently re-emerged on v0.2.4.

Add regression tests over UpdateController's asset selection using the real
release asset set (both .deb and .tar.gz, .deb listed first): platformAsset()
never returns an unextractable package, always picks the host-applicable
extension, prefers .tar.gz over .deb, and a package-only release falls back to a
download link instead of failing mid-install.

* Fix Windows zip ambiguity in asset selection and test import ordering

- _installableExts and _downloadExts for Windows now prefer the
  more-specific 'windows-x86_64.zip' suffix before the generic '.zip'
  fallback, preventing daccord-web.zip (which sorts alphabetically
  before daccord-windows-x86_64.zip in GitHub's asset list) from being
  selected as the in-place Windows installer — the same class of bug
  as the .deb-over-.tar.gz regression being guarded here.
- Add a Windows regression test mirroring the Linux .deb/.tar.gz test.
- Strengthen the 'selects the extension the host installer can apply'
  assertion on Windows to verify the name contains 'windows', not just
  that the extension is .zip.
- Fix import ordering in the test file: dart: imports before package:.

https://claude.ai/code/session_01HPonjbbg1y1GMMTQLKebce

---------

Co-authored-by: Claude <noreply@anthropic.com>
@krazyjakee krazyjakee deleted the fix/update-asset-selection branch June 28, 2026 23:01
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.

1 participant