Repository navigation
[CI] (963eeb8) fastapi/fastapi3-ai-saas - #3805
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
Closed
wizard-ci-bot[bot] wants to merge 1 commit into
wizard-ci-bot[bot] wants to merge 1 commit into
Conversation
Author
PR Evaluation ReportSummaryThis PR integrates PostHog into a FastAPI AI SaaS application using the Python SDK (instance-based API). It adds initialization in the lifespan handler, a custom ASGI middleware for request-scoped identity context, event captures across auth, API key, content generation, and settings routes, and error tracking via both autocapture and a manual 500 handler.
Confidence score: 5/5 🧙
File changes
App sanity check ✅
IssuesNo issues found.
|
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog>=7.45.3 added to requirements.txt |
| PostHog client initialized | Yes | Posthog() constructor in lifespan with enable_exception_autocapture=True; atexit.register(posthog_client.shutdown) for cleanup |
| capture() | Yes | 8 meaningful capture calls across auth, generation, API keys, and settings routes |
| identify() | N/A | Server-only app |
| Error tracking | Yes | enable_exception_autocapture=True in constructor + manual capture_exception(exc) in 500 handler + context auto-capture in middleware |
| Reverse proxy | N/A | Server-only app |
Issues
No issues found.
Other completed criteria
- API key and host loaded from environment variables via Pydantic Settings
- PostHog client stored on
app.stateand accessed safely withgetattr(..., None)fallback - Middleware uses
new_context(fresh=True)withidentify_context()per the documented context API pattern flush()called in lifespan shutdown;shutdown()registered withatexit- Auth routes correctly create nested fresh contexts for login/signup since the user isn't authenticated when the middleware runs
- Person properties set via
posthog_client.set()(correct — Python SDK has noidentify()method)
PostHog insights and events ✅
| Filename | PostHog events | Description |
|---|---|---|
app/routers/auth.py |
user_logged_in, user_signed_up, user_logged_out |
Auth funnel tracking with login_method/signup_method properties; person properties (email, credits) set via set() |
app/routers/generate.py |
content_generated |
Core product action with generation_type, credits_used, prompt_length, credits_remaining |
app/routers/api_keys.py |
api_key_created, api_key_revoked |
API key lifecycle with active_api_key_count |
app/routers/settings.py |
settings_updated, password_changed |
Account management actions; email person property updated via set() |
app/main.py |
capturedException |
500 error handler captures exceptions via capture_exception() |
Issues
No issues found.
Other completed criteria
- Events represent real user actions mapping to actual product flows (signup → login → generate content)
- Events enable product insights: signup-to-generation funnel, credit usage trends, API key management retention
- Events enriched with relevant properties (generation type, credits, prompt length, login method)
- No PII in event properties — email only in
set()person property calls - Consistent snake_case naming convention across all events
Reviewed by wizard workbench PR evaluator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated wizard CI run
Source: wizard-pr
Trigger ID:
963eeb8App:
fastapi/fastapi3-ai-saasApp directory:
apps/fastapi/fastapi3-ai-saasWorkbench branch:
wizard-ci-963eeb8-fastapi-fastapi3-ai-saasWizard branch:
release-please--branches--main--components--wizardContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-09-03T18:13:20.211Z
Duration: 382.2s
YARA Scanner