Skip to content

feat(desktop): ship signed windows x64 builds on every channel - #335

Merged
nixuuu merged 3 commits into
devfrom
feat/windows-desktop-release
Nov 7, 2026
Merged

nixuuu merged 3 commits into
devfrom
feat/windows-desktop-release

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Windows x64 becomes a required desktop target on nightly, beta and stable, using windows-2025 and package:windows. Linux arm64 keeps its existing experimental behaviour. The existing publication pipeline uploads the NSIS installer, channel feeds and blockmaps, adds the Windows desktop manifest entry, and includes all assets in checksums.txt.

Windows signing now uses electron-builder's Azure Trusted Signing support. The non-secret configuration uses the ITSOL account, profile canopy, endpoint https://plc.codesigning.azure.net/, and publisher IT SOL SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ. Beta/stable fail clearly if credentials are incomplete. Nightly signs with complete credentials and otherwise builds unsigned with a notice. A signing failure never falls back to unsigned.

The signing path covers the installer/uninstaller, app executable, Electron executable helpers and bundled resources/runtime/bun.exe. Gateway, worker, web and controller are JS bundles run by that Bun executable; PostgreSQL is downloaded at runtime and is not bundled. After signing, Get-AuthenticodeSignature must report Valid and the exact publisher for the installer and every packaged .exe, otherwise the Windows artifact is not uploaded. Signed builds retain electron-updater's publisher verification across all channels. A valid signature identifies the publisher; SmartScreen also applies its own reputation and policy checks.

Required repository Actions secrets in itsoltech/canopy: AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET. They come from the Azure service principal of the ITSOL Trusted Signing account, with the Trusted Signing Certificate Profile Signer role on certificate profile canopy. The maintainer has now configured all three secrets. No values were read, copied or invented. The PR packaging job uses them for a real signing attempt. SmartScreen behaviour still requires a user-machine check.

Verification:

  • Local gates passed: bun install, bun run gen:check, bun run typecheck, bun run lint, bun run format:check, and bun scripts/build-web.ts. The foreground full bun run check:tmp rerun finished with 1,728 passed, 162 skipped, 1 failed, and no leftover temp files. Its only failure was an unchanged Grok provider fixture timing out (ConnectError: [canceled] The operation was aborted.); that file then passed alone through bun run check:tmp (1 passed, 0 failed, no leftovers). Full sharded CI passed every selected test on the final head. Local temp data stayed inside the worktree; setting a Git discovery ceiling for its temp directory resolved fixtures incorrectly discovering the parent repository. No unrelated production/test code was changed.
  • actionlint with ShellCheck passed for both changed workflows.
  • Publication tests cover Windows stable/beta/nightly installer preservation, cumulative feeds, blockmap checksums, manifest classification and updater eligibility.
  • Signed Windows packaging passed on windows-2025: https://github.com/itsoltech/canopy/actions/runs/42374930788 (final head 0fb05840fa3ebfa780925d0fbb7cc585a25d2673). NSIS installation, installed gateway/worker smoke, real updater metadata validation, manifest generation and artifact upload all passed. Repository PRs sign and verify; fork PRs build unsigned and check rejection by the signature gate. The workflow creates no releases, tags or images. The previous signed run also passed; its downloaded installer, blockmap and feed passed sha256sum --check against its workflow artifact's checksums.txt.
  • Full PR CI passed on the final head: https://github.com/itsoltech/canopy/actions/runs/42374930932 (static checks, all four test shards, web/Linux builds and aggregate check).

Exact verification output from the signed packaging run (no secret values):

Valid signature: Canopy-0.0.0-nightly.3-windows-x64.exe, publisher: IT SOL SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ
Valid signature: canopy.exe, publisher: IT SOL SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ
Valid signature: elevate.exe, publisher: IT SOL SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ
Valid signature: bun.exe, publisher: IT SOL SPÓŁKA Z OGRANICZONĄ ODPOWIEDZIALNOŚCIĄ
Installed gateway sidecar: 0.0.0-nightly.3
Installed worker sidecar: 0.0.0-nightly.3

The build log also confirms Azure signing of the embedded NSIS uninstaller. Live Azure authentication/permissions and the positive signature verification path are verified. Interactive SmartScreen behaviour and a real cross-release GUI update were not exercised.

No release or promotion workflow was triggered. No merge is requested.

Copy audit: no UI text changed.

@nixuuu
nixuuu marked this pull request as ready for review November 7, 2026 13:14
@nixuuu
nixuuu merged commit 2c89b5f into dev Nov 7, 2026
13 checks passed
@nixuuu
nixuuu deleted the feat/windows-desktop-release branch November 7, 2026 13:20
nixuuu added a commit that referenced this pull request Nov 10, 2026
## Change

A worker event containing NUL could roll back an entire transcript
batch. The gateway then drained the worker link, and journal replay sent
the same event again. This fixes long-standing storage behavior exposed
by Windows output.

The supplied logs show 448 PostgreSQL NUL storage failures for the same
thread and 448 matching worker drains/reconnects, between 2026-11-09
22:06 UTC and 2026-11-10 08:50 UTC. Consecutive active retries were
approximately 11 seconds apart. The logs establish the rejected
character and replay cycle; they do not establish which command or
source encoding produced it.

- Normalize U+0000 and lone UTF-16 surrogates to U+FFFD at gateway
persistence boundaries, before event projections. This covers raw JSON
keys/values, item identifiers, messages, tool input/output, bot
projections, command results and generated titles. Valid surrogate pairs
and literal backslash-u text stay intact.
- Isolate PostgreSQL data exceptions (`22xxx`) after the failed batch
rolls back. Migration `0111_worker_event_quarantine` stores the original
protobuf as `bytea`; a visible warning and journal cursor commit
atomically with it. The warning reuses the original event identity, so
replay remains idempotent. Later events continue on the existing link.
- Keep connection, deadlock and serialization failures on the existing
unacked drain/redelivery path. Failure to save quarantine also rolls
back the marker, cursor and preceding events in that recovery batch.
- Existing journals recover automatically after updating the gateway. No
journal deletion or worker protocol change is needed. Polish protocol,
durability, transcript and data-model documentation explains the
replacement and quarantine guarantees, including that quarantined events
do not apply their original projections.

Normal event ingestion scans string values and skips numbers/bytes.
Clean strings retain their value; ordinary events need no event clone or
raw-JSON parse. The work is linear in the event's fields and string
length. Only suspicious raw JSON is parsed, and only changed events are
cloned. Savepoints and per-event fallback writes are restricted to a
failed data batch; the normal batch path adds no SQL round trips.

Worker output decoding remains unchanged. Normal tool output reaches the
adapters as text already decoded by the harness. Guessing UTF-16 from
embedded NUL would risk altering valid output without access to its
original encoding. The gateway remains the persistence guarantee.

Linked-computer inspection found no dependency that turns a local worker
disconnect into a computer-link disconnect: peer presence uses its own
connections and heartbeats. The logs contain **770 local** and **89
linked** thread-watch resubscriptions, rather than 770 linked
resubscriptions. They begin at 19:30 UTC, before the first NUL failure,
so they are not solely a consequence of this loop. Worker
hello/heartbeat writes also advance shared metadata revisions and
trigger watch refreshes even with stable links. Flapping adds refreshes;
avoiding unrelated heartbeat-driven refreshes is a separate follow-up,
outside this storage fix. This conclusion comes from logs and code
inspection, not a live Windows/macOS reproduction.

Copy audit (§8): no recovery notice → “Some output could not be saved.
Later output will still appear.” Two short English sentences explain the
loss and automatic continuation; no new glossary terms, buttons,
duplicated labels or humor. SQLSTATE stays in structured details and
logs, without event payloads or secrets. The existing notice component
renders the warning; no frontend layout changed.

## Verification

- `bun install`, `bun run typecheck`, `bun run lint`, `bun run
format:check`, and `git diff --check` passed.
- `TMPDIR=/var/tmp bun test --rerun-each 5
tests/integration/event-storage.test.ts`: **35 passed**, no failures.
Real PostgreSQL + gRPC + file-backed SQLite journal cover automatic
replay, multiple NUL fields, raw JSON keys, lone surrogates, preserved
emoji/literal escapes, later output, quarantine (`22P02`/`22021`),
replay deduplication, transient serialization redelivery, bot
projections, titles/results and rollback if quarantine persistence
fails.
- Focused files run separately: database schema/migrations **23
passed**; durable threads **6 passed**; journal delivery **2 passed**.
- Full suite, generated-code check and web build are left to CI under
the requested shared-machine limits. No browser/E2E runs or protected
services were used.

Related: #335
nixuuu added a commit that referenced this pull request Nov 10, 2026
## Behavior

Windows updates currently launch the assisted NSIS installer and require
someone at the computer. Windows now uses `quitAndInstall(true, true)`
after service shutdown, so local **Restart to update**, gateway
requests, and linked-computer requests install silently and relaunch
Canopy.

The first-time installer stays assisted (`oneClick: false`, directory
selection, per-user default). macOS keeps the conditional feed replay
introduced by #471 and its existing flags; Linux keeps its existing
flags.

Existing machine-wide installations can still require UAC even when
update metadata describes a per-user installer. A preflight checks
`isAdminRightsRequired`, the machine-wide NSIS registry entry, and
installation-directory write access before shutdown. It refuses these
updates with an actionable local message and a remote `failed` reason,
releases the worker's drain barrier, and keeps services running. Update
those installations manually with administrator approval, or replace
them with a per-user installation.

The Windows main-process shutdown timeout now uses `taskkill.exe /PID
<owned-controller-pid> /T /F` instead of terminating only the
controller. The normal supervisor already closes sidecar stdin, stops
PostgreSQL with `pg_ctl stop -m fast`, waits for child closure, and uses
owned-PID tree cleanup on timeout. NSIS starts after the controller
exits.

