Skip to content

Add team-level toggle for enabling/disabling AI features#7332

Open
cstns wants to merge 2 commits into
team-level-support-for-expert-featuresfrom
add-team-onwe-ai-opt-out-support
Open

Add team-level toggle for enabling/disabling AI features#7332
cstns wants to merge 2 commits into
team-level-support-for-expert-featuresfrom
add-team-onwe-ai-opt-out-support

Conversation

@cstns
Copy link
Copy Markdown
Contributor

@cstns cstns commented May 25, 2026

Important

This PR is part of a nested merge list. Do not merge until its target branch is main.

Description

Team owners can now enable or disable AI features for their team independently of platform and team type settings. This adds the third level of the AI feature flag hierarchy, allowing team owners to opt out even when their team type has AI enabled.

Backend (forge/routes/api/team.js):

  • Added features body parameter to the PUT team endpoint
  • Team owners (role: Owner) can update feature overrides via { features: { ai: true/false } }
  • Only ai is in the allowed features whitelist, preventing team owners from toggling other features
  • The value is stored in team.properties.features.ai, which is already respected by Team.getFeatureProperty() (team-level overrides take precedence over team type)

Frontend (frontend/src/pages/team/Settings/Danger.vue):

  • Added an "AI Features" toggle in the team Danger settings, before the admin-only section
  • Only visible when AI is enabled at the platform level (isAiFeatureEnabledForPlatform)
  • Uses a confirmation dialog via the global Dialog.show() service with contextual messaging for enable/disable actions
  • Uses a computed getter/setter with a temporary override to keep the toggle in sync with team data without stale state

Frontend (frontend/src/ui-components/components/form/ToggleSwitch.vue):

  • Added change event emission after toggling in sync mode

Frontend (frontend/src/stores/account.js):

  • Fixed stale team data on hard refresh: setTeam now updates contextStore.team even when the team ID matches, ensuring team type features are current

Feature flag hierarchy (all three levels must be enabled):

  1. Platform level (admin, config) - can the platform do AI at all?
  2. Team type level (admin, TeamType properties) - is AI available for this tier/plan?
  3. Team level (team owner, Team properties) - does this team want AI enabled?

Related Issue(s)

closes #7316

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@cstns cstns self-assigned this May 25, 2026
@cstns cstns linked an issue May 25, 2026 that may be closed by this pull request
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

❌ Patch coverage is 8.33333% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.57%. Comparing base (796ff4e) to head (0d79f19).

Files with missing lines Patch % Lines
forge/routes/api/team.js 8.33% 11 Missing ⚠️
Additional details and impacted files
@@                            Coverage Diff                             @@
##           team-level-support-for-expert-features    #7332      +/-   ##
==========================================================================
- Coverage                                   76.61%   76.57%   -0.04%     
==========================================================================
  Files                                         405      405              
  Lines                                       20658    20670      +12     
  Branches                                     5017     5022       +5     
==========================================================================
+ Hits                                        15827    15828       +1     
- Misses                                       4831     4842      +11     
Flag Coverage Δ
backend 76.57% <8.33%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Task 7: Add team owner AI opt-out via team properties

1 participant