Skip to content

feat(api): enable all feature flags if posthog is not configured#3658

Draft
Tpuljak wants to merge 2 commits intomainfrom
enable-ff-if-no-ph
Draft

feat(api): enable all feature flags if posthog is not configured#3658
Tpuljak wants to merge 2 commits intomainfrom
enable-ff-if-no-ph

Conversation

@Tpuljak
Copy link
Member

@Tpuljak Tpuljak commented Feb 5, 2026

Description

Enables all feature flags in the API and dashboard if posthog is not configured.
In non-prod environments, where posthog is not configured, there's no reason to block features behind feature flags.

Documentation

  • This change requires a documentation update
  • I have made corresponding changes to the documentation

Copilot AI review requested due to automatic review settings February 5, 2026 16:16
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enables all feature flags by default in non-production environments where PostHog is not configured, removing the need to manually enable features during development and testing.

Changes:

  • Created a custom useFeatureFlagEnabled hook in the dashboard that returns true for all flags when PostHog is not configured
  • Changed default values for feature flag decorators in the API from false to true
  • Updated the PostHog initialization log message to clarify when feature flags are disabled

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/dashboard/src/hooks/useFeatureFlagEnabled.ts New hook that wraps PostHog's feature flag check and returns true when PostHog is not configured
apps/dashboard/src/components/Sidebar.tsx Updated import to use the new custom useFeatureFlagEnabled hook
apps/dashboard/src/App.tsx Updated import to use the new custom useFeatureFlagEnabled hook
apps/api/src/sandbox/controllers/sandbox.controller.ts Changed SANDBOX_RESIZE flag default from false to true
apps/api/src/sandbox/controllers/runner.controller.ts Changed ORGANIZATION_INFRASTRUCTURE flag default from false to true across multiple endpoints
apps/api/src/organization/controllers/organization-region.controller.ts Changed ORGANIZATION_INFRASTRUCTURE flag default from false to true across multiple endpoints
apps/api/src/common/providers/openfeature-posthog.provider.ts Updated log message to clarify that feature flags are disabled when PostHog is not configured

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Toma Puljak <toma.puljak@hotmail.com>
Signed-off-by: Toma Puljak <toma.puljak@hotmail.com>
@Tpuljak Tpuljak force-pushed the enable-ff-if-no-ph branch from 678be2c to c675622 Compare February 9, 2026 08:18
Copilot AI review requested due to automatic review settings February 9, 2026 08:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 14 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@UseGuards(OrganizationResourceActionGuard)
@RequiredOrganizationResourcePermissions([OrganizationResourcePermission.WRITE_RUNNERS])
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: false }] })
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: true }] })
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Setting defaultValue: true broadly enables these endpoints on any evaluation failure (not just “PostHog not configured”). To match the PR’s stated intent and avoid accidentally exposing infra endpoints, prefer defaultValue: false and do the “enable all when PostHog isn’t configured” behavior in the flag provider/decorator fallback path.

Suggested change
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: true }] })
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: false }] })

Copilot uses AI. Check for mistakes.
@UseGuards(OrganizationResourceActionGuard)
@RequiredOrganizationResourcePermissions([OrganizationResourcePermission.READ_RUNNERS])
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: false }] })
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: true }] })
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Setting defaultValue: true broadly enables these endpoints on any evaluation failure (not just “PostHog not configured”). To match the PR’s stated intent and avoid accidentally exposing infra endpoints, prefer defaultValue: false and do the “enable all when PostHog isn’t configured” behavior in the flag provider/decorator fallback path.

Suggested change
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: true }] })
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: false }] })

Copilot uses AI. Check for mistakes.
@UseGuards(OrganizationResourceActionGuard, RunnerAccessGuard)
@RequiredOrganizationResourcePermissions([OrganizationResourcePermission.WRITE_RUNNERS])
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: false }] })
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: true }] })
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Setting defaultValue: true broadly enables these endpoints on any evaluation failure (not just “PostHog not configured”). To match the PR’s stated intent and avoid accidentally exposing infra endpoints, prefer defaultValue: false and do the “enable all when PostHog isn’t configured” behavior in the flag provider/decorator fallback path.

Suggested change
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: true }] })
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: false }] })

Copilot uses AI. Check for mistakes.
@UseGuards(RegionAccessGuard)
@RequiredOrganizationResourcePermissions([OrganizationResourcePermission.WRITE_REGIONS])
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: false }] })
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: true }] })
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Same concern as other controllers: defaultValue: true makes these operations enabled on any flag lookup/evaluation failure. If the requirement is limited to “when PostHog isn’t configured,” keep defaults conservative and implement the unconditional enablement only for the “no PostHog” fallback case.

Suggested change
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: true }] })
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: false }] })

Copilot uses AI. Check for mistakes.
@UseGuards(RegionAccessGuard)
@RequiredOrganizationResourcePermissions([OrganizationResourcePermission.WRITE_REGIONS])
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: false }] })
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: true }] })
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Same concern as other controllers: defaultValue: true makes these operations enabled on any flag lookup/evaluation failure. If the requirement is limited to “when PostHog isn’t configured,” keep defaults conservative and implement the unconditional enablement only for the “no PostHog” fallback case.

Copilot uses AI. Check for mistakes.
@UseGuards(RegionAccessGuard)
@RequiredOrganizationResourcePermissions([OrganizationResourcePermission.WRITE_REGIONS])
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: false }] })
@RequireFlagsEnabled({ flags: [{ flagKey: FeatureFlags.ORGANIZATION_INFRASTRUCTURE, defaultValue: true }] })
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Same concern as other controllers: defaultValue: true makes these operations enabled on any flag lookup/evaluation failure. If the requirement is limited to “when PostHog isn’t configured,” keep defaults conservative and implement the unconditional enablement only for the “no PostHog” fallback case.

Copilot uses AI. Check for mistakes.
Comment on lines +37 to 41
console.error('Failed to initialize PostHog client. Feature flags will use default values.', error)
}
} else {
console.log('PostHog not configured. Feature flags will use default values.')
}
Copy link

Copilot AI Feb 9, 2026

Choose a reason for hiding this comment

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

Using console.log/error in API server code can make logs noisy/inconsistent versus the app’s structured logger (e.g., NestJS Logger) and may bypass log formatting/levels. Prefer the project’s logger abstraction here (and consider making the “not configured” message debug/info-level rather than unconditional stdout).

Copilot uses AI. Check for mistakes.
@Tpuljak Tpuljak marked this pull request as draft February 11, 2026 10:28
@Tpuljak
Copy link
Member Author

Tpuljak commented Feb 11, 2026

Draft until further discussion

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