Cleanup AiErrorAssistant todos post plans changes (#35067)

* feat: cleaning up ai quota leftovers

fix: removing more straggler invos

* fix: featureUpdater still need analyticsId in the user projection

* feat: updating cypress tests to also check for fair usage text

GitOrigin-RevId: 09c1167106c144084c111beea56867f6aa4a0906
This commit is contained in:
Jimmy Domagala-Tang
2026-09-17 11:41:10 +00:00
committed by Copybot
parent 275d381656
commit ba76fda37b
19 changed files with 40 additions and 91 deletions
@@ -6,7 +6,8 @@ import {
makeEditorProvider,
} from '../../helpers/editor-providers'
const PAYWALL_TEXT = 'You’ve reached the fair usage limit on your plan'
const PAYWALL_TEXT = 'You’ve hit your daily AI limit'
const FAIR_USAGE_TEXT = 'You’ve reached the fair usage limit on your plan'
const futureDate = () => new Date(Date.now() + 60 * 60 * 1000)
@@ -39,14 +40,17 @@ function makeShowLogsCompileProvider(initialShowLogs: boolean) {
return Provider
}
function mountSuggestFixPaywall(initialShowLogs = true) {
function mountSuggestFixPaywall(
initialShowLogs = true,
{ hasUnlimitedAi = false }: { hasUnlimitedAi?: boolean } = {}
) {
cy.window().then(win => {
win.metaAttributesCache.set('ol-showAiFeatures', true)
win.metaAttributesCache.set('ol-hasUnlimitedAi', hasUnlimitedAi)
})
cy.mount(
<EditorProviders
features={{ aiErrorAssistant: true }}
providers={{
EditorProvider: makeEditorProvider({
hasSuggestionsLeft: false,
@@ -72,6 +76,13 @@ describe('<ErrorAssistantAiPaywallNotification />', function () {
cy.contains(PAYWALL_TEXT).should('be.visible')
})
it('renders the fair usage limit paywall for users with unlimited AI', function () {
mountSuggestFixPaywall(true, { hasUnlimitedAi: true })
dispatchSuggestFixPaywall()
cy.contains(FAIR_USAGE_TEXT).should('be.visible')
cy.contains(PAYWALL_TEXT).should('not.exist')
})
it('ignores paywall events from other origins', function () {
mountSuggestFixPaywall()
cy.window().then(win => {
@@ -10,9 +10,6 @@ describe('Workbench', { scrollBehavior: false }, function () {
beforeEach(function () {
cy.window().then(win => {
win.metaAttributesCache.set('ol-showAiFeatures', true)
win.metaAttributesCache.set('ol-splitTestVariants', {
'ai-workbench-release': 'enabled',
})
win.metaAttributesCache.set('ol-inactiveTutorials', [
AI_CONSENT_TUTORIAL_KEY,
])
@@ -30,13 +27,13 @@ describe('Workbench', { scrollBehavior: false }, function () {
</EditorViewContext.Provider>
)
const Providers: FC<PropsWithChildren<{ aiAssistEnabled?: boolean }>> = ({
const Providers: FC<PropsWithChildren<{ aiUsageQuota?: string }>> = ({
children,
aiAssistEnabled = true,
aiUsageQuota = 'unlimited',
}) => {
return (
<EditorProviders
features={{ aiErrorAssistant: aiAssistEnabled }}
features={{ aiUsageQuota: aiUsageQuota }}
providers={{ EditorViewProvider, TutorialProvider }}
>
<div style={{ backgroundColor: '#1b222c' }}>{children}</div>
@@ -47,7 +44,7 @@ describe('Workbench', { scrollBehavior: false }, function () {
describe('when AI assist is enabled and consent is given', function () {
it('should show the chat interface', function () {
cy.mount(
<Providers aiAssistEnabled>
<Providers aiUsageQuota="unlimited">
<Workbench />
</Providers>
)
@@ -70,7 +67,7 @@ describe('Workbench', { scrollBehavior: false }, function () {
})
cy.mount(
<Providers aiAssistEnabled>
<Providers aiUsageQuota="unlimited">
<Workbench />
</Providers>
)
@@ -111,7 +108,7 @@ describe('Workbench', { scrollBehavior: false }, function () {
win.metaAttributesCache.set('ol-showAiFeatures', false)
})
cy.mount(
<Providers aiAssistEnabled={false}>
<Providers aiUsageQuota="free">
<Workbench />
</Providers>
)
@@ -87,8 +87,8 @@ export type EditorProvidersProps = {
socket?: Socket
isRestrictedTokenMember?: boolean
scope?: Record<string, any>
features?: Record<string, boolean>
projectFeatures?: Record<string, boolean>
features?: Record<string, boolean | string>
projectFeatures?: Record<string, boolean | string>
permissionsLevel?: PermissionsLevel
children?: React.ReactNode
rootFolder?: Folder[]