diff --git a/app/Jobs/PostHog/SendEvent.php b/app/Jobs/PostHog/SendEvent.php index e21acbd6..0057938f 100644 --- a/app/Jobs/PostHog/SendEvent.php +++ b/app/Jobs/PostHog/SendEvent.php @@ -13,16 +13,6 @@ use Illuminate\Support\Facades\Log; use PostHog\PostHog; -/** - * Low-level PostHog dispatch worker. Forwards a single API call (`capture`, - * `identify`, `groupIdentify`) to the PostHog SDK. Higher-level jobs in this - * namespace (`SyncUser`, `TrackBilling`) build the payloads and queue this - * job to do the network work. - * - * No-op when `POSTHOG_ENABLED` is false (or `POSTHOG_API_KEY` is unset), - * via `PostHogService::isEnabled()`, so self-hosted installs never reach - * the SDK. - */ class SendEvent implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; diff --git a/app/Jobs/PostHog/SyncUser.php b/app/Jobs/PostHog/SyncUser.php index aeed8ab8..0899464b 100644 --- a/app/Jobs/PostHog/SyncUser.php +++ b/app/Jobs/PostHog/SyncUser.php @@ -12,22 +12,6 @@ use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; -/** - * Centralised PostHog sync for a single user. Dispatched from places the - * frontend can't observe (signup, Stripe webhooks) so the person profile - * and account/workspace groups carry up-to-date properties without blocking - * the calling request. Inertia navigations refresh group counts on the - * client (see `syncPostHogContext` in resources/js/posthog.ts), so this job - * is not needed on every domain trigger. - * - * Hierarchy mirrors the domain model: - * - person → User - * - group `account` → Account (billing/plan, parent of workspaces) - * - group `workspace` → Workspace (collaboration unit, child of account) - * - * No-op when PostHog is disabled (`POSTHOG_ENABLED=false` or no API key) - * via `PostHogService::isEnabled()`, so self-hosted installs are unaffected. - */ class SyncUser implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; diff --git a/app/Jobs/PostHog/TrackBilling.php b/app/Jobs/PostHog/TrackBilling.php index 7c178ee6..59f2a1a9 100644 --- a/app/Jobs/PostHog/TrackBilling.php +++ b/app/Jobs/PostHog/TrackBilling.php @@ -13,14 +13,6 @@ use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; -/** - * Captures a Stripe billing lifecycle event on the account owner profile - * with the `account` group attached, then re-queues `SyncUser` so the - * group properties (plan, has_active_subscription, is_on_trial) reflect - * the new Stripe state. Dispatched by `StripeEventListener`. - * - * No-op when PostHog is disabled (`POSTHOG_ENABLED=false` or no API key). - */ class TrackBilling implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; diff --git a/app/Models/Account.php b/app/Models/Account.php index 56edf84f..b97058bd 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -32,13 +32,6 @@ class Account extends Model 'plan_id', ]; - /** - * Drop the cached Pennant feature values for the plan-scoped limits so - * the next read resolves against the current plan. Call this right after - * any `plan_id` change. Centralised here (instead of as a model hook) so - * self-hosted installs — where Stripe webhooks never fire and the billing - * controllers redirect away — never trigger this path. - */ public function forgetPlanFeatureCache(): void { Feature::for($this)->forget([ diff --git a/app/Models/Traits/HasUsage.php b/app/Models/Traits/HasUsage.php index e97f8f72..256fe888 100644 --- a/app/Models/Traits/HasUsage.php +++ b/app/Models/Traits/HasUsage.php @@ -66,14 +66,8 @@ public function featureLimits(): array } /** - * The `(int)` cast on the cached value is load-bearing: Laravel's - * RedisStore skips serialize()/unserialize() for is_numeric values so - * they can be incremented atomically — the side effect is that an int - * stored via `Cache::put` comes back as a string on read. Without the - * cast, the strict `: int` return type throws a TypeError under the - * Redis cache driver (production). File/array/database drivers don't - * have this optimisation and preserve the type, which is why the bug - * never surfaced in tests or local dev. + * The `(int)` cast is load-bearing: Laravel's RedisStore stores numeric + * values raw (for atomic INCR) and returns them as strings on read. * * @param array $workspaceIds */ diff --git a/app/Services/PostHogService.php b/app/Services/PostHogService.php index cde8fdd4..074dbb58 100644 --- a/app/Services/PostHogService.php +++ b/app/Services/PostHogService.php @@ -10,12 +10,6 @@ class PostHogService { - /** - * Whether PostHog tracking should run at all. Controlled by the explicit - * `POSTHOG_ENABLED` env var so self-hosted installs that inherited an - * example `POSTHOG_API_KEY` from a config snippet do not silently send - * events upstream. The SaaS deployment opts in via `POSTHOG_ENABLED=true`. - */ public static function isEnabled(): bool { return (bool) config('services.posthog.enabled') @@ -23,10 +17,6 @@ public static function isEnabled(): bool } /** - * Capture an event for the given distinct id. When `$account` is supplied, - * the workspace/plan group is auto-attached so the event is filterable in - * PostHog by `$groups.account` and the `account_id` / `plan` properties. - * * @param array $properties */ public function capture(string $distinctId, string $event, array $properties = [], ?Account $account = null): void