Skip to content

ci(desktop): boot the packaged cloud and enterprise flavors on a fresh profile - #4696

Merged
yomgui merged 2 commits into
devfrom
ci/packaged-first-launch-gate
Sep 9, 2026
Merged

yomgui merged 2 commits into
devfrom
ci/packaged-first-launch-gate

Conversation

@yomgui

@yomgui yomgui commented Sep 9, 2026

Copy link
Copy Markdown
Member

Problem

The cloud and enterprise desktop artifacts render a gate above the routes on first launch (sign-in, or "Link this app to your organization"). That code path never ran in CI: packaged-smoke.mjs booted only the public flavor, and the enterprise gate was covered by readFileSync(...).toContain(...) assertions on source text.

0.18.43 and 0.18.44 shipped with DesktopUpdaterProvider (#4482) reading Local and DesktopConfig contexts that the pre-activation branch of EnterpriseAwareAppProviders never mounted. Every fresh self-hosted install (Airwallex report, 2026-09-09) opened to a blank window with Error: Local context is missing. Our telemetry cannot see this by design (Sentry only sends after sign-in), so CI is the only place it can be caught.

What this PR does

  1. Carries the fix from fix(app): render the enterprise activation gate instead of a white screen #4606 (author preserved, @tianlinzx). Fork PRs cannot receive Warden clearance, and the gate below is red on dev without the fix, so they land together. This gives the fix the runtime proof AGENTS.md requires.
  2. New journey packaged-first-launch.e2e.test.ts with world evals/worlds/packaged-first-launch.ts: boots the packaged binary on a fresh profile (no bootstrap, no activation), attaches without the signed-in readiness gate, opens a second CDP session for Runtime.exceptionThrown, and asserts the flavor's gate heading is mounted in #root with zero synchronous render crashes (unhandled promise rejections are recorded, not gating; the pre-activation openwork:desktop IPC rejection predates this and is harmless).
  3. packaged-smoke.mjs now packages electron-builder.enterprise.yml and electron-builder.cloud.yml and boots each through that journey, in the same openwork-tests-build step that already blocks merges. No workflow file changes; package ≈ 9 s and boot ≈ 10 s per flavor on the warm runner.
  4. Registers the journey in journey-catalog.mjs with placement: local (only packaged-smoke has the binaries).

Proof (local lane, macOS arm64)

Binary under test Result
Shipped openwork-enterprise-mac-arm64-0.18.44 Failed in 12 s: a provider context was missing during first launch … Error: Local context is missing at Sb (app-DqZb8wH-.js:1082)
Shipped openwork-enterprise-mac-arm64-0.18.42 Passed (10.2 s)
This branch, electron-builder.enterprise.yml --mac --dir Passed (10.1 s)
This branch, electron-builder.cloud.yml --mac --dir Passed (6.1 s)

Commands:

OPENWORK_EVAL_ELECTRON_BINARY="<app>/Contents/MacOS/<exe>" OPENWORK_EVAL_ELECTRON_RESOURCES_PREPARED=1 \
OPENWORK_EVAL_ENGINE=v1 OPENWORK_EVAL_SURFACES_DIR=/tmp/profiles pnpm evals:e2e packaged-first-launch --local

Also: apps/app bun test src/react-app/shell/providers.test.tsx tests/enterprise-activation.test.ts 11 pass (the new unit test fails when providers.tsx is reverted to dev); evals typecheck, lint:layers, channel and boundary ratchets report nothing for the new files (remaining findings are pre-existing on dev); node --test evals/scripts/journey-ci.test.mjs 12 pass.

The Linux packaged-smoke lane runs in this PR's openwork-tests-build job and is the authoritative evidence.

Follow-ups (not in this PR)

  • Root error boundary so a render throw shows a recovery screen instead of an empty window (fix(app): show a recovery screen instead of a blank window when a render throws #3402, being revived separately).
  • Collapse the two provider trees in EnterpriseAwareAppProviders so AppRoot-level consumers cannot depend on a branch they cannot see.
  • Replace the remaining source-string assertions in apps/app/tests/enterprise-activation.test.ts with render tests.

Closes #4606.

tianlinzx and others added 2 commits September 9, 2026 16:23
…reen

Since #4482 mounted DesktopUpdaterProvider at the outermost AppRoot
layer, its useUpdater() hook reads the Local and DesktopConfig contexts
during render. The pre-activation branch of EnterpriseAwareAppProviders
(#3185) mounts neither, so an enterprise build crashed with "Local
context is missing" (then "useDesktopConfig must be used within a
DesktopConfigProvider") before the activation gate could render — a
blank window on first launch of an unactivated install, with no
ErrorBoundary to recover.

Mount DesktopConfigProvider and LocalProvider in the pre-activation
branch so AppRoot-level consumers keep working; ConnectLinkProvider
stays outermost so the branded connect-link consumer keeps its place.

Tested with a behaviour test that renders the real DesktopUpdaterProvider
inside the pre-activation branch (TDD: watched it fail with both crash
messages before the fix), and updated the providers source-shape
assertion in tests/enterprise-activation.test.ts to the new contract.
Full apps/app suite: no new failures against the pre-change baseline.
…h profile

The cloud and enterprise artifacts render a gate above the routes on first
launch. That path never ran in CI: packaged-smoke booted only the public
flavor, and the enterprise gate was checked by source-string assertions.
0.18.43 and 0.18.44 shipped with the enterprise gate throwing
"Local context is missing" during render, so every fresh self-hosted
install opened to a blank window.

packaged-smoke now packages electron-builder.enterprise.yml and
electron-builder.cloud.yml and boots each on a fresh profile through the
new packaged-first-launch journey. The world attaches without the
signed-in readiness gate and records Runtime.exceptionThrown from a
second CDP session so boot-time render crashes fail the run by name.

Against the shipped 0.18.44 enterprise build this spec fails in seconds
naming the crash; against 0.18.42 and against dev with #4606 it passes.
@vercel

vercel Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openwork-app Ready Ready Preview Sep 9, 2026 8:35pm UTC
openwork-den Ready Ready Preview Sep 9, 2026 8:35pm UTC
openwork-diagnostics Ready Ready Preview Sep 9, 2026 8:35pm UTC
openwork-landing Ready Ready Preview, v0 Sep 9, 2026 8:35pm UTC

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Warden review summary — Clear

Native findings: 0. Blocking policy matches before consolidation: 0. Full finding text remains in Warden's native checks and review threads. This comment retains only native IDs, severity, skill attribution, and safe locations. Analysis run

Reported trigger coverage (not proof of complete repository or context coverage): diff-security-review (25692 ms), confidentiality-review (44540 ms), spec-provenance-review (68923 ms), desktop-den-sync-review (51119 ms).

Blockers

  • None.

Advisories

  • None.

Needs recheck

  • None.

Observed review-thread metrics

  • Unique observed run attempts in retained window: 1
  • Distinct heads in retained window: 1
  • Current unresolved Warden threads: 0 of 0 observed
  • Observed resolved/unresolved transitions in retained snapshots: 0 / 0
  • First observed resolved/unresolved (state at first collection, not event time): 0 / 0
  • Precision: unavailable (no adjudications; no TP/FP values are inferred)
  • Observation window: 1/20 run attempts retained; truncated: false
  • Transition snapshot: 0/0 current attributed threads retained (limit 500); truncated: false

Thread states are read-only collection snapshots. These metrics are neither lifetime totals nor exact resolution times, and this summary is not clearance authority.

@diff-warden diff-warden Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (647e71866cd1f3fdd13efc0b926858bc70b2b33f). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Passed · 3/3 tests · 4/4 assertions · 2 images

Commit 647e71866cd1f3fdd13efc0b926858bc70b2b33f · selected evidence

Open review report

@yomgui
yomgui merged commit 5858b51 into dev Sep 9, 2026
27 checks passed
yomgui added a commit that referenced this pull request Sep 9, 2026
…catches the crash (#4699)

#4697 mounted a root error boundary, so a first-launch render crash now
renders "OpenWork hit an unexpected error" instead of unmounting the tree.
React reports caught errors through console.error, not
Runtime.exceptionThrown, so packaged-first-launch no longer stopped on the
crash: it waited the full 60 s for the gate heading and failed with a
timeout whose message buried the cause in the last-value dump.

Treat the recovery heading as a terminal state, assert it is absent by
name, and check for it instead of the stale "Something went wrong" text.

Local lane, macOS arm64, electron-builder.enterprise.yml --mac --dir:
- dev: passed (11.2 s)
- dev with providers.tsx reverted to pre-#4696: failed in 8.0 s,
  "the root error boundary caught a first-launch render crash ...
  Local context is missing" (before this change: failed after 65.8 s
  with "Timed out waiting for enterprise first-launch gate")
yomgui added a commit that referenced this pull request Sep 10, 2026
* fix(desktop): keep the updater inert until enterprise activation

Since #4482 the updater provider mounts above the enterprise activation gate,
and #4606/#4696 made the contexts it needs available there. A fresh enterprise
install therefore checked the enterprise release feed and started staging the
newest release within ~2 s of first launch, before any Den (and so any
allowed-versions policy) was known.

Renderer: automatic and menu-requested checks wait until activation is complete
and the desktop config has resolved once, so the first check already honours
allowedDesktopVersions. Main process: openwork:updater:check/download/
installAndRestart reject through assertDesktopActivation while activation is
required, so no renderer path can reach electron-updater early.

Proof: unit test for the IPC guard, and the packaged-preactivation-updater
journey (red on the unfixed enterprise build, green after) wired into the
packaged smoke gate.

* test(evals): count electron-updater's AppImage refusal as a check attempt

On the unpacked Linux directory the packaged smoke gate boots, electron-updater
answers checkForUpdates() with "APPIMAGE env is not defined" instead of
"Checking for update", so the positive control never saw the attempt in CI.
yomgui added a commit that referenced this pull request Sep 10, 2026
EnterpriseAwareAppProviders forked into two trees: a reduced pre-activation
tree and the full tree after activation. AppRoot-level consumers could not see
which branch they rendered under, which is how #4606/#4696's "Local context is
missing" blank window shipped in 0.18.43-0.18.44.

Mount the full tree unconditionally. DesktopRuntimeBoot,
BrowserLoginSyncAccessBridge, AutomationRunnerBridge and
GlobalQueueDrainerBridge now gate themselves on
useEnterpriseActivationRequired(): they render nothing and run no effects until
Den activation completes, so no privileged runtime work starts early and the
providers above the children never remount when activation lands.
DesktopUpdaterProvider keeps its updatePolicyKnown guard.

Move providers.test.tsx under apps/app/tests so the app test script actually
runs it, and extend it: pre-activation render still supplies the updater
contexts, none of the gated bridges runs before activation (no boot or
Automation-runner IPC, no queue drainer, no browser-login observation), all of
them run after activation in the same mounted tree, and the providers above the
children mount exactly once across the transition. Replace the source-slicing
assertion in enterprise-activation.test.ts that depended on the removed branch.

This branch was successfully deployed

4 active deployments
Preview – openwork-landing — 647e7186 Deployed Sep 9, 2026 by vercel[bot]
Preview – openwork-app — 647e7186 Deployed Sep 9, 2026 by vercel[bot]
Preview – openwork-den — 647e7186 Deployed Sep 9, 2026 by vercel[bot]
Preview – openwork-diagnostics — 647e7186 Deployed Sep 9, 2026 by vercel[bot]
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