feat(web): cloud-tasks browser host#3447
Draft
gantoine wants to merge 3 commits into
Draft
Conversation
Bring up apps/web as a cloud-tasks-only browser host: the same @posthog/ui shell and @posthog/core services as desktop, over web platform adapters (WebCrypto refresh-token cipher, popup PKCE OAuth, localStorage per-device stores, in-browser host-router slice via unstable_localLink, posthog-js analytics/flags, fflate skill bundler, @pierre/diffs worker). Vendor + route code-splitting, a hermetic Playwright happy-path e2e, and mprocs procs. Depends on (merge first): async token cipher, host-capabilities seam, and the shared SKILL.md serializer. Red until those land; rebase then. Generated-By: PostHog Code Task-Id: 77d13a30-444d-4045-9d80-5e2a9f2e68ae
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
|
Reviews (1): Last reviewed commit: "feat(web): cloud-tasks browser host" | Re-trigger Greptile |
Resolve conflicts in apps/web/vite.config.ts (keep web-host refactor, carry over main's git alias into posthogSrcAliases) and mprocs.yaml (adopt main's layer-grouping model, slot in the new web/web-playwright/ desktop-playwright procs). Generated-By: PostHog Code Task-Id: d5bcaf27-c54b-45d5-920d-cc4f65c9e9fb
The popup used a fixed window name ("posthog-code-oauth"), so a second
tab starting sign-in before the first finished could reuse and navigate
away the first tab's popup. The first flow's callback then never fired,
and the shared BroadcastChannel only carried the second flow's state, so
the first tab waited until the five-minute timeout.
Name each popup uniquely per flow (suffixing the per-flow OAuth state) so
concurrent sign-ins open independent windows. State-based callback
routing over the shared channel already delivers each callback to its own
flow.
Generated-By: PostHog Code
Task-Id: d5bcaf27-c54b-45d5-920d-cc4f65c9e9fb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings up
apps/webas a cloud-tasks-only browser host for PostHog Code — the same@posthog/uishell and@posthog/coreservices as the desktop app, running in a plain browser tab over web platform adapters (no Electron, no local workspace-server). An authenticated user can reach the cloud task list, create a cloud task, stream the SSE chat, review diffs, attach files, run/skillcommands, and use Channels/Canvas — entirely client-side.Also a portability smoke test for the layered architecture:
@posthog/coreand@posthog/uirun unchanged; everything web-specific lives in theapps/webcomposition root.What's here
/callback→ BroadcastChannel relay), refresh token encrypted at rest with a non-extractable Web Crypto key in IndexedDB.AuthService/CloudTaskService(host-agnostic core) over an in-process host-router slice via tRPCunstable_localLink; SSE chat, diffs, log history, sidebar.desktop_file_systemAPI)./skillcommands (fflate bundler), posthog-js analytics/error-tracking/flags, browser notifications, per-device stores (localStorage).autoCodeSplitting)./callback), wired into CI alongside the desktop suite;mprocsprocs for local dev.This is the additive web-host layer split out of #3353. It builds on three small enabling PRs and is red until they land, then a rebase turns it green:
refactor(auth): make the token cipher asyncfeat(platform): host capabilities seam + boot-time binding guardrefactor(shared): move the SKILL.md serializer into @posthog/sharedVerified locally: with all three applied on top of current
main,@posthog/webandapps/codetypecheck clean and the web e2e passes. The standalone red is exclusively unresolved symbols from those three (async cipher,@posthog/platform/host-capabilities+@posthog/di/hostCapabilities+REQUIRED_HOST_CAPABILITIES,serializeSkillMarkdown).Notes
apps/webis a new app; nothing inmainimports it, so its blast radius on the desktop host is nil. The shared-package/desktop changes that do carry risk were peeled into the three enabler PRs above.Created with PostHog Code