feat(platform): host capabilities seam + boot-time binding guard#3446
Merged
Conversation
Introduce a coarse HostCapabilities primitive ({ localWorkspaces }) in
@posthog/platform, read via useHostCapabilities (defaults to
localWorkspaces:true, so desktop is unchanged). Use it to gate local-only
UI surfaces (folder picker, terminal, worktree/cloud-mode toggles,
back/forward chrome, local settings sections, onboarding repo step) so a
future cloud-only host renders correctly — every gate is a no-op on
desktop.
Also add a DI guardrail: assertHostCapabilities + a REQUIRED_HOST_CAPABILITIES
registry of tokens shared UI resolves via service location. Each
composition root asserts them at boot, so a host that forgets a binding
fails loudly at startup instead of at the first navigation that needs it.
Desktop binds HOST_CAPABILITIES and asserts the registry on renderer boot.
Enabling change for the browser web host, peeled out of #3353; no desktop
behavior change.
Generated-By: PostHog Code
Task-Id: 77d13a30-444d-4045-9d80-5e2a9f2e68ae
|
😎 Merged successfully - details. |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
|
Reviews (1): Last reviewed commit: "feat(platform): host capabilities seam +..." | Re-trigger Greptile |
This was referenced Jul 14, 2026
jonathanlab
approved these changes
Jul 15, 2026
Member
Author
|
/trunk merge |
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
Two related, desktop-safe primitives peeled out of the
apps/webbrowser-host work (previously #3353):HostCapabilitiesseam — a coarse{ localWorkspaces: boolean }primitive in@posthog/platform, read viauseHostCapabilities(). It defaults tolocalWorkspaces: truewhen unbound, so desktop is unchanged. Used to gate local-only UI (folder picker, terminal, worktree/cloud-mode toggles, in-app back/forward chrome, local settings sections, onboarding repo step) — every gate is a no-op whilelocalWorkspacesis true.DI binding guardrail —
assertHostCapabilities()plus aREQUIRED_HOST_CAPABILITIESregistry of the tokens shared@posthog/ui/@posthog/coreresolve via service location (useService). Each composition root asserts them at boot, turning a missing host binding into a loud startup failure instead of a crash at the first navigation that resolves the token.useService<T>(TOKEN)'s type is caller-supplied, so aTypedContainercan't catch this — the runtime assertion can.Desktop binds
HOST_CAPABILITIES({ localWorkspaces: true }) and runs the assertion on renderer boot.Why now
Splitting the web-host PR into independently-reviewable pieces. This is the shared-package/desktop-touching half — the part with real (if minimal) blast radius — landing on its own so it gets focused review.
Testing
@posthog/di,@posthog/ui,apps/codetypecheck.@posthog/diguardrail unit tests (8) pass.@posthog/uisuite: 176 files / 1566 tests pass — confirms the gating edits are no-ops on desktop (localWorkspaces: true).Created with PostHog Code