From cb3a428587bb30ec40ed91b32fd264bfe9808a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vi=CC=81ctor=20Falco=CC=81n?= Date: Wed, 1 Jul 2026 09:31:10 +0200 Subject: [PATCH] refactor(ai): remove AiConsentSettings feature flag Retire the Pennant flag that gated the AI consent management UI so the billing settings toggle and transactions banner are available to everyone. The underlying AI consent functionality is unchanged. Swaps the FeatureEnableCommand test onto CalculateBalancesOnImport as its example feature. --- app/Features/AiConsentSettings.php | 24 ------------------- app/Http/Middleware/HandleInertiaRequests.php | 4 ---- resources/js/pages/settings/billing.tsx | 12 ++++------ resources/js/pages/transactions/index.tsx | 3 +-- resources/js/types/index.d.ts | 1 - tests/Feature/AiConsentSettingsTest.php | 21 ---------------- .../Console/FeatureEnableCommandTest.php | 8 +++---- tests/Feature/InertiaSharedDataTest.php | 1 - 8 files changed, 10 insertions(+), 64 deletions(-) delete mode 100644 app/Features/AiConsentSettings.php diff --git a/app/Features/AiConsentSettings.php b/app/Features/AiConsentSettings.php deleted file mode 100644 index 92049d47..00000000 --- a/app/Features/AiConsentSettings.php +++ /dev/null @@ -1,24 +0,0 @@ - true, 'calculateBalancesOnImport' => false, - 'aiConsentSettings' => false, ]; } $features = Feature::for($user)->values([ CalculateBalancesOnImport::class, - AiConsentSettings::class, ]); return [ 'cashflow' => true, 'calculateBalancesOnImport' => $features[CalculateBalancesOnImport::class] !== false, - 'aiConsentSettings' => $features[AiConsentSettings::class] !== false, ]; } diff --git a/resources/js/pages/settings/billing.tsx b/resources/js/pages/settings/billing.tsx index 0a1ff167..5ca05e8c 100644 --- a/resources/js/pages/settings/billing.tsx +++ b/resources/js/pages/settings/billing.tsx @@ -476,7 +476,7 @@ function AiConsentSection({ } export default function Billing() { - const { auth, pricing, locale, features, hasAiConsent, refund } = usePage< + const { auth, pricing, locale, hasAiConsent, refund } = usePage< SharedData & { hasAiConsent: boolean; refund?: RefundInfo } >().props; const isDemoAccount = auth?.isDemoAccount ?? false; @@ -507,12 +507,10 @@ export default function Billing() { /> )} - {features.aiConsentSettings && ( - - )} + diff --git a/resources/js/pages/transactions/index.tsx b/resources/js/pages/transactions/index.tsx index c951b057..9fa09fdd 100644 --- a/resources/js/pages/transactions/index.tsx +++ b/resources/js/pages/transactions/index.tsx @@ -437,12 +437,11 @@ export default function Transactions({ lastVisitAt, }: Props) { const locale = useLocale(); - const { auth, features } = usePage().props; + const { auth } = usePage().props; const [aiConsentResolved, setAiConsentResolved] = useState(false); const [aiConsentSaving, setAiConsentSaving] = useState(false); const showAiConsentBanner = auth.hasProPlan && - features.aiConsentSettings && !hasAiConsent && !aiConsentPromptDismissed && !aiConsentResolved; diff --git a/resources/js/types/index.d.ts b/resources/js/types/index.d.ts index dd8cda89..525a0033 100644 --- a/resources/js/types/index.d.ts +++ b/resources/js/types/index.d.ts @@ -42,7 +42,6 @@ export interface NavDivider { export interface Features { cashflow: boolean; calculateBalancesOnImport: boolean; - aiConsentSettings: boolean; } export interface ExpiredBankingConnectionNotification { diff --git a/tests/Feature/AiConsentSettingsTest.php b/tests/Feature/AiConsentSettingsTest.php index e7af5450..e7edacf5 100644 --- a/tests/Feature/AiConsentSettingsTest.php +++ b/tests/Feature/AiConsentSettingsTest.php @@ -1,31 +1,10 @@ onboarded()->create(); - - actingAs($user)->withoutVite()->get(route('dashboard')) - ->assertInertia(fn (Assert $page) => $page - ->where('features.aiConsentSettings', false) - ); -}); - -test('ai consent settings flag is exposed when activated for the user', function () { - $user = User::factory()->onboarded()->create(); - Feature::for($user)->activate(AiConsentSettings::class); - - actingAs($user)->withoutVite()->get(route('dashboard')) - ->assertInertia(fn (Assert $page) => $page - ->where('features.aiConsentSettings', true) - ); -}); - test('billing page reports current ai consent state', function () { config(['subscriptions.enabled' => true]); $user = User::factory()->onboarded()->create(); diff --git a/tests/Feature/Console/FeatureEnableCommandTest.php b/tests/Feature/Console/FeatureEnableCommandTest.php index 7b1f6264..2ea50280 100644 --- a/tests/Feature/Console/FeatureEnableCommandTest.php +++ b/tests/Feature/Console/FeatureEnableCommandTest.php @@ -1,17 +1,17 @@ count(10)->create(); - $this->artisan('feature:enable', ['feature' => 'AiConsentSettings', 'target' => '40%']) + $this->artisan('feature:enable', ['feature' => 'CalculateBalancesOnImport', 'target' => '40%']) ->expectsOutputToContain('enabled for 4 users') ->assertSuccessful(); - $enabled = $users->filter(fn (User $user) => Feature::for($user)->active(AiConsentSettings::class)); + $enabled = $users->filter(fn (User $user) => Feature::for($user)->active(CalculateBalancesOnImport::class)); expect($enabled)->toHaveCount(4); }); @@ -19,6 +19,6 @@ test('enables a feature for a percentage of users', function () { test('rejects an out-of-range percentage', function () { User::factory()->create(); - $this->artisan('feature:enable', ['feature' => 'AiConsentSettings', 'target' => '0%']) + $this->artisan('feature:enable', ['feature' => 'CalculateBalancesOnImport', 'target' => '0%']) ->assertFailed(); }); diff --git a/tests/Feature/InertiaSharedDataTest.php b/tests/Feature/InertiaSharedDataTest.php index b9097964..a2d2c691 100644 --- a/tests/Feature/InertiaSharedDataTest.php +++ b/tests/Feature/InertiaSharedDataTest.php @@ -43,7 +43,6 @@ test('shared feature flags do not include coinbase flag', function () { expect($props['features'])->toBe([ 'cashflow' => true, 'calculateBalancesOnImport' => false, - 'aiConsentSettings' => false, ]); });