Skip to content

LOCAL: offer one download per release source in Settings → Updates - #14

Merged
kiwidream merged 4 commits into
swaplabs/mainfrom
fork-update-sources/updates-buttons
Sep 25, 2026
Merged

kiwidream merged 4 commits into
swaplabs/mainfrom
fork-update-sources/updates-buttons

Conversation

@kiwidream

@kiwidream kiwidream commented Sep 25, 2026 •

Copy link
Copy Markdown
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​974 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​974
Prod 16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​930 $\color{#cf222e}{\Huge{\mathbf{−}}}$​169 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​761

ELI5

Orca can now be built to know about more than one place its updates come from (the official Orca releases and the SwapLabs fork releases). Until now, that knowledge was only reachable through a hidden developer panel. This PR puts it on the normal Settings → General → Updates row: one button per release source, so a person on a fork build can move to the latest official build, or back, with a single click. If the running app cannot install the other side's build itself (macOS and Windows refuse builds signed by someone else, and Linux deb/rpm installs belong to the package manager), the button instead opens the right download page rather than starting something that would fail halfway.

Builds that know only one source see exactly what they see today.

What Changed

Before (fork build): Updates showed "Check for Updates" and a hint. Getting an official Orca build meant Alt-clicking the header to reveal the developer channel picker. On macOS/Windows a refused cross-source jump produced an error with no way to reach the download.

After (fork build), the row is:

[Check for Updates] [Download 1.4.198 (Orca upstream)] [Download 1.4.197-swaplabs.202609251710 (SwapLabs)] [Current source]

  • One button per configured release source, labelled with the newest published build of that source for this platform. The running source carries a "Current source" badge, and its button is disabled while the running build is already that source's newest. If the running source has a newer build, its button becomes the primary action.
  • Clicking another source's button runs the existing cross-source install (a pinned check of that exact tag with autoDownload), so the flow ends in the existing "Restart to Update" button.
  • Where an in-app install is impossible, the button reads "Open download page ()" with an external-link icon and opens the installer asset (or the release page for a package-manager install). Nothing is downloaded in-app.
  • All buttons are held while a check or download runs; only one download runs at a time. The hint line names the source every state speaks for ("Checking Orca upstream releases…", "Downloading v1.4.198 (Orca upstream)... 42%", "You're on the latest SwapLabs build.").
  • Per-source list failures (rate limit, unreachable repository) render under the row, and the other source stays usable.
  • "Check for Updates" also re-lists the sources, bypassing the five-minute cache.
  • A refused cross-source jump's error now links "Open download page" (the manualInstallUrl main already sends; deferred from LOCAL: updater release-source registry and sticky source #10).
  • The header reads "Current version: · ".
  • The hidden Alt-click channel picker is untouched.

Mechanism. A new desktop-only IPC read, updater:listSources, returns for every configured source: label, whether it is the running one, the newest stable build (through the same list cache the dev picker uses), the install mode for this host (in-app, manual-installer, externally-managed), and any list error as data. Main computes the install mode from the same requiresManualInstall and externally-managed checks it refuses by, so the renderer only presents. The renderer gained a small hook (use-release-source-statuses.ts) with a request-id guard so an overlapping refresh cannot publish a stale list, and a ReleaseSourceUpdateControls.tsx with the buttons, hint, and error rendering. GeneralUpdateSettingsSection.tsx keeps the single-source branch as today's markup and never issues the read for single-source builds.

Nothing on the runtime (remote-server) wire changes; the web client stub returns an empty list.

Why

The whole point of the fork update-source work is that a fork user should not need a developer panel to switch sources, and an upstream user should notice nothing.

Alternatives considered:

  • Compose the row in the renderer from listBuilds per source (existing IPC). The renderer cannot know the install is a deb/rpm the package manager owns, and it would re-derive the signature rule main enforces. Putting the verdict in main means the button can never promise an action main refuses a moment later.
  • Fixed pixel widths per button (as the plan suggested to avoid label swaps). Fork versions carry a minute stamp and optional delta identifiers, so no width fits without truncating the part that names the source. Instead, a button's label never changes during an action: only the icon swaps to a spinner, and the row wraps on narrow panes.
  • Hide the running source's button when up to date. Kept visible but disabled with the badge, so the row always shows both sources and reads the same in every state.

Linked Issue

Follow-up to #10 (updater core, Phases 1–2) and #8 (build pipeline) of the fork update-source plan; there is no separate tracking issue for this fork-only phase.

Visual Proof

Screenshots are attached separately (images are not committed). Captured from the hidden e2e renderer on Linux, dark and light, at ~/phase3-screenshots/ on minidev-alex1:

  • BEFORE (swaplabs/main b6a4bf8): before-idle-{dark,light}.png, before-available-{dark,light}.png, before-downloading-{dark,light}.png, before-settings-page-{dark,light}.png
  • AFTER: after-idle-{dark,light}.png, after-downloading-{dark,light}.png, after-error-manual-install-{dark,light}.png, after-settings-page-{dark,light}.png

Testing

Linux (minidev, Xvfb). Not run on macOS or Windows; the platform-specific install modes are covered by unit tests through the platform spy.

  • pnpm tc — pass
  • pnpm test src/main/updater src/shared src/main/window src/preload src/renderer/src/components/settings/GeneralUpdateSettingsSection src/renderer/src/components/settings/ReleaseChannelSection.test.tsx src/renderer/src/i18n — 941 files, 10512 tests pass
  • pnpm run check:code-quality:changed -- refs/remotes/swaplabs/swaplabs/main — pass
  • verify:localization-catalog, verify:localization-runtime-catalog, verify:localization-extraction, verify:localization-coverage — pass (sync:localization-runtime-catalog produced no change)
  • pnpm run audit:anti-slop — pass
  • pnpm run verify:rpc-params-catalog — pass
  • E2E: tests/e2e/update-sources-buttons.spec.ts (new) passes on both themes against a bundle built with ORCA_RELEASE_SOURCES set (SKIP_BUILD=1 ORCA_BACKGROUND_LAUNCH=1 npx playwright test tests/e2e/update-sources-buttons.spec.ts --config tests/playwright.config.ts --project=electron-headless). It skips itself on a single-source build.

New/extended tests:

  • GeneralUpdateSettingsSection.test.tsx: single-source build renders only today's row and never lists sources; error hint links manualInstallUrl.

  • GeneralUpdateSettingsSection.multi-source.test.tsx: one button per source with the running source marked; pinned auto-download params; running source's newer build as primary action; manual-installer and externally-managed swaps; disabled while checking/downloading/downloaded; routine "available" routed through the running source's button; per-source list error; refresh on check.

  • updater.list-sources.test.ts: per-source rows, macOS manual-installer, externally managed, per-source failure as data, cache sharing and force.

  • updater-list-sources-ipc.test.ts: handler registration and force coercion.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Claude Fable 5.1 (Claude Code) implemented this under coordinator review.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Cross-platform: install mode is decided in main per platform; Windows is out of scope for fork legs (D3) but a Windows cross-source jump renders the download page rather than failing. macOS same-source fork updates stay in-app per requiresManualInstall; making them download-only is the Phase 4 Squirrel check (D4).
  • Remote SSH: no runtime-wire change; the read is desktop IPC only.
  • Buttons lost the explicit gap-2 class (the design-system gate forbids restyling Button); the sm size supplies the icon gap.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Multi-source builds show a button per configured release source next to
"Check for Updates": "Download <version> (Orca upstream)" and
"Download <version> (SwapLabs)", the running source marked with a
"Current source" badge. A click runs the existing pinned cross-source
install with autoDownload; every button is held while a check or
download runs, and the hint names the source each state speaks for.

Main owns the per-source verdict through a new desktop-only
`updater:listSources` read: the newest stable build per source from the
shared list cache, plus how this host can reach it — in-app, a manual
installer (cross-source on macOS/Windows), or an externally managed
Linux package. Those last two render "Open download page (<label>)" and
never start an in-app flow the updater would refuse. List failures come
back as data per source, so one unreachable repository never hides the
other. A refused jump's `manualInstallUrl` now links from the error hint.

Single-source builds never issue the read and keep today's row.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@luxor-code-review

luxor-code-review Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Review complete. 🟡 1 medium

💬 Inline comments (1)

Reviewed commit: e8a7b0d

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T19:03:56.365663Z ed4b75b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e8a7b0d2a6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@luxor-code-review luxor-code-review Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand to see previous review

Adds multi-source release listing and per-source download controls to the updater across main, preload, renderer, and tests.

…download-page rows usable while a download is staged

Codex P2 on #14: the running source's button compared the listed build
to the running version by string equality, so a list that lags the
running build (release not yet listed, or withdrawn) left a primary
"Download" that would install the older build through the pinned check's
allowDowngrade. The button now disables whenever the listed build is at
or below the running version, ordered by the shared stamp-then-semver
rule (`compareReleaseVersions`, extracted from the picker's sort), and
its tooltip says the running build is newer. Other sources are not
ordered against the running version: across sources the strings do not
compare, and a downgrade there is the point.

Tenki medium on #14: a staged in-app download (`downloaded`) disabled
every source row, including the manual-installer and externally-managed
rows whose only action is opening a release page; those rows stay usable
while a download is staged, since a browser tab conflicts with nothing.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@luxor-code-review

luxor-code-review Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


Adds multi-source release selection to the updater (main-process source listing, IPC/preload bridge, shared types, and a settings UI section); no blocking defects found, with only low-confidence polish notes on IPC sender validation and settings button gating.

Reviewed commit: 61ec235

luxor-code-review[bot]
luxor-code-review Bot previously approved these changes Sep 25, 2026
…e a cross-source download is staged

Review finding on #14: once a cross-source pinned download reached
`downloaded`, "Check for Updates" was still enabled. Its routine check
unpinned the build and overwrote the status with the running source's
result ("You're on the latest SwapLabs build"), while the staged
AppImage stayed registered with electron-updater's quit handler and was
installed on the next quit — a surprise install the UI had just denied.

Main now ignores a routine menu check while a pinned build is staged
(`isPinnedBuildActive` and `downloaded`): the build is restarted into or
left alone. The multi-source row disables "Check for Updates" in that
state with a tooltip saying to restart first; the single-source row is
unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@luxor-code-review

luxor-code-review Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Review complete. No blocking issues — approved ✅; 1 nitpick below.

🧹 Nitpicks (1) — 🟢 1 low
  • 🟢 New i18n keys untranslated in five locales (en.json:7390) — The 13 new keys added under GeneralUpdateSettingsSection (currentVersionWithSource, sourceUpdateFailed, openDownloadPage, downloadFromSource, downloadFromSourcePending, currentSource, idleWithSource, checkingSource, latestFromSource, isAvailable, downloadingFromSource, openReleasePage, newerThanListed, stagedHold) exist only in src/renderer/src/i18n/locales/en.json:7390; es, fr, ja, ko, and zh contain the section but lack all of them, so multi-source UI renders English fallbacks in those locales.

This PR adds multi-release-source update checking: the main-process updater can list available builds across configured sources, exposes a new updater:listSources IPC handler through the preload bridge, and the Updates settings section renders per-source status rows with install/download controls.

Reviewed commit: 5d3ff58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d3ff5803b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@luxor-code-review
luxor-code-review Bot dismissed their stale review September 25, 2026 18:56

Superseded by a newer Tenki approval on this pull request.

Codex P2 on #14: an Option-click local build (macOS) reaches the Updates
row as `available` with `source: 'local'`, and on a multi-source build
main also stamped the running release source on it. The running
source's button then wore the local version as "Download … (SwapLabs)"
and the hint called it a SwapLabs release.

Main no longer names a release source on local-build statuses, and the
multi-source row treats `source: 'local'` as no source's offer: it keeps
the generic "Download Update (<version>)" action and the generic hint,
while the source buttons stay held as for any other in-flight update.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@luxor-code-review

luxor-code-review Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Review complete. 🟠 1 high

📍 Outside the diff (1)

  • 🟠 Local-build and pinned-tag checks bypass staged-build guard (updater-build-selection.ts:73–79) — The new staged-pinned-build guard in checkForUpdatesFromMenu only protects the default check path: the localBuild and targetTag branches return earlier (src/main/updater/updater-menu-checks.ts:26-39) and their entry guards in checkForLocalBuildFromMenu and checkForPinnedBuild block only checking/downloading (src/main/updater/updater-build-selection.ts:73), so both run while a pinned build is staged.

Adds multi release-source update support (per-source status, cross-source install, manual-install fallback) across the updater main process, IPC bridge, and settings UI.

Reviewed commit: ed4b75b

@kiwidream
kiwidream merged commit 712cf44 into swaplabs/main Sep 25, 2026
32 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

return getReleaseSourceOrPrimary(updateStatus.releaseSource ?? runningSourceId).label

P2 Badge Do not label an unknown running source as upstream

In a multi-source package running an older or otherwise unrecognized fork version, runningSourceId is null, so this fallback labels source-less statuses as the primary source. Main deliberately skips routine checks in this case (updater-release-feed.ts:130-143), yet clicking Check for Updates will say “Checking Orca upstream releases...” followed by “You’re on the latest Orca upstream build” even though no upstream feed was queried. Use neutral copy when neither the status nor running version identifies a source.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

kiwidream pushed a commit that referenced this pull request Oct 30, 2026
…tablyai#32355) (stablyai#36031)

* fix(native-chat): keep a huge unbroken paste from freezing the chat

A long run with no whitespace ("xxxx…", "0000…", "abab…") wrapped with
kerning makes Chromium reshape it at every line, quadratic in run length:
128 KiB stalls 2.4 s, 1 MiB 19 s, 5 MiB never finishes. ProseMirror forces
that layout on paste and on each keystroke, so the composer freezes in
every terminal-backed chat, including paired servers and WSL. A sent
message stalls the transcript the same way: its fold clips the text but
still lays it all out (128 KiB: 2.5 s).

Runs over 256 characters now render with font-kerning: none, so prose of
any length and Shift+Enter lines keep kerning:
- composer: inline decorations, updated only for the lines a transaction
  touches (a keystroke beside 8,000 decorated lines ~1 ms, not ~190 ms)
- user messages in the transcript and expanded queued cards: the whole
  text when it holds such a run

Text, drafts and what is sent are unchanged. After: 1 MiB single line
84 ms, 5 MiB 312 ms (keystroke 248 ms), 1 MiB of 4000-char lines 50 ms
(was 2.3 s), transcript 128 KiB 80 ms. Worst case left kerned, 256-char
runs: 1 MiB 242 ms, 5 MiB 1.2 s, like 1 MiB of short lines (291 ms).

Fixes stablyai#32355

Co-authored-by: Manan Chataut <mananchataut@gmail.com>

* fix(native-chat): keep kerning on long CJK and Thai paragraphs

These scripts have no spaces but Chromium can break between their
characters, so a long paragraph is not one unbreakable run. Count
ideographs, kana, Hangul and Thai as break opportunities so such text
keeps kerning.

Co-authored-by: Manan Chataut <mananchataut@gmail.com>

* fix(native-chat): rescan only the edited run, and wait out IME compositions

Splitting one run inside a block of thousands replaced every decoration
in that block, and ProseMirror's removal is quadratic: 1,411 ms for one
space in a paragraph of 8,000 long runs. A change now rescans only from
the run edge before it to the run edge after it, and removes only the
decorations that overlap: ~1 ms for the same edit.

Decorations are only mapped while an IME composition is in progress, so
the composing text node is not re-rendered. The deferred range is
rescanned with the next non-composing change, or on compositionend when
none follows.

The keystroke-timing test is replaced by deterministic ones: unaffected
decorations are reused and the result equals a full scan; a composition
defers the rescan and compositionend runs it.

Co-authored-by: Manan Chataut <mananchataut@gmail.com>

* fix(native-chat): never split a CJK code point, and treat NBSP as glue

A supplementary ideograph (U+20000-U+3FFFF) broke a run at its high
surrogate only, so the decoration began on the low surrogate and split
the pair across elements. Both the run scan and the leftward edge scan
now treat the pair as one break.

NBSP joins words for Chromium's line breaker (UAX #14 class GL), so an
NBSP-joined paste is one unbreakable run and must lose kerning; drop it
from the break set. No other non-breaking characters were in it.

Drop a composer test whose coverage the decoration reuse test already
has.

Co-authored-by: Manan Chataut <mananchataut@gmail.com>

* fix(native-chat): classify surrogate pairs whole at a rescan's edge

Two lone-surrogate edge cases made the incremental rescan disagree with
a full scan:
- an edit completing a pair at the window start (a lone high surrogate,
  then a pasted low surrogate and run) began the decoration on the low
  surrogate; the window now widens past the whole pair
- a lone low surrogate after any break counted as a pair end, dropping
  it from the run; that now requires a preceding high surrogate

A seeded fuzz also found inclusive decoration edges mapping across a
joined block's boundary, where ProseMirror cannot remove them; the
decorations are no longer inclusive.

Co-authored-by: Manan Chataut <mananchataut@gmail.com>

---------

Co-authored-by: Manan Chataut <mananchataut@gmail.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.

1 participant