Skip to content

[CI] (8dccaac) next-js/15-pages-router-todo - #2357

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-8dccaac-next-js-15-pages-router-todo
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-8dccaac-next-js-15-pages-router-todo

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 8dccaac
App: next-js/15-pages-router-todo
App directory: apps/next-js/15-pages-router-todo
Workbench branch: wizard-ci-8dccaac-next-js-15-pages-router-todo
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-03T00:36:41.801Z
Duration: 304.9s

YARA Scanner

✓ 39 tool calls scanned, 0 violations detected

No violations: ✓ 39 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown
Author

Now I have enough context to produce the evaluation.


PR Evaluation Report

Summary

This PR integrates PostHog into a Next.js 15 Pages Router todo application. It adds client-side initialization via instrumentation-client.ts, a server-side singleton client, a reverse proxy via Next.js rewrites, custom event captures for todo CRUD operations on both client and server, and error tracking via captureException. No user identification is implemented.

Files changed Lines added Lines removed
9 +139 -0

Confidence score: 4/5 👍

  • Hardcoded distinctId: 'anonymous' on server-side events: All server-side captures use a hardcoded string 'anonymous' as distinctId, making all server events appear as a single user. The API routes should extract a real user identifier or at minimum use the PostHog anonymous distinct ID from the client. [CRITICAL]
  • No identify() call anywhere: There is no posthog.identify() or posthog.reset() call in the app. While this is a todo app without explicit auth, the PR makes no attempt at user identification, which is a core PostHog requirement. [MEDIUM]
  • No .env.example for environment variables: The .env.local is gitignored (correctly), but there is no .env.example file documenting the required environment variables for collaborators. [MEDIUM]
  • API key committed in .env.local: The .env.local file contains the full API key phc_nmum54dVqUBEAmNrWgHdnRF8HRSCVQhxL6kRhy4GCV6a. While .env.local is gitignored, it was still readable during the CI run. [LOW]

File changes

Filename Score Description
instrumentation-client.ts 4/5 Correct client-side PostHog init using posthog-js with reverse proxy, exception capture, and debug mode
next.config.ts 5/5 Proper reverse proxy rewrites for /ingest/static/*, /ingest/array/*, and /ingest/*
lib/posthog-server.ts 4/5 Server-side singleton pattern with posthog-node, correct flushAt: 1 and flushInterval: 0
components/todos/todo-list.tsx 4/5 Good event captures in event handlers with relevant properties; error tracking in catch blocks
pages/api/todos/[id].ts 2/5 Server-side captures with hardcoded distinctId: 'anonymous'
pages/api/todos/index.ts 2/5 Server-side captures with hardcoded distinctId: 'anonymous'
package.json 5/5 Both posthog-js and posthog-node added correctly
.gitignore 5/5 Correctly ignores .env.local
posthog-setup-report.md N/A Documentation/report file

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors; imports and dependencies are correct
Preserves existing env vars & configs Yes Existing nextConfig object preserved, rewrites added cleanly
No syntax or type errors Yes All code is syntactically valid TypeScript
Correct imports/exports Yes posthog-js imported client-side, posthog-node server-side — correct separation
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues None No pre-existing issues observed

Issues

  • No .env.example file: The .env.local is gitignored but there is no .env.example documenting the required NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN and NEXT_PUBLIC_POSTHOG_HOST variables. [MEDIUM]

Other completed criteria

  • Build configuration is valid with correct package.json dependencies
  • No unrelated changes or gratuitous reformatting
  • Code follows existing codebase patterns and conventions

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js ^1.396.5 and posthog-node ^5.39.4 added to package.json
PostHog client initialized Yes Client initialized in instrumentation-client.ts with reverse proxy host; server client via singleton in lib/posthog-server.ts
capture() Yes Multiple meaningful client-side and server-side capture calls
identify() No No identify() call anywhere in the codebase. This is a full-stack Next.js app where identify should be implemented
Error tracking Yes capture_exceptions: true in init config plus manual captureException() calls in catch blocks
Reverse proxy Yes Properly configured via Next.js rewrites: /ingest/static/* and /ingest/array/* → us-assets.i.posthog.com, /ingest/* → us.i.posthog.com

Issues

  • Hardcoded distinctId: 'anonymous': All three server-side capture calls use distinctId: 'anonymous', which means every server event is attributed to one fake user. This defeats the purpose of server-side analytics. The code should extract a real identifier from the request (session, cookie, or header). [CRITICAL]
  • No identify() or reset() calls: The app has no user identification. Even though this is a simple todo app, a call to identify() should be present to properly link events to users. [MEDIUM]
  • API key loaded from env var: Yes, uses process.env.NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN! — correct pattern. [OK]
  • Host configured: Client uses /ingest (reverse proxy), server uses process.env.NEXT_PUBLIC_POSTHOG_HOST — correct. [OK]

Other completed criteria

  • SDK packages correctly added to dependencies
  • Client-side init follows the recommended instrumentation-client.ts pattern for Next.js
  • Server-side client uses singleton with flushAt: 1 and flushInterval: 0 as recommended
  • Reverse proxy correctly routes both /static/* and /array/* to us-assets.i.posthog.com
  • skipTrailingSlashRedirect: true set in next.config.ts as required for proxy
  • ui_host correctly set to allow toolbar access through the reverse proxy

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 events with relevant properties (todo_id, has_description, was_completed); exception tracking in catch blocks
pages/api/todos/index.ts server_todo_created Server-side event on POST with todo_id and has_description properties
pages/api/todos/[id].ts server_todo_updated, server_todo_deleted Server-side events on PATCH and DELETE with todo_id and completed status

Issues

  • Server events use hardcoded distinctId: Server-side events with distinctId: 'anonymous' cannot be linked to any real user, making them useless for per-user analysis or funnels that span client and server. [CRITICAL]

Other completed criteria

  • Events represent real user actions (create, complete, reopen, delete todos)
  • Events enable product insights — could build funnels (create → complete), retention charts, activity trends
  • Events include enriched properties (todo_id, has_description, was_completed, completed status)
  • No PII in event properties
  • Event names are descriptive and use consistent snake_case naming convention

Reviewed by wizard workbench PR evaluator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants