Skip to content

fix(app): mount one provider tree across enterprise activation - #4805

Merged
yomgui merged 1 commit into
devfrom
fix/single-provider-tree
Sep 10, 2026
Merged

yomgui merged 1 commit into
devfrom
fix/single-provider-tree

Conversation

@yomgui

@yomgui yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member

Problem

EnterpriseAwareAppProviders forked into two provider trees: a reduced one before Den activation (ConnectLink → DesktopConfig → Local) and the full one after. AppRoot-level consumers cannot see which branch they render under, which is how DesktopUpdaterProvider (#4482) ended up reading contexts the pre-activation branch never mounted and 0.18.43–0.18.44 opened to a blank window with Error: Local context is missing (#4606, carried by #4696). #4696 listed collapsing the two trees as a follow-up; this is that follow-up.

What this PR does

  • One tree, unconditionally. EnterpriseAwareAppProviders always mounts the full tree (DesktopRuntimeBoot, ConnectLink, DesktopConfig, BrowserLoginSyncAccessBridge, BrandTheme, RestrictionNotice, Local, AutomationRunnerBridge, GlobalQueueDrainerBridge, ReloadCoordinator, Toaster). The useEnterpriseActivationRequired import leaves providers.tsx.
  • Bridges self-gate. DesktopRuntimeBoot, BrowserLoginSyncAccessBridge, AutomationRunnerBridge and GlobalQueueDrainerBridge each return null while useEnterpriseActivationRequired() is true and only mount their effect-bearing inner component after activation, so no runtime boot, Automation-runner registration, queue draining or browser-login observation starts before Den activation, and nothing above the children remounts when activation lands.
  • Unchanged: DesktopUpdaterProvider's updatePolicyKnown guard (!useEnterpriseActivationRequired() && !desktopConfig.loading), the EnterpriseActivationGate in AppRoot, and the pre-activation crash fix from fix(app): render the enterprise activation gate instead of a white screen #4606/ci(desktop): boot the packaged cloud and enterprise flavors on a fresh profile #4696 (the contexts it needed are now never forked away).
  • Tests. providers.test.tsx moves from apps/app/src/react-app/shell/ to apps/app/tests/ so pnpm --filter @openwork/app test (bun test --isolate tests/) actually runs it, and is extended with a happy-dom render of the production nesting (BootState → Server → DenAuth → EnterpriseAwareAppProviders) that asserts: pre-activation render succeeds with the updater consumer; none of the gated bridges runs before activation (no workspaceBootstrap/runtimeBootstrap/openworkServerRestart/engineStart/automationRunnerConfigure IPC, startGlobalQueueDrainer not called, browser-login store untouched, boot phase idle); after an activated bootstrap snapshot + Den settings event, all four bridges run in the same root and the providers above the children mounted exactly once. The source-slicing assertion in enterprise-activation.test.ts that depended on the removed branch now asserts the fork is gone and the three providers are present.

Proof (local lane, macOS arm64, head cfe5144e5)

Lane: local. Daytona was not used: no Daytona credentials in this environment, and the packaged journeys are catalogued placement: local (only packaged-smoke provides the binaries).

Unit + types (apps/app):

Command Result
bun test --isolate tests/providers.test.tsx tests/enterprise-activation.test.ts tests/automation-availability.test.ts 21 pass, 0 fail
pnpm typecheck (tsc -p tsconfig.json --noEmit) exit 0
pnpm --filter @openwork/app test 1592 pass, 20 fail — the same 20 (message-list, command-palette-settings, app-mentions, prompt-file-parts, tool-error-attribution-ui, composer-editable-on-snapshot-error, managed-brand-header, message-list-step-fold) fail identically on clean origin/dev e925c7c99 with this change stashed: bun test --isolate <those 8 files> → 31 pass, 20 fail. Pre-existing, unrelated to this diff.

E2E against --mac --dir artifacts built from this head (node apps/desktop/scripts/electron-build.mjs, then electron-builder --config electron-builder.enterprise.yml --mac --dir --publish never and electron-builder.yml --mac --dir, CSC_IDENTITY_AUTO_DISCOVERY=false):

Journey Binary Result
pnpm evals:e2e packaged-first-launch --local enterprise 1 passed, exit 0 (gate mounted, 0 context crashes, 0 render crashes)
pnpm evals:e2e packaged-preactivation-updater --local enterprise 2 passed, exit 0 (unactivated: 0 update checks/downloads; activated: still checks)
pnpm evals:e2e packaged-activated-launch --local enterprise 1 passed, exit 0 (activated install boots past the gate, no render crash)
pnpm evals:e2e app-smoke --local public 1 passed, exit 0

Env for every journey: OPENWORK_EVAL_ELECTRON_BINARY="<app>/Contents/MacOS/<exe>" OPENWORK_EVAL_ELECTRON_RESOURCES_PREPARED=1 OPENWORK_EVAL_ENGINE=v1 OPENWORK_EVAL_SURFACES_DIR=/tmp/ow-provider-tree-profiles. No skips. Test-evidence sections for each run are in the sticky comment below.

Verdict: Passed.

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.
@vercel

vercel Bot commented Sep 10, 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 10, 2026 4:09pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
openwork-den Skipped Skipped Sep 10, 2026 4:09pm UTC
openwork-diagnostics Skipped Skipped Sep 10, 2026 4:09pm UTC
openwork-landing Skipped Skipped v0 Sep 10, 2026 4:09pm UTC

@github-actions

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 (69520 ms), confidentiality-review (66787 ms), desktop-den-sync-review (98326 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 (cfe5144e58565ec94ee8c9388fc249178e0f858f). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run

@yomgui

yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

Test evidence — a packaged flavor renders its first-launch gate without a render crash — ✅ passed

SHA cfe5144 · engine v1

✅ 0/1 screenshots passed · 1 assertion · 1 expectations passed · 0 failed · 0 pending

Published from the local lane as a standalone evidence comment (the legacy single-run publisher holds one run in the sticky comment; the private review store token is not available locally). Screenshots for this run are in the source test-run directory named below; they are not attached here.

[probe] eventually(packaged distribution flavor) · eventually(enterprise first-launch gate mounted in #root)
[user] see(text=Link this app to your organization) · notSee(text=/OpenWork hit an unexpected error/) · screenshot
verdict passed · 3 user observations (see ×1, notSee ×1, screenshot ×1) · 2 probes · steps 0/0

ℹ️ ASSERTION — 1. The enterprise desktop mounts "Link this app to your organization" on first launch without a render crash or an unexpected unhandled rejection

#root text: "OpenWork Enterprise\nLink this app to your organization\n\nEnter your workspace address — the page where you downloaded this app. Sign-in finishes in your browser and returns here.\n\nWorkspace address\nCon"; render crashes: 0; allowlisted rejections: 0 of 0 known; unexpected rejections: 0

  • ✅ PASS The enterprise desktop mounts "Link this app to your organization" on first launch without a render crash or an unexpected unhandled rejection — #root text: "OpenWork Enterprise\nLink this app to your organization\n\nEnter your workspace address — the page where you downloaded this app. Sign-in finishes in your browser and returns here.\n\nWorkspace address\nCon"; render crashes: 0; allowlisted rejections: 0 of 0 known; unexpected rejections: 0

⚪ UNVALIDATED — 2. a packaged flavor renders its first-launch gate without a render crash artifact 1

  • ⚪ UNVALIDATED — no visual expectations recorded.

Test run created 2026-09-10T16:07:11.855Z · Source: evals/results/test-runs/2026-09-10T16-07-11-855Z-a-packaged-flavor-renders-its-first-launch-gate-without-a-render-crash/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4805 --test-run 2026-09-10T16-07-11-855Z-a-packaged-flavor-renders-its-first-launch-gate-without-a-render-crash

@yomgui

yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

Test evidence — an unactivated enterprise install does not check for or download updates — ✅ passed

SHA cfe5144 · engine v1

✅ 0/1 screenshots passed · 1 assertion · 1 expectations passed · 0 failed · 0 pending

Published from the local lane as a standalone evidence comment (the legacy single-run publisher holds one run in the sticky comment; the private review store token is not available locally). Screenshots for this run are in the source test-run directory named below; they are not attached here.

[probe] eventually(packaged distribution flavor) · eventually(enterprise activation gate mounted in #root)
[user] see(text=Link this app to your organization)
[probe] eventually(updater activity before activation)
[user] see(text=Link this app to your organization) · screenshot
verdict passed · 3 user observations (see ×2, screenshot ×1) · 3 probes · steps 0/0

ℹ️ ASSERTION — 1. An unactivated enterprise install starts no update check or download within 20s of showing "Link this app to your organization"

main-process updater lines: []

  • ✅ PASS An unactivated enterprise install starts no update check or download within 20s of showing "Link this app to your organization" — main-process updater lines: []

⚪ UNVALIDATED — 2. an unactivated enterprise install does not check for or download updates artifact 1

  • ⚪ UNVALIDATED — no visual expectations recorded.

Test run created 2026-09-10T16:07:22.733Z · Source: evals/results/test-runs/2026-09-10T16-07-22-732Z-an-unactivated-enterprise-install-does-not-check-for-or-download-updates/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4805 --test-run 2026-09-10T16-07-22-732Z-an-unactivated-enterprise-install-does-not-check-for-or-download-updates

@yomgui

yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

Test evidence — an activated enterprise install still checks for updates — ✅ passed

SHA cfe5144 · engine v1

✅ 0/1 screenshots passed · 1 assertion · 1 expectations passed · 0 failed · 0 pending

Published from the local lane as a standalone evidence comment (the legacy single-run publisher holds one run in the sticky comment; the private review store token is not available locally). Screenshots for this run are in the source test-run directory named below; they are not attached here.

[probe] eventually(packaged distribution flavor) · eventually(update check after activation)
[user] notSee(text=Link this app to your organization) · screenshot
verdict passed · 2 user observations (notSee ×1, screenshot ×1) · 2 probes · steps 0/0

ℹ️ ASSERTION — 1. An activated enterprise install starts an update check without any user action

main-process updater lines: ["Checking for update"]

  • ✅ PASS An activated enterprise install starts an update check without any user action — main-process updater lines: ["Checking for update"]

⚪ UNVALIDATED — 2. an activated enterprise install still checks for updates artifact 1

  • ⚪ UNVALIDATED — no visual expectations recorded.

Test run created 2026-09-10T16:07:44.165Z · Source: evals/results/test-runs/2026-09-10T16-07-44-165Z-an-activated-enterprise-install-still-checks-for-updates/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4805 --test-run 2026-09-10T16-07-44-165Z-an-activated-enterprise-install-still-checks-for-updates

@yomgui

yomgui commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

Test evidence — an activated enterprise install boots past the activation gate without a render crash — ✅ passed

SHA cfe5144 · engine v1

✅ 0/1 screenshots passed · 1 assertion · 1 expectations passed · 0 failed · 0 pending

Published from the local lane as a standalone evidence comment (the legacy single-run publisher holds one run in the sticky comment; the private review store token is not available locally). Screenshots for this run are in the source test-run directory named below; they are not attached here.

[probe] eventually(packaged distribution flavor) · eventually(activated enterprise routes mounted in #root)
[user] see(text=Welcome to OpenWork) · notSee(text=Link this app to your organization) · notSee(text=/OpenWork hit an unexpected error/) · screenshot
verdict passed · 4 user observations (see ×1, notSee ×2, screenshot ×1) · 2 probes · steps 0/0

ℹ️ ASSERTION — 1. An activated enterprise install with Den at http://127.0.0.1:60601 (closed port) mounts "Welcome to OpenWork" and never shows "Link this app to your organization"

#root text: "OpenWork\nWelcome to OpenWork\n\nYour computer, but it works for you.\n\nSign in to OpenWork\nConnected to 127.0.0.1:60601\nChange\nPaste sign-in code\nPreparing workspace\nReload"; render crashes: 0; allowlisted rejections: 0 of 0 known; unexpected rejections: 0

⚪ UNVALIDATED — 2. an activated enterprise install boots past the activation gate without a render crash artifact 1

  • ⚪ UNVALIDATED — no visual expectations recorded.

Test run created 2026-09-10T16:07:48.710Z · Source: evals/results/test-runs/2026-09-10T16-07-48-710Z-an-activated-enterprise-install-boots-past-the-activation-gate-without-a-render-/test-run.json · Repro: pnpm --dir evals artifacts:publish -- --pr 4805 --test-run 2026-09-10T16-07-48-710Z-an-activated-enterprise-install-boots-past-the-activation-gate-without-a-render-

@yomgui

yomgui commented Sep 10, 2026 •

Copy link
Copy Markdown
Member Author

Passed · 10/10 tests · 15/15 assertions · 5 images

Commit cfe5144e58565ec94ee8c9388fc249178e0f858f · selected evidence

Open review report

This branch was successfully deployed

1 active and 3 inactive deployments
Preview – openwork-app — cfe5144e Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-landing — cfe5144e Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-den — cfe5144e Deployed Sep 10, 2026 by vercel[bot]
Preview – openwork-diagnostics — cfe5144e Deployed Sep 10, 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.

1 participant