Repository navigation
[CI] (0ae2102) next-js/15-pages-router-todo - #1228
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
|
Now I have all the context needed. Let me produce the evaluation report. PR Evaluation ReportSummaryThis PR integrates PostHog into a Next.js 15 Pages Router todo application. It adds both client-side (
Confidence score: 4/5 👍
File changes
App sanity check
|
| Criteria | Result | Description |
|---|---|---|
| App builds and runs | Yes | No syntax errors; all imports resolve to valid packages and paths. |
| Preserves existing env vars & configs | Yes | Existing next.config.ts structure preserved; new rewrites added cleanly. |
| No syntax or type errors | Yes | TypeScript is valid; all new code uses proper types. |
| Correct imports/exports | Yes | posthog-js imported on client, posthog-node on server; no cross-environment imports. |
| Minimal, focused changes | Yes | All changes relate to PostHog integration; no scope creep. |
| Pre-existing issues | None | Base app is a clean todo app with no pre-existing issues. |
Issues
- No
.env.examplecommitted:.env.localis gitignored and contains the actual env vars, but there's no.env.exampleor equivalent documentation for required environment variables (NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN,NEXT_PUBLIC_POSTHOG_HOST). The setup report mentions them but a committed example file is the standard pattern. [MEDIUM]
Other completed criteria
- Build configuration is valid —
package.jsonhas proper scripts and dependencies - All changes are relevant to PostHog integration
- Code follows existing codebase patterns (TypeScript, consistent formatting)
- No unnecessary modifications to existing code
PostHog implementation ⚠️
| Criteria | Result | Description |
|---|---|---|
| PostHog SDKs installed | Yes | posthog-js@^1.369.0 and posthog-node@^5.29.2 added to package.json. |
| PostHog client initialized | Yes | Initialized in instrumentation-client.ts using the recommended Next.js 15.3+ pattern with posthog.init(). Server client uses singleton pattern in lib/posthog-server.ts. |
| capture() | Yes | Client-side captures for todo created, todo completed, todo reopened, todo deleted. Server-side captures mirror these. |
| identify() | N/A | App has no authentication system, so there's no opportunity to call identify(). |
| Error tracking | Yes | capture_exceptions: true in init config enables automatic exception capture. Manual posthog.captureException(error) calls in all catch blocks. |
| Reverse proxy | Yes | Properly configured via Next.js rewrites in next.config.ts: /ingest → https://us.i.posthog.com and /ingest/static → https://us-assets.i.posthog.com. Client api_host set to /ingest. |
Issues
- Server-side
distinctIdfalls back to literal'anonymous': When thex-posthog-distinct-idheader is missing, all server-side events usedistinctId: 'anonymous'. This means every anonymous request merges into a single PostHog person profile, corrupting analytics data. The server should either skip the capture or use a per-request unique identifier. [CRITICAL] - API key loaded from env var with non-standard name: The env var is
NEXT_PUBLIC_POSTHOG_PROJECT_TOKENinstead of the more commonNEXT_PUBLIC_POSTHOG_KEYorNEXT_PUBLIC_POSTHOG_TOKEN. This is functional but slightly non-conventional. [LOW]
Other completed criteria
- API key loaded from environment variable (
process.env.NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN) - Host correctly configured — client uses
/ingest(reverse proxy), server usesprocess.env.NEXT_PUBLIC_POSTHOG_HOSTpointing tohttps://us.i.posthog.com ui_hostset tohttps://us.posthog.comfor toolbar access- Server client uses
flushAt: 1andflushInterval: 0appropriate for short-lived API handlers
PostHog insights and events ⚠️
| Filename | PostHog events | Description |
|---|---|---|
components/todos/todo-list.tsx |
todo created, todo completed, todo reopened, todo deleted, captureException |
Client-side CRUD event tracking with properties (todo_id, has_description). Exception capture in all error handlers. |
pages/api/todos/index.ts |
todo created |
Server-side capture on POST with todo_id, has_description, source: 'api' properties. |
pages/api/todos/[id].ts |
todo updated, todo deleted |
Server-side capture on PATCH/DELETE with todo_id, completed, source: 'api' properties. |
instrumentation-client.ts |
Autocapture, captureException (automatic) |
Automatic pageviews, clicks, and exception autocapture via capture_exceptions: true. |
Issues
- Duplicate event names between client and server: Both client and server capture
todo createdandtodo deletedevents. While the server events includesource: 'api', the client events don't include asourceproperty, making deduplication in analytics harder. This could lead to double-counting in dashboards. [MEDIUM]
Other completed criteria
- Events represent real user actions (create, complete, reopen, delete todos)
- Events enable product insights — can build funnels (created → completed), trends, and lifecycle analysis
- Events include relevant properties (
todo_id,has_description,completed,source) - No PII in event properties — only todo IDs and boolean flags
- Event names are descriptive and consistently use
todo <action>convention
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:
0ae2102App:
next-js/15-pages-router-todoApp directory:
apps/next-js/15-pages-router-todoWorkbench branch:
wizard-ci-0ae2102-next-js-15-pages-router-todoWizard branch:
release-please--branches--main--components--wizardContext Mill branch:
mainPostHog (MCP) branch:
masterTimestamp: 2026-04-15T19:20:04.524Z
Duration: 253.6s