## Pinned source verification

Checked the lockfile and installed sources for **electron-updater
6.8.3** and **electron-builder / app-builder-lib 26.18.0**, plus their
versioned upstream documentation and templates:

- [AppUpdater
API](https://github.com/electron-userland/electron-builder/blob/electron-updater%406.8.3/packages/electron-updater/src/AppUpdater.ts),
[BaseUpdater](https://github.com/electron-userland/electron-builder/blob/electron-updater%406.8.3/packages/electron-updater/src/BaseUpdater.ts),
and
[NsisUpdater](https://github.com/electron-userland/electron-builder/blob/electron-updater%406.8.3/packages/electron-updater/src/NsisUpdater.ts):
Windows receives `--updated /S --force-run`; metadata can select
`elevate.exe`, and launch permission failures can also trigger
elevation.
- [NSIS
documentation](https://github.com/electron-userland/electron-builder/blob/electron-builder%4026.18.0/website/docs/nsis.md),
[assisted
installer](https://github.com/electron-userland/electron-builder/blob/electron-builder%4026.18.0/packages/app-builder-lib/templates/nsis/assistedInstaller.nsh),
and [multi-user
macros](https://github.com/electron-userland/electron-builder/blob/electron-builder%4026.18.0/packages/app-builder-lib/templates/nsis/multiUser.nsh):
silent updates select the previous install scope and read its
`InstallLocation`, preserving a custom per-user directory.
-
[Installer](https://github.com/electron-userland/electron-builder/blob/electron-builder%4026.18.0/packages/app-builder-lib/templates/nsis/installer.nsi)
and [install
section](https://github.com/electron-userland/electron-builder/blob/electron-builder%4026.18.0/packages/app-builder-lib/templates/nsis/installSection.nsh):
assisted silent updates can elevate for a previous machine installation;
`/S --force-run` relaunches the installed app.
- [Running-process
check](https://github.com/electron-userland/electron-builder/blob/electron-builder%4026.18.0/packages/app-builder-lib/templates/nsis/include/allowOnlyOneInstallerInstance.nsh):
`--updated` allows time to exit, then attempts cleanup. Silent prompts
use default responses and can cancel installation if processes cannot be
stopped. Our shutdown must finish first.

Polish documentation in `docs/updates.md` and `docs/desktop.md` covers
unattended updates, UAC refusal, shutdown, relaunch, and the rollout
limitation: older clients still use their previous installer behavior
for the first update that installs this fix.

## Validation

- `bun install --frozen-lockfile` — passed.
- `TMPDIR=/var/tmp bun test apps/desktop/test/updates.test.ts
apps/desktop/test/update-install.test.ts
apps/desktop/test/update-controller.test.ts
apps/desktop/test/mac-update-feed.test.ts` — **37 passed**. Covers
Windows silent/force-run flags, unchanged Darwin/Linux flags, both
remote request sources, successful journal recovery at the target
version, elevation refusal/retry, and the macOS conditional feed replay.
- `bun run typecheck` — passed; Svelte reports 0 errors and 0 warnings.
- `bun run lint` and `bun run format:check` — passed.

CI remains the merge gate. No E2E suite or packaged installation was
run. **Real Windows installation, UAC behavior, process-tree
termination, and relaunch cannot be verified on this Linux machine.**
Signing, publishing, and release workflows are unchanged.

## Windows tester checklist

Start with a Windows desktop build containing this change and offer a
newer release on its selected channel.

1. Run a local **Restart to update** and confirm the target version is
installed.
2. Request remote updates from both a linked computer and a gateway
while nobody interacts with the Windows computer; confirm reconnect
reports the same request as `succeeded` at the target version.
3. Install per-user into a custom directory and confirm the update
preserves that exact directory and install scope.
4. Confirm no installer wizard, directory prompt, finish screen, or UAC
prompt appears for the per-user update.
5. Confirm Canopy relaunches automatically and gateway, worker, BFF, and
PostgreSQL return. Check that old bundled `bun.exe` processes do not
retain file locks; exercise normal shutdown and the forced cleanup path.

Also test a machine-wide installation (including a custom machine-wide
directory): local and remote requests must show the
administrator-approval reason before shutdown, with no installer/UAC
prompt, and services must remain available. The initial installation
must still show the assisted directory-selection flow.

## Copy audit (§8)

Before: machine-wide silent-update limitations had no specific preflight
message. After: “Update needs attention” and “This installation needs
administrator approval to update. Install Canopy for your user account
to enable unattended updates.” A separate probe failure says “Could not
check installation permissions. Retry the update on this computer.”
Generic preparation failures also provide a retry action.

Static audit passed: sentence case, short sentences, plain language,
explicit next actions, no new glossary terms, no decorative copy, and no
color-only cues. Existing native dialogs and error fields are reused; no
buttons, confirmations, empty states, or layout changed. No browser or
Windows dialog layout validation was performed on this Linux machine.

Related: #335
Related: #471
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