Fix autumn implementation and posthog errors#61
Conversation
Co-authored-by: dogesman098 <dogesman098@gmail.com>
|
Cursor Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughRemoved Autumn billing env vars and related client-side checks, updated a pricing comment, hardened PostHog event capture with try/catch, and integrated PostHogProvider at app root. ChatInterface no longer gates message sending behind a feature flag; flow proceeds directly. No public API signatures changed. Changes
Sequence Diagram(s)sequenceDiagram
participant Browser
participant PostHogProvider
participant ClerkProvider
participant ConvexProvider
participant App
participant PostHog
Browser->>PostHogProvider: Load app (apiKey, options)
PostHogProvider-->>Browser: Initialize analytics
PostHogProvider->>ClerkProvider: Render children
ClerkProvider->>ConvexProvider: Provide auth
ConvexProvider->>App: Render App
App->>PostHog: posthog.capture(event)
Note over App,PostHog: useUsageTracking wraps capture in try/catch
PostHog-->>App: Success or throws
App-->>Browser: On error, warn (no crash)
sequenceDiagram
autonumber
participant User
participant ChatUI as ChatInterface
participant Backend as AI/Stream
Note over ChatUI: Old flow (removed)
User->>ChatUI: Submit message
ChatUI->>ChatUI: Check feature flag + TTL cache
alt Not allowed
ChatUI->>User: Toast + redirect to checkout
ChatUI--xBackend: Do not send
else Allowed
ChatUI->>Backend: Send message
Backend-->>ChatUI: Stream response
end
Note over ChatUI: New flow
User->>ChatUI: Submit message
ChatUI->>Backend: Send message (no gating)
Backend-->>ChatUI: Stream response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Claude finished @otdoges's task —— View job Pull Request Review
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
|
Claude finished @otdoges's task —— View job Pull Request ReviewReviewing PR #61: "Fix autumn implementation and posthog errors" Todo List:
SummaryThis PR successfully removes the Autumn.js billing implementation and improves PostHog configuration. The changes are well-structured and address the stated goals effectively. Detailed Review✅ Autumn.js Removal - Complete and CleanThe PR successfully removes Autumn.js references:
✅ PostHog Configuration - Well ImprovedExcellent PostHog error handling improvements in
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (4)
env-template.txt (1)
39-39: Clarify which variables were removed for future readers.Spell out the exact vars removed to prevent confusion for integrators glancing at the template.
Apply this diff:
-# Removed Polar and Autumn billing configurations +# Removed Polar and Autumn billing configurations (previously: AUTUMN_SECRET_KEY, VITE_AUTUMN_BACKEND_URL, VITE_AUTUMN_PRODUCT_PRO_ID)src/hooks/useUsageTracking.ts (1)
58-60: Reduce noisy warnings in production.Gate the warning behind a dev check to keep prod consoles clean.
Apply this diff:
- } catch (posthogError) { - // PostHog might be blocked by ad blockers - fail silently - console.warn('PostHog tracking failed (likely blocked by ad blocker):', posthogError); - } + } catch (posthogError) { + // PostHog might be blocked by ad blockers - fail silently + if (import.meta.env.DEV) { + console.warn('PostHog tracking failed (likely blocked by ad blocker):', posthogError); + } + }src/main.tsx (2)
5-7: PostHog imports look correct. Consider also importing the config type.Typing your options object helps catch typos in option names.
Apply this diff:
-import { PostHogProvider } from 'posthog-js/react' +import { PostHogProvider } from 'posthog-js/react' import * as Sentry from '@sentry/react' -import type { PostHog } from 'posthog-js'; +import type { PostHog, PostHogConfig } from 'posthog-js';
59-71: Type the PostHog options for stricter safety and typo detection.Prevents silent misconfigurations (aligns with the project’s strict TS stance).
Apply this diff:
-// Initialize PostHog with proper error handling -const posthogOptions = { +// Initialize PostHog with proper error handling +const posthogOptions: Partial<PostHogConfig> = { api_host: import.meta.env.VITE_PUBLIC_POSTHOG_HOST || 'https://app.posthog.com', capture_pageview: false, // Disable automatic pageview capture for better control disable_session_recording: import.meta.env.MODE === 'development', loaded: (posthog: PostHog) => { if (import.meta.env.MODE === 'development') console.log('PostHog loaded'); }, on_xhr_error: (failedRequest: unknown) => { // Gracefully handle blocked requests (ad blockers, etc.) console.warn('PostHog request blocked (likely by ad blocker)', failedRequest); } };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (5)
env-template.txt(1 hunks)src/components/ChatInterface.tsx(0 hunks)src/components/pricing/CustomPricingTable.tsx(1 hunks)src/hooks/useUsageTracking.ts(1 hunks)src/main.tsx(2 hunks)
💤 Files with no reviewable changes (1)
- src/components/ChatInterface.tsx
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-08-09T23:03:40.158Z
Learnt from: CR
PR: otdoges/zapdev#0
File: .cursor/rules/typescript-standards.mdc:0-0
Timestamp: 2025-08-09T23:03:40.158Z
Learning: Applies to **/*.{ts,tsx} : NEVER use `any` type - use proper TypeScript types
Applied to files:
src/main.tsx
📚 Learning: 2025-08-12T03:04:41.034Z
Learnt from: CR
PR: otdoges/zapdev#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-12T03:04:41.034Z
Learning: Applies to **/*.{ts,tsx} : Avoid using `any` and maintain strict type safety in TypeScript code
Applied to files:
src/main.tsx
📚 Learning: 2025-08-09T23:03:33.406Z
Learnt from: CR
PR: otdoges/zapdev#0
File: .cursor/rules/project-overview.mdc:0-0
Timestamp: 2025-08-09T23:03:33.406Z
Learning: Applies to **/*.{ts,tsx} : Strict TypeScript must be used with no 'any' types allowed
Applied to files:
src/main.tsx
📚 Learning: 2025-08-09T23:02:50.239Z
Learnt from: CR
PR: otdoges/zapdev#0
File: .cursor/rules/authentication-patterns.mdc:0-0
Timestamp: 2025-08-09T23:02:50.239Z
Learning: Applies to **/useAuth.@(ts|tsx) : Use the provided `useAuth` hook pattern for integrating Clerk and Convex authentication, including syncing Clerk user data to Convex and returning the correct authentication state.
Applied to files:
src/main.tsx
🧬 Code Graph Analysis (1)
src/main.tsx (2)
src/lib/convex.ts (1)
convex(9-9)src/hooks/useAuth.ts (1)
useAuth(16-46)
🔇 Additional comments (2)
env-template.txt (1)
39-39: No remaining references to removed environment variables found.I ran the provided ripgrep scan against
AUTUMN_SECRET_KEY,VITE_AUTUMN_BACKEND_URL, andVITE_AUTUMN_PRODUCT_PRO_IDand found zero matches in the codebase. Runtime code no longer depends on these vars.src/hooks/useUsageTracking.ts (1)
48-60: Hardened PostHog capture with guarded try/catch—LGTM.This prevents analytics failures (e.g., ad blockers) from bubbling up and breaking UX. Good safety net around a non-critical path.

Remove the lingering Autumn.js implementation and correctly configure PostHog to resolve console errors and improve analytics robustness.
Summary by CodeRabbit
New Features
Bug Fixes
Chores