Skip to content

Move PostHog gating into buildFeatureChecks #8227

Description

@n-lark

Move PostHog gating into buildFeatureChecks

Problem

PostHog gating is hand-wired into the featuresCheck getter in account-settings.js, separate from the config-driven feature system in FeatureChecks.ts. The pairing between a PostHog flag and its platform feature is implicit.

Goal

Let a feature config declare an optional posthogKey alongside platformKey/teamKey. PostHog is authoritative: when it's available, its flag value drives the check regardless of platform/team settings. Only when PostHog is unavailable does the check fall back to the existing platform/team logic.

Behavior

For a config with a posthogKey, buildFeatureChecks resolves {output} as:

window.posthog present Has platform/team key Result
yes PostHog flag value
no yes existing platform/team check
no no false

Configs with no posthogKey are unchanged.

Changes

  • Add posthogKey?: string to FeatureConfig; apply the table above in buildFeatureChecks. Availability is !!window.posthog; the value comes from posthogFlags (passed in; still populated by loadPosthogFlagsonFeatureFlags so the getter stays reactive).
  • Move POSTHOG_FLAGS and the three PostHog lines out of the featuresCheck getter in account-settings.js (keep posthogFlags state + loadPosthogFlags).
  • Reconcile the MCP output name: ExpertButton.vue reads isMcpThirdPartyEnabled, config output is isMcpThirdPartyFeatureEnabled.
  • Remove isPostHogFeatureFlagsEnabled entirely, plus the code it gates in General.vue (the v-if Expert-agent creds template block and the mounted-hook assignment). Drop the FF_FEATURE_FLAGS key.

This changes MCP: today it's platform AND team AND PostHog; under the new rule PostHog trumps everything when present, so its value drives the check regardless of platform/team.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions