Skip to content

feat(web): gate deploy behind PostHog feature flag - #6045

Merged
eshurakov merged 2 commits into
mainfrom
kilo/rapid-disk-2dp
Sep 10, 2026
Merged

feat(web): gate deploy behind PostHog feature flag#6045
eshurakov merged 2 commits into
mainfrom
kilo/rapid-disk-2dp

Conversation

@kilo-code-bot

@kilo-code-bot kilo-code-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Gate Deploy routes and sidebar entries behind the deploy-feature PostHog flag, matching App Builder (app-builder-feature).
  • Personal (/deploy) and organization (/organizations/[id]/deploy) pages return notFound() when the flag is off. Development bypasses the flag.
  • Sidebars hide Deploy via useFeatureFlagEnabled('deploy-feature').
  • Integrations stay visible; they are no longer tied to the old ENABLE_DEPLOY_FEATURE constant.

Create the deploy-feature flag in PostHog (off by default) and add existing Deploy users as a release condition so they keep access.

Verification

  • Not manually tested in a browser in this environment. Flag-off should 404 /deploy and hide the sidebar item; development and flag-on should keep the current Deploy UI.

Visual Changes

N/A — flag-on rendering is unchanged; flag-off hides the sidebar entry and 404s the routes.

Reviewer Notes

  • Flag evaluation uses the authenticated user's id on the server, same as App Builder.
  • Existing users are not grandfathered in code. Target them in PostHog (distinct IDs: user id for server pages, email for the client sidebar).

Replace the static `ENABLE_DEPLOY_FEATURE` constant with a dynamic
feature access system. The new implementation evaluates deployment
feature visibility based on PostHog feature flags and the presence
of existing deployments for both users and organizations.

- Add `feature-access` logic to determine deployment visibility
- Implement `isDeployFeatureEnabled` for server-side route protection
- Add `hasExistingDeployments` query to check for existing user/org deployments
- Update sidebars (Personal and Organization) to conditionally show
  Deploy and Integrations links
- Protect deployment and integration routes with dynamic feature checks
- Add unit tests for deployment feature access logic
Remove the complex logic that checked for existing deployments to determine
feature access. Instead, the deployment feature is now controlled strictly
by the 'deploy-feature' PostHog flag, while still allowing access in
development environments.

This change involves:
- Deleting `feature-access.ts`, `is-deploy-feature-enabled.ts`, and
  `feature-access.test.ts`.
- Removing `hasExistingDeployments` from `deployments-service.ts` and
  the corresponding TRPC routers.
- Updating sidebar components and deployment pages to use the simplified
  feature flag check.
@kilo-code-bot

kilo-code-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (8 files)
  • apps/web/src/app/(app)/components/OrganizationAppSidebar.tsx
  • apps/web/src/app/(app)/components/PersonalAppSidebar.tsx
  • apps/web/src/app/(app)/deploy/[deploymentId]/page.tsx
  • apps/web/src/app/(app)/deploy/page.tsx
  • apps/web/src/app/(app)/organizations/[id]/deploy/[deploymentId]/page.tsx
  • apps/web/src/app/(app)/organizations/[id]/deploy/page.tsx
  • apps/web/src/app/(app)/organizations/[id]/integrations/page.tsx
  • apps/web/src/lib/constants.ts

Reviewed by grok-4.6 · Input: 85K · Output: 10.2K · Cached: 450.4K

Review guidance: REVIEW.md from base branch main

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