Commit Graph

317 Commits

Author SHA1 Message Date
BearHuddleston
d8d3ab74d3 fix(desktop): compare symlink targets in the packaged payload check
The payload check recorded every symlink as "symlink", so a packaged
link pointing somewhere other than the prepared one passed, dangling or
not. PM's tree digests hash the link text, so a retargeted tool link
would still fail `hermes pm doctor` in the shipped payload.

Targets were left out because relocation rewrites them, but the check
now runs on electron-builder's copy before relocation, where builder-util
copies each link's text verbatim. Each symlink is now compared by its
target. On Windows builder-util recreates links as junctions, which
store absolute paths, so a relative link the copy rewrote would fail
the pack there too; such a link would point into the build machine's
tree after install.

Test: a verbatim copy with a relative tool link passes afterPack, and
the same copy with the link retargeted fails naming both targets. On the
previous commit the retargeted copy passed. Reported by @kvnloo.
2026-11-18 11:11:59 -06:00
BearHuddleston
77f642c100 test(desktop): give the builder-copy test Windows packaging inputs
readPackagingInputs requires the winCodeSign toolset and a .NET root
for every win32 target, --dir included. The builder-copy test published
neither, so on Windows runElectronBuilder refused the manifest ("Missing
Windows tool selection") before the test reached the copy it checks.

The fixture now supplies both on Windows. Probe on Linux: the same
manifest built for win32-x64 is refused without them and admitted with
them. The Linux run is unchanged. No CI lane runs this file on Windows,
so the rest of the Windows run is unproven.
2026-11-18 11:11:59 -06:00
BearHuddleston
6dcd045c3a fix(desktop): fail the pack when the mapped payload never arrived
afterPack only looked up the prepared payload when agent-payload already
existed in the packaged resources, so a bundled pack with no payload at
all skipped the check. electron-builder only warns ("file source doesn't
exist") when an extraResources source is missing and packs without it.

The hook now asks the build's extraResources mapping first. When the
build maps a payload and the packaged copy is absent, the pack fails and
names both paths. Hermes Light maps none and is still skipped.

The after-pack.test.mjs fixtures now pass a packager with a config, as
electron-builder always does, because the hook reads the mapping on
every pack.

Test: a bundled pack with the prepared payload but no packaged copy
fails; the same pack under the real Light config passes. On the previous
commit the bundled pack resolved.
2026-11-18 11:11:59 -06:00
BearHuddleston
91b7579910 fix(desktop): check the packaged payload before afterPack changes it
The payload check ran at the end of afterPack, after relocation and
signing. On a signed macOS build, signNestedChromium first repairs any
flattened Chromium framework: Foo.framework/Foo and its Resources become
symlinks into Versions/Current. The prepared payload keeps the flattened
copy, so the check would have failed the pack over a repair afterPack
makes on purpose. The Nov 10 signed canary logged "repaired 0 framework
links", so no shipped build has hit this yet; a Chromium download with
flattened frameworks would.

The check now runs on electron-builder's copy before afterPack touches
it. Nothing has signed or relocated anything yet, so every platform
compares entries, types and file sizes, and the per-platform allowances
for signing's rewrites and macOS _CodeSignature seals go away. What
afterPack changes afterwards (relocated links, repaired frameworks,
signatures, refreshed digests) is that step's own work and stays covered
by its own tests.

Test: a signed darwin afterPack over a flattened framework (security and
codesign faked) repairs the links, signs Chromium.app and passes, while
a lost .gitkeep or a changed size fails before anything is signed. On
the previous commit the repaired copy fails the pack with "F: file
became symlink".
2026-11-18 11:11:59 -06:00
BearHuddleston
4ec66f1170 fix(desktop): fail the pack when the packaged payload differs from the prepared one
CI's payload smoke runs on build/agent-payload before packaging, so a loss
in electron-builder's copy shipped unseen: the pnpm .gitkeep the copy drops
is missing from the Nov 10 macOS canary. afterPack now compares the packaged
payload with the prepared one, after relocation, signing and the digest
refresh, and fails the pack listing every missing entry, changed type and
unexpected entry. The prepared payload is found through the build's own
extraResources mapping, so Hermes Light, which maps none, skips the check.

What afterPack itself legitimately changes decides what is compared:

- Linux: relocation only retargets venv symlinks (and discards build locks
  the sealed payload no longer carries), so the entry set, every type and
  every file size must match.
- macOS: codesign rewrites Mach-O bytes and wheel zips and adds
  _CodeSignature seals to the nested Chromium bundles (the Nov 10 canary
  has seven CodeResources files the Chrome for Testing zip lacks), and the
  rehash rewrites tools/facts.json. The entry set and types are compared;
  additions inside _CodeSignature are accepted.
- Windows: PE sanitizing and Authenticode signing rewrite PE bytes and the
  rehash rewrites tools/facts.json. The entry set and types are compared.

Symlink targets are never compared, because relocation rewrites them. The
PM digest check is no substitute: on macOS and Windows the rehash
re-records every tool digest over the packaged tree, so it passes whatever
the copy lost, and it covers tools/ only. Comparing a full Linux arm64
payload (130,707 entries) takes about 3 s.

The check sees appOutDir, not the AppImage stage or the MSIX file map that
targets build later. Those use the same patched builder-util module in the
same builder process, so a pack whose resource copy kept every entry here
had the copy patch loaded for them too.

Tests: an exact copy passes afterPack, while electron-builder's own copy
without the preload, plus a lost file, a changed size and a stray file,
fails naming each (on the previous commit afterPack resolved). The macOS
and Windows rules accept signing's rewrites and macOS's seals but still
report a lost .gitkeep.

The hook now reads context.packager whenever a payload is packed, so the
Linux relocation test passes the packager electron-builder always supplies.
2026-11-18 11:11:59 -06:00
BearHuddleston
b5a470b7d4 fix(desktop): keep .gitkeep files and empty directories through electron-builder's copies
electron-builder (27.0.0-alpha.6) moves the payload with builder-util, which
loses two classes of entries:

- builder-util dist/fs.js:58: walk() drops every entry named .gitkeep or
  .DS_Store before it consults the caller's filter (line 63).
- builder-util dist/fs.js:225-253: copyDir() creates a directory only when
  it copies a file or symlink into it ("Empty directories is never
  created.").

The payload goes through them at three points after preparation:

- the extraResources copy into resources/agent-payload (app-builder-lib
  dist/fileMatcher.js:462 copyFiles -> copyDir, from platformPackager.js:303),
  on every OS;
- the AppImage target, which copies the whole appOutDir into its squashfs
  stage (dist/targets/linux/appimage/appImageUtil.js:19 and :54, copyDir);
- the MSIX/AppX targets, whose makeappx file map lists appOutDir with walk()
  (dist/targets/win/winAppUtil.js:120).

A Linux arm64 AppImage built at 7b0a2cdbdf lost 6 of 130,707 payload
entries: three empty llama.cpp directories, uv-cache/builds-v0,
contributors/emails/.gitkeep and pnpm's
dist/node_modules/undici/lib/llhttp/.gitkeep. That last file is part of
pnpm's recorded tree digest, so `hermes pm doctor` in the packaged payload
reports "pnpm: realized bytes do not match recorded digest" while the
pre-packaging payload smoke passes. The Nov 10 macOS canary zip lacks the
same .gitkeep.

An extraResources filter cannot help: walk() skips the names before any
filter runs, and no filter makes copyDir create a directory. Restoring the
entries in afterPack fixes only the first copy; a build with such a restore
still shipped an AppImage without them, because the AppImage stage copies
appOutDir again with the same copyDir, and the MSIX file map walks it with
the same walk(). Rehashing digests over the copy would hide the loss.

run-electron-builder.mjs now starts the builder child with
patch-electron-builder-copy.mjs, which rewrites builder-util's fs.js in
memory through a module load hook: walk() keeps the two names, and copyDir()
creates every directory it walks. This follows
patch-electron-builder-mac-binary.mjs, never touches node_modules, and
throws if either needle is missing, so an electron-builder upgrade that
changes this code fails the build instead of silently dropping files.

App files keep excluding .gitkeep and .DS_Store: the `files` matcher
appends electron-builder's default-ignored names to its own patterns
(fileMatcher.js getDefaultIgnoredPatterns), independently of walk().

The preload goes in as a file URL because --import reads a bare Windows
path's drive letter as a URL scheme.

The test launches node with the exact flags runElectronBuilder gives the
builder child, then runs builder-util's copyDir and walk over a fixture
payload. On the base the copy lacks both .gitkeep files, the .DS_Store and
every empty directory.
2026-11-18 11:11:59 -06:00
chloecaffeinexo
04fceafcc3 fix(desktop): mark the prepared icons toolset CommonJS so Node runs the bundled icon-tool.js
electron-builder's bundled icon-tool.js is CommonJS, but the desktop
package.json declares "type":"module", so Node treats the extracted
script as a module and the AppImage packaging step dies with 'require is
not defined in ES module scope' (Linux rebuild failure #132172).

After the icons toolset is copied into the packaged tools output, write a
package.json declaring "type":"commonjs" into that directory only, so
the parent type is overridden for it and Node executes the script as
CommonJS.

Adds prepare-packaging-tools.test.mjs, which reproduces the failure (a
CommonJS script under a "type":"module" tree) and proves the marker
fixes it; red on the base commit, green with the fix.

[BearHuddleston: adapted to main's optional toolsets (9ffa8c63c1): the marker is
written only when the icons toolset is acquired, since an unpacked --dir build
skips it.]

(cherry picked from commit 6fa99e22f69893d6f895bacd63b910258e2dbcd5)
2026-11-18 11:11:47 -06:00
Maciej Lisiewski
a95f462421 fix(pm): bump the pinned Git for Windows 2.53.0.3 -> 2.56.1
2.53.0.3 predates three Git for Windows security releases: 2.56.0.3
(eMudhra CA compromise, Git LFS CVE-2026-105803), 2.56.0.4 (bundled
brotli 1.2.1, CVE-2026-111497, reachable via libcurl's br encoding) and
2.56.1 (git CVE-2026-111760 recursive-clone RCE and five others).
2.56.1 was published 2026-11-10, past the release-age window; its first
build ships as PortableGit-2.56.1-*, which the salvaged fetch_url fix
resolves.

2.56 moved the x64 MSYS2 prefix from mingw64/ to ucrt64/, so the
trampoline self-heal git-core candidates, the non-login bash coreutils
PATH dirs and the desktop bundle-arch PortableGit exemption now also
cover ucrt64 (mingw64 kept for existing installs).

Fixes #148835
2026-11-14 17:07:28 +01:00
Teknium
5ad08e106c test(desktop): run the offline dir-preparation test only where dir skips every download
On Windows a --dir preparation still acquires the signing kit
(winCodeSign), so the "no release host reachable" test cannot pass there
by design. Gate it to POSIX, where dir preparation needs no downloads.
2026-11-09 09:44:28 -08:00
Teknium
9ffa8c63c1 fix(desktop): build the unpacked --dir package without GitHub release assets
The JS and TS checks job packages Desktop with `builder --dir`, and its
preparation step fetched the 7zip and icons toolsets plus the Electron zip
from GitHub releases every run. An unpacked build uses none of them: no
archive target runs 7za, and the committed .icns/.ico pass through without
conversion. When icons@1.2.1/icons-bundle.tar.gz returned 504 for over ten
minutes, main went red on every push.

A dir-only preparation now selects neither toolset and, on the host arch,
copies the lock-verified Electron runtime that electron-runtime.mjs already
unpacked, so it makes no network request. Packaged formats keep the old
acquisition, and admission still refuses a non-dir manifest that lacks
the archive or icon tool.
2026-11-09 09:44:28 -08:00
Maciej Lisiewski
9c1ba8898e test(desktop): pin the dev restage guards
A staged copy that has its binding is left alone, and a dev run never creates one.
2026-11-07 01:46:27 +01:00
Maciej Lisiewski
97038ba5cc fix(desktop): restage a dev dist copy of get-windows left without a binding
window-below.ts loads dist/node_modules/get-windows before node_modules, so
a copy staged by a Windows build whose binding fetch failed kept dev runs
without window enumeration after ensureDevGetWindowsBinding fetched the
binding into node_modules.
2026-11-07 01:43:59 +01:00
Maciej Lisiewski
78aa423d3c test(desktop): run the get-windows platform checks on every host
The darwin validateNativeTree branch only ran on macOS, which CI does not
run tests-js on, and no dev test covered the linux/win32-arm64 skip.

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-07 01:43:59 +01:00
Maciej Lisiewski
0923583198 fix(desktop): hand node-pre-gyp the get-windows mirror under the name it reads
node-pre-gyp 1.0.11 replaces only the first "-" of node-get-windows, so it
reads npm_config_node_get-windows_binary_host_mirror, while npm and
source_build.py export the npmrc key with every "-" as "_". Copy the
documented key to the name it reads unless that one is already set.

Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
2026-11-07 01:43:59 +01:00
Maciej Lisiewski
2a6722075b docs(desktop): name every script that runs dev-get-windows 2026-11-07 01:43:59 +01:00
Maciej Lisiewski
48703cfb29 fix(desktop): bound the dev get-windows binding fetch
node-pre-gyp downloads without a timeout, so on a network that drops
packets every Windows dev start waited out the OS TCP timeout while no
binding was present. Kill the installer after two minutes and start
without window enumeration, as on any other failure.
2026-11-07 01:43:58 +01:00
Maciej Lisiewski
595edede4f fix(desktop): fetch get-windows' win32 binding for dev runs
With its install script denied, a fresh Windows install has no binding in
node_modules, and `pnpm run dev` (which loads that copy until a build stages
one) got upstream's no-op stubs. dev:electron and profile:main* now run the
same node-pre-gyp install stage-native-deps uses, once, and fail soft.
2026-11-07 01:43:58 +01:00
Maciej Lisiewski
3d9dfffb9c docs(desktop): describe get-windows as the build now installs it
The win32 binding comes from the node-pre-gyp run in stage-native-deps, not
a dependency install script, and a skipped optional install is no longer how
get-windows goes missing. The compiler README now says an absent staged copy
is a degraded build.
2026-11-07 01:43:58 +01:00
Maciej Lisiewski
2c378e266d fix(desktop): let the source build go on without get-windows
Moving get-windows to dependencies put it in assert-root-install's required
set, so a half-extracted copy (#90829) failed the source build before
stage-native-deps could degrade and print its repair hint. Bundles skip the
guard and degraded. Exempt it by name.
2026-11-07 01:43:36 +01:00
Maciej Lisiewski
1cd48e3376 fix(desktop): install get-windows on macOS and Linux again
pnpm >= 11.6 infers os: [win32] from the name of an optional dependency
that declares no platform (pnpm/pnpm#17774), so the filtered install in
scripts/build/node-deps.mjs skipped get-windows on darwin and linux. The
macOS build then died in validateNativeTree ("Prepared get-windows is
missing its macOS helper"), and Linux and Nix builds shipped without
read_window_below. packageExtensions cannot override the inference.

Declare it as a regular dependency, which pnpm never platform-filters. Its
install script only fetches the win32 prebuilt and falls back to a node-gyp
build that fails where none exists (win32-arm64); for a regular dependency
that would fail the whole install. So deny the script in allowBuilds:
stage-native-deps already runs node-pre-gyp itself on win32 and degrades
when it fails, and darwin and linux need nothing from it.
2026-11-07 01:43:36 +01:00
Maciej Lisiewski
d62c60787f fix: pnpm review follow-ups in nix, evals, the hang repro and an e2e test
- nix dev shell: pnpm-workspace.yaml (overrides, catalog, allowBuilds)
  joins the package.json stamp, so a settings-only change relocks.
- desktop-pane-fixture: resolve vitest/config from apps/desktop; pnpm
  links it only there.
- short-session hang repro: name the lockfile in the target metadata, so
  an npm-era target fails as a lockfile mismatch rather than a bare hash.
- test_mirrors: the pnpm mirror test prefetches from the registry and
  needs allow_network, like its siblings.
2026-11-06 04:08:46 +01:00
Maciej Lisiewski
29e78b124e docs: pnpm commands for the JS workspaces
READMEs, contributor guides, AGENTS.md files, skills and the website (with
the zh-Hans translations) give pnpm commands for the workspaces; the
website itself is still an npm project.
2026-11-06 04:08:45 +01:00
Maciej Lisiewski
7062229090 chore(js): switch the workspaces from npm to pnpm
pnpm 12.15.0 (native executable) installs every JS workspace from one
pnpm-lock.yaml, imported from package-lock.json with the same resolved
versions. website/, the WhatsApp bridge and the photon sidecar stay separate
npm projects.

Configuration moves from .npmrc and the root manifest into
pnpm-workspace.yaml: the 14-day minimumReleaseAge and its excludes,
overrides, allowBuilds (the old allowScripts set, with strictDepBuilds
failing any unlisted build script), engineStrict, sideEffectsCache: false
(in-place rebuilds must not write into the store) and
verifyDepsBeforeRun: false (a `pnpm run` never installs).

The pnpm version is pinned in pm/lock.json and in root devEngines.
pmOnFail: ignore keeps that pin out of pnpm-lock.yaml: a leading pin
document makes osv-scanner read zero packages. scripts/build/node-deps.mjs
enforces the exact version instead, and every lock reader refuses a
multi-document lock. A root preinstall refuses `npm install`; devEngines
onFail is warn so npx (MCP servers, the tsc linter) keeps working inside
the checkout.

User-machine installs run --frozen-lockfile --trust-lockfile (release age is
checked when locking, in CI, not per user). node-deps removes npm-era
node_modules trees before the first pnpm install. Nix builds the store with
fetchPnpmDeps and a hash file that CI checks.
2026-11-06 04:08:24 +01:00
Maciej Lisiewski
9f9b9f54a1 fix: review follow-ups for the workspace dependency moves
- The MCP OAuth renderer probe bundled its entry with esbuild resolving from
  the checkout root, so its react, react-dom and react-query imports still
  relied on hoisting. Resolve them from apps/desktop, which declares them
  (verified: from the root they fail to resolve in an isolated pnpm tree).
- The Windows MSIX commit fixture linked node_modules before `git add apps`,
  so the commit could pick up the dependency link. Link the install trees
  after the commit, which needs only the fixture's own files.
2026-11-05 14:08:26 -08:00
Maciej Lisiewski
c2a0ecc734 fix: resolve electron, vite and playwright from the workspaces that declare them
Scripts outside the declaring workspace found these through the hoisted root node_modules:
mock-server and connector-rehearsal (whose desktop-local Electron path did not exist under npm),
ui-tui's visual harness, the eval harnesses, and the tests/install/e2e-assets drivers, which import
tests-js's @playwright/test and zod. They now resolve from apps/desktop or tests-js; the typed
e2e-assets files go through a tests-js re-export module so their types resolve the same way.
2026-11-05 14:08:26 -08:00
Maciej Lisiewski
99306b4b01 fix(desktop): resolve app-builder-lib and node_modules through module resolution
Packaging scripts and tests reached app-builder-lib's internals as ../../../node_modules/..., and
test fixtures junctioned only the repo-root node_modules, both of which assume npm hoists every
package to the root. The internals are now joined onto the installed package's resolved entry (the
pattern windows-bundle-tools.mjs already uses), AppInfo comes from the package's public entry, and
fixtures mirror both the root and apps/desktop node_modules, so the copied desktop files resolve
their dependencies exactly as the checkout does. gen-msix-manifest output is byte-identical.
2026-11-05 14:08:26 -08:00
BearHuddleston
9dd1ea34f2 refactor(desktop): one retry schedule and one timeout fixture
The missing-ticket retries used their own delay table, which matched
the first five lost-contact pauses. They now call contactDelay(), with
a limit of five. A ticket that never propagates still gets 6 staples,
the same pauses (15, 30, 60, 120 and 120 s) and the same error.

The LOST_CONTACT comment now says which codes point at the runner's own
network (-1003, -1004, -1006, -1009) rather than at Apple.

The older resume test's local `timeoutOutput` copied `notaryTimeout`,
apart from `_kCFStreamErrorDomainKey` (1 rather than 4, the value in
the canary log). The test now uses `notaryTimeout`.
2026-11-03 20:04:19 +00:00
BearHuddleston
23ca14a28e fix(desktop): give lost contact while stapling a 45-minute window
Stapling starts only after Apple has accepted the app. Until now a
dropped connection there could retry for whatever was left of the
four-hour notarization budget, holding the runner for hours on a
network path that main gave up on within a minute. The host-unreachable
codes (-1003, -1004, -1009) usually mean the runner's own network is
broken, not that Apple is down.

Lost contact while stapling now retries for up to 45 minutes, or for
what is left of the notarization budget when that is shorter. 45
minutes is about twice the outage the 2026-11-03 canary ran into. The
wait for Apple's verdict keeps the full budget.

The staple loop also checks LOST_CONTACT before it counts a retry. A
ticket that is still missing after its five retries now throws inside
its own branch, instead of falling through to the lost-contact check.

The outage test now covers both limits, an acceptance at t=0 and one
10 minutes before the budget ends. It fails on the previous head, which
retried for about 4 h, and the second case fails if the Math.min is
removed.
2026-11-03 20:03:29 +00:00
BearHuddleston
2941c7fe66 fix(desktop): keep notarizing through dropped connections to Apple
The 2026-11-03 canary (desktop run 41591721476) signed both macOS
builds, and Apple accepted the arm64 submission, but both builds failed
in this hook on network errors it does not retry:

- arm64: `stapler staple` exited 68 with NSURLErrorDomain Code=-1005
  "The network connection was lost." from api.apple-cloudkit.com. Only
  the exit-65 missing-ticket case was retried.
- x64: `notarytool wait` timed out (Code=-1001) at 07:22, 07:24, 07:27
  and 07:38 UTC. Resuming stopped after three pauses (15, 30 and 60 s),
  although the notarization budget is four hours.

Treat NSURLError timeouts, lost connections and unreachable hosts
(-1001, -1003, -1004, -1005, -1006, -1009) as lost contact in both
loops. Keep resuming the same submission, and retrying the staple, with
pauses capped at 120 s until the next pause would cross the existing
four-hour budget. A ticket that has not propagated yet keeps its own
five retries. Verdicts, authentication failures and other stapler
errors still fail at once.
2026-11-03 13:37:20 +00:00
Teknium
717447e421 fix(desktop): the bundle arch audit admits sounddevice's bundled PortAudio builds
sounddevice 0.5.6 (741357733f) ships all three Windows PortAudio DLLs
(32bit, 64bit, arm64, each with an -asio twin) inside every per-arch Windows
wheel; 0.5.5's win_amd64 wheel carried only the 64-bit pair. sounddevice.py
picks the DLL matching the interpreter (`sysconfig.get_platform()` arm64 or
`platform.architecture()`), so the foreign builds are inert, like discord.py's
paired opus DLLs. With the MakeAppx fix in place the signed Windows build got
past packaging and failed `Audit bundle architecture` on these 4 DLLs on both
win32-x64 and win32-arm64 (proof run 41414573197). Exempt exactly those names.
2026-11-02 02:02:44 -08:00
unsupportedpastels
51c8cba024 perf(docker): cache the Webapp's dependency install in its own layer
The webapp_build stage copied all of apps/ before running the recipe, so
any Desktop source change reran npm ci. build-webapp.mjs gains
`--deps-only` (prepareWebappWorkspace), and the stage runs it after
copying only the manifests and the recipe. The build after `COPY apps/`
reuses that install through the node-deps receipt.
2026-10-27 09:42:22 -04:00
unsupportedpastels
3883e02935 perf(webapp): build the browser bundle without downloading Electron
The Webapp recipe installs Desktop's workspace, and node-deps prepared
Electron's binary for any install that selects apps/desktop. The browser
bundle never runs Electron, so prepareNodeDependencies now takes
`electron: false` and build-webapp.mjs passes it. Desktop builds keep the
default.
2026-10-27 09:42:22 -04:00
Teknium
d49e2ebbae test(desktop): say the drain also keeps late-closing probes out of the live check 2026-10-26 08:09:46 -07:00
Teknium
e4bc96b813 test(desktop): the signing probe's EIO case can no longer lose its fault to the previous walk
The errors probe faults the first fs.promises.open of each case with a
one-shot flag. A walk that rejects leaves the rest of its Promise.all
running, and on a loaded runner one of the EACCES walk's lstat callbacks
lands after the follow-up walk has finished. That straggler then makes
the first open under the EIO injector, takes the read fault, and the EIO
walk resolves cleanly: "Missing expected rejection" (main run
40322485575).

Each case now counts the failed walk's opens and waits until every file
has opened and closed before the next fault is armed, so the fault can
only reach the walk under test. The same wait keeps the EIO walk's
late-closing stragglers out of the concurrent walks' live/peak check.
2026-10-26 08:09:46 -07:00
emozilla
1eb4669e8d test(webapp): check every smoke viewport in the tab the launch link signed in
The browser smoke opened a new tab for each of its four viewports and loaded the same input URL in
each. That URL is usually the one-use launch link `hermes webapp --no-open` prints, and the Webapp
keeps the grant the link buys in the sessionStorage of the tab that spent it. The first tab spent
the ticket, the second stopped at "This launch link was already used or has expired", and the smoke
failed on a Webapp that worked.

All viewports now run in one tab. The first loads the input URL; each later one resizes the tab,
leaves the previous page for about:blank and reopens the address the first one landed on, so the
tab's grant signs it in. Every viewport still gets a fresh page load and the same checks; console
errors, page errors and failed requests are counted against the load that caused them, and the HTTP
status is read for the address that load requested. The mobile browser-controls override is reset
before each load, since it now outlives its page.
2026-10-25 03:22:31 -07:00
emozilla
a3d93b428b test(webapp): fail the smoke run on the startup failure and sign-in screens
The smoke script looked only for 'Desktop boot failed', so a Webapp showing 'Hermes couldn't
start' or the sign-in view passed. It reads both titles from en_boot.ts and fails naming the
screen.
2026-10-25 03:22:20 -07:00
emozilla
f0fe081b95 test(webapp): drive the gateway-served Webapp end to end
The e2e spec starts the gateway through hermes webapp, runs a turn from a
real browser, keeps the tab signed in across a gateway restart, and checks
that sign-out cuts it off. The smoke script targets the Webapp's port.

Co-authored-by: Bear Huddleston <bear@bearhuddleston.dev>
2026-10-25 03:22:17 -07:00
Bear Huddleston
7ac4cf552c feat(desktop): carry the browser host renderer from #93508
Carried from BearHuddleston's #93508: the browser bridge and transport,
launch-session handling, touch and phone layout, browser previews, file
staging, the host terminal rail, Webapp settings pages and media ticket
renewal. Relay-only and fence-only code stays out.

Co-authored-by: emozilla <emozilla@nousresearch.com>
2026-10-25 03:22:15 -07:00
Teknium
16d2221a50 refactor(desktop): drop /browser use, Browser Use mode status and agent-browser bundle exemption
browser_exec is the only browser path: the browser.manage RPC 'use' action and
browser.backend are gone, Camofox moved to a catalog plugin and agent-browser is
no longer bundled. Toolset panel tests use still-valid provider rows.
2026-10-23 01:41:25 -07:00
ethernet
92e0717a3a perf(desktop): reuse Developer ID signatures for loose macOS payload binaries
osx-sign spends 2.1-3.3 min per mac leg running one codesign call for each of
610-836 payload binaries (run 39214394169), and only 321 of 837 arm64 names
are distinct: most Python extensions sit three times in the payload (venv,
uv wheels, uv archive). None of it is cached, unlike Windows' Authenticode
signatures (payload-sign-cache.mjs).

createMacSigner now signs loose payload Mach-O itself before osx-sign runs,
through a cache modelled on the Windows one:
- key: the unsigned bytes and file name (codesign derives the identifier
  from the name), under a policy hash of the identity, team, flags and
  inherited entitlements; the per-job keychain path is not part of it;
- codesign's embedded signature carries a secure timestamp, so the signed
  bytes are stored, and every restored file must pass codesign --verify
  --strict with this team's Developer ID, a timestamp and the hardened
  runtime before it replaces the unsigned one;
- each distinct input is signed once (bounded concurrency) and copied to
  its duplicates; files inside nested bundles and the app executable are
  left to osx-sign, which still seals every bundle and the app.

The darwin legs restore the cache before building and save it only after
the notarized-app verification passes, on release runs. The mac runners are
GitHub-hosted, so it lands in the repo's GitHub cache store; commit builds
hold a read-only cache token.

Inject the typed app-signing function into the cache integration tests instead of
mocking its module. Exercise cold and warm reuse and refuse outer sealing after
cache verification fails; preserve the production lazy import and native skips.
2026-10-20 15:50:30 -04:00
Teknium
91e27b6c09 fix(desktop-build): npm run builder -- --win --x64 can stage its per-target native deps
`npm run builder` with an arch flag stages native deps into
apps/desktop/build/native-deps-<platform>-<arch>
(scripts/run-electron-builder.mjs). The product guard in
scripts/build/frontend-common.mjs accepted only apps/desktop/build/native-deps
as a generated destination in the tree, so every source build with an
explicit arch died before staging:

  Error: Output must be outside source or in a supported generated
  destination: ...\apps\desktop\build\native-deps-win32-x64

Seen on blacksmith-32vcpu-windows-2025 packaging the Desktop for the W3
attach lane (run 39053936919, `npm run builder -- --dir --publish never
--win --x64`). The guard now also accepts exactly
native-deps-(darwin|linux|win32)-(x64|arm64) under apps/desktop/build.
A nested path below one, or another platform/arch, is still refused.

Red -> green: run-electron-builder.test.mjs "source multiarch ..." now
asserts each per-target --out it hands stage-native-deps.mjs passes
productOutput (red on main: "Output must be outside source ..." for
native-deps-darwin-x64). product-builders.test.mjs gains the accepted and
refused per-target names (10 passed).

Refs #134889 (W3)
Refs #140337
2026-10-17 11:33:15 -07:00
alt-glitch
303b70f75b chore(release): retire HERMES_GUEST_ONBOARDING from bundles, build tooling and the updater
The Microsoft Store variant forced HERMES_GUEST_ONBOARDING=1 into its bundle env,
and commit/channel builds could bake it with --bundle-env. Nothing reads it now.

- scripts/bundles/desktop_inputs.py: the Store bundle env is just the request's.
- bundle_env.py / bundle-env.mjs: the key is no longer allowed for new builds.
- channel-protocol.ts: the key moves to RETIRED_BUNDLE_ENV_KEYS, so preview
  manifests already published with it still decode (the HERMES_SKIP_INTRO
  precedent).
- BUILDING.md example uses HERMES_PREVIEW_FULL_CONNECTORS.
- Build tests use another allowed key as their sample; both validators reject the
  retired key and the decoder drops it.
- msix-virtualization.test.mjs: every generated MSIX manifest (store, release,
  canary, channel) keeps filesystem and registry write virtualisation disabled,
  and the builder config declares unvirtualizedResources. The machine marker and
  the shared %LOCALAPPDATA%\hermes root depend on that.
2026-10-14 00:32:21 +05:30
alt-glitch
528e42c51a refactor(desktop): delete the guest-onboarding launch flag; add the dev --fresh-install switch
The desktop read HERMES_GUEST_ONBOARDING (or --guest-onboarding) once, sent it
to the renderer, forced it onto every local backend spawn and prepended it to
the POSIX SSH spawn. The backend now decides everything itself, so all of that
goes: guest-onboarding.ts (the GATEWAY_ON_ALL_ADAPTERS_DOWN part moves to
backend-spawn-env.ts), the feature-flag field, preload/global.d.ts, and
lib/onboarding-enabled.ts.

Its consumers follow the onboarding run instead: the demo layout and window
sizing are always available (they only act while an onboarding run is open),
Settings shows "Run onboarding again" on every build, and the transcript always
uses the multi-directive parser. Every paragraph the legacy parser rendered (one
`::name{...}` line alone) parses to the same name, attrs and source; the new
parser also renders directives embedded in prose.

Dev switch: an unpackaged app started with --fresh-install sends
assume_fresh on onboarding.state and on a new onboarding.start, so a used
machine can rehearse a first install. Packaged builds always send false.
2026-10-14 00:32:21 +05:30
kshitijk4poor
d2cbfcf7db test(desktop): the React Compiler cache is its own module with focused tests
The cache lived inline in vite.config.ts, and the renderer builder tests use a bare fixture
config, so nothing exercised it: a broken warm path would still pass every test.

Move it to scripts/compiler-cache.mjs (behaviour unchanged; toolchain files and cache root are
now parameters, and an existing closeBundle hook is chained instead of replaced) and test hit
vs fresh output, toolchain/NODE_ENV generations, corrupt entries, pruning, incremental (watch)
rebuilds and the dev-server bypass. A cold and warm production build of the real app stay
byte-identical. Reported by Greptile on #135092.
2026-10-08 15:20:58 -07:00
kshitijk4poor
1f6d8b6ba8 fix(desktop): a node-pty layout without its macOS spawn-helper is an incomplete native tree
nativeTreeComplete decides whether a later build may skip restaging, but never looked at
node-pty. A partially extracted package with pty.node and no spawn-helper was recorded
complete; repairing the installed package without a lockfile change then left the staged
copy broken, and every later build shipped a terminal that fails on its first spawn.

Check the layout node-pty itself loads (build/Release, build/Debug, then prebuilds, as in
lib/utils.js) for a binding, and on macOS for the spawn-helper beside it (lib/unixTerminal.js).
Reported by Greptile on #135092.
2026-10-08 15:20:58 -07:00
kshitijk4poor
3fc37481eb refactor(desktop): one receipt reader, one output list, no native double copy on renderer reuse
rendererCurrent and productCurrent share hostReceipt() for the schema/product/host checks. The stamped outputs come from bundleElectronMain's own electronOutputs list, so a renamed or added bundle can never be copied stale from the previous dist. The reuse copy skips node_modules/ and native/, which copyNativeTree recopies from nativeDeps right after, and a --typecheck build never reuses a renderer that skipped tsc.
2026-10-08 15:20:58 -07:00
kshitijk4poor
136a4282bb fix(desktop): an incomplete native tree restages on every build
Skipping stage-native-deps on an admitted receipt kept a tree staged without a piece forever:
get-windows (or its win32 x64 binding, which only the native installer inside staging can fetch),
the macOS get-windows helper, or the host HUD helper (no X11 toolchain on Linux). The receipt
identity cannot see the host fix that would complete it.

The receipt now records `degraded` from the staged tree itself (nativeTreeComplete: every piece
this host can produce for the target is present), and build.mjs reuses only a complete one
(nativeInputsComplete). Gaps no host fix closes — win32-arm64 has no get-windows prebuild, a
cross-target pack never builds the helpers — do not count. Judging the tree rather than each
builder's return value covers soft-fail paths that still return a path (the win32 binding).
2026-10-08 15:20:58 -07:00
kshitijk4poor
97260490e1 perf(desktop): skip restaging native inputs whose receipt still matches 2026-10-08 15:20:58 -07:00
kshitijk4poor
1d41d9f610 fix(desktop): native helpers build byte-identical, so the prepared native input stays comparable 2026-10-08 15:20:58 -07:00
Maciej Lisiewski
d76cce4f11 ci: apply all automatic linter fixes available 2026-10-08 17:22:54 +02:00