Skip to content

feat(feature-flags): AppConfig-backed gated feature flags#5059

Open
TheodoreSpeaks wants to merge 3 commits into
stagingfrom
feat/appconfig-backed-feature-flag
Open

feat(feature-flags): AppConfig-backed gated feature flags#5059
TheodoreSpeaks wants to merge 3 commits into
stagingfrom
feat/appconfig-backed-feature-flag

Conversation

@TheodoreSpeaks

Copy link
Copy Markdown
Collaborator

Summary

  • New lib/core/config/feature-flags.ts: runtime feature flags gated by org id, user id, or admin — AppConfig-backed on prod (reuses fetchAppConfigProfile), with an in-file DEFAULT_FEATURE_FLAGS fallback off-prod (no env var)
  • Renamed the old env/deployment-detection module feature-flags.tsenv-flags.ts (it was never gated flags); rewrote all importers + the shared test mock (featureFlagsMockenvFlagsMock)
  • Admin gate resolved internally and lazily via new isPlatformAdmin(userId) reading the DB replica (dbReplica); only queries when admins is the deciding clause
  • add-feature-flag skill for Claude + Cursor
  • Infra (separate repo): adds a feature-flags AppConfig ConfigurationProfile alongside access-control

Type of Change

  • New feature

Testing

Tested manually. New feature-flags.test.ts (13 tests) + renamed-mock consumers pass. bun run lint, check:api-validation:strict, tsc --noEmit, and cdk synth all clean.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 16, 2026 12:17am

Request Review

@cursor

cursor Bot commented Jun 15, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Wide import rename is mechanical but touches auth, billing, and security paths; the new admin gate adds a replica read on admin-only flag evaluation.

Overview
Introduces runtime, per-request feature flags in feature-flags.ts (getFeatureFlags, isFeatureEnabled) backed by the AppConfig feature-flags profile on hosted deployments, with in-file DEFAULT_FEATURE_FLAGS when AppConfig is off. Rules can match globally, by org/user allowlists, or platform admins; admin checks use a new lazy isPlatformAdmin on dbReplica.

The previous feature-flags.ts (deploy-time booleans like isHosted, isBillingEnabled) is renamed to env-flags.ts and all importers, CI validation, and the shared test mock (featureFlagsMockenvFlagsMock) are updated accordingly. Claude/Cursor add-feature-flag skills document how to add gated flags vs env flags.

Reviewed by Cursor Bugbot for commit d13b230. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d0e0660. Configure here.

Comment thread apps/sim/lib/core/config/feature-flags.ts
…ked-feature-flag

# Conflicts:
#	apps/sim/app/(auth)/components/oauth-provider-checker.tsx
#	apps/sim/app/(auth)/signup/page.tsx
#	apps/sim/app/api/webhooks/agentmail/route.ts
#	apps/sim/ee/access-control/utils/permission-check.ts
#	apps/sim/lib/copilot/tools/handlers/function-execute.ts
#	apps/sim/lib/copilot/tools/server/files/touch-plan.test.ts
#	apps/sim/lib/copilot/tools/server/files/touch-plan.ts
#	apps/sim/lib/copilot/tools/server/router.ts
#	apps/sim/lib/core/config/feature-flags.ts
#	apps/sim/lib/core/security/input-validation.server.ts
#	apps/sim/lib/table/service.ts
#	apps/sim/lib/webhooks/processor.ts
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