[Web] Enable Quota System for AI Features (#31544)

* feat: migrate from aiErrorAssist naming for disabling AI features to aiFeatures.enabled to avoid confusion

feat: keep aiErrorAssistant as setting on user object until migration is run

* feat: migrate writefull.enabled unset to instead use promotionSet false

* feat: updating to use quota based system for AI usage

* feat: hide relevant sections of quota system behind split test

* feat: ship onAiFreeTrial instead of free quota amount to project meta

* fix: renaming splitTestEnabledForUser to featureFlagEnabledForUser

* fix: v1_personal should have free trial amount of ai quota

* fix: onAiFreeTrial in projectController should account for anonymous users with no features

* feat: fixing marketing exports for ai quotas

* feat: update features epoch

* feat: move to quota tiers, and map tier to numeric allowance within rateLimiters

GitOrigin-RevId: 17763447965aae5777053b783d2601517bfe6b12
This commit is contained in:
Jimmy Domagala-Tang
2026-02-24 09:06:31 +00:00
committed by Copybot
parent 8fb5b0ed05
commit 92463fb3e2
18 changed files with 112 additions and 14 deletions
@@ -306,6 +306,20 @@ async function getOneTimeAssignment(splitTestName) {
}
}
/**
* Checks if a feature flag is enabled for a specific user
*
* Retrieves the feature flag assignment for a user and determines if the assigned variant is 'enabled'
*
* @param {string} userId - The ID of the user to check the feature flag for
* @param {string} splitTestName - The unique name of the feature flag
* @returns {Promise<boolean>} True if the user's assigned variant is 'enabled', false otherwise
*/
async function featureFlagEnabledForUser(userId, splitTestName) {
const { variant } = await getAssignmentForUser(userId, splitTestName)
return variant === 'enabled'
}
/**
* Returns an array of valid variant names for the given split test, including default
*
@@ -802,6 +816,7 @@ export default {
getPercentile,
getAssignment: callbackify(getAssignment),
getAssignmentForUser: callbackify(getAssignmentForUser),
featureFlagEnabledForUser: callbackify(featureFlagEnabledForUser),
getOneTimeAssignment: callbackify(getOneTimeAssignment),
getActiveAssignmentsForUser: callbackify(getActiveAssignmentsForUser),
hasUserBeenAssignedToVariant: callbackify(hasUserBeenAssignedToVariant),
@@ -810,6 +825,7 @@ export default {
promises: {
getAssignment,
getAssignmentForUser,
featureFlagEnabledForUser,
getOneTimeAssignment,
getActiveAssignmentsForUser,
hasUserBeenAssignedToVariant,