Skip to content

[CI] (c05eaeb) next-js/15-pages-router-todo#106

Closed
wizard-ci-bot[bot] wants to merge 1 commit intomainfrom
wizard-ci-c05eaeb-next-js-15-pages-router-todo
Closed

[CI] (c05eaeb) next-js/15-pages-router-todo#106
wizard-ci-bot[bot] wants to merge 1 commit intomainfrom
wizard-ci-c05eaeb-next-js-15-pages-router-todo

Conversation

@wizard-ci-bot
Copy link

@wizard-ci-bot wizard-ci-bot bot commented Jan 14, 2026

Automated wizard CI run

Trigger ID: c05eaeb
App: next-js/15-pages-router-todo
App directory: apps/next-js/15-pages-router-todo
Workbench branch: wizard-ci-c05eaeb-next-js-15-pages-router-todo
Wizard branch: main
Examples branch: main
PostHog (MCP) branch: master
Timestamp: 2026-01-14T16:15:33.871Z
Duration: 198.5s

@wizard-ci-bot
Copy link
Author

wizard-ci-bot bot commented Jan 14, 2026

Now I have all the information I need. Let me compile the evaluation:


PR Evaluation Report

Summary

This PR integrates PostHog analytics into a Next.js 15 Pages Router Todo app. It adds client-side PostHog initialization via instrumentation-client.ts, configures a reverse proxy for ad-blocker circumvention, and instruments all CRUD operations with custom events and exception tracking.

Files changed Lines added Lines removed
6 +480 -2

Confidence score: 3/5 🤔

  • instrumentation-client.ts is incorrect for Pages Router apps: The instrumentation-client.ts file is a Next.js 15.3+ App Router feature and does NOT work with Pages Router. PostHog should be initialized in _app.tsx instead. [CRITICAL]
  • Missing posthog.identify() implementation: No user identification is set up, limiting the ability to associate events with specific users. [MEDIUM]
  • Automatic pageview tracking not configured: PostHog capture_pageview option is not set, and no manual pageview tracking exists for route changes in Pages Router. [MEDIUM]

File changes

Filename Score Description
components/todos/todo-list.tsx 4/5 Well-structured event tracking for all CRUD operations with error handling and captureException calls
instrumentation-client.ts 2/5 Wrong initialization approach - this file pattern only works with App Router, not Pages Router
next.config.ts 5/5 Correctly configured reverse proxy rewrites for PostHog to bypass ad blockers
package.json 5/5 Correct addition of posthog-js dependency
pnpm-lock.yaml 5/5 Lock file properly updated with all transitive dependencies
posthog-setup-report.md 3/5 Well-documented but incorrectly claims instrumentation-client.ts works for Pages Router

App sanity check: 2/5 ❌

Criteria Result Description
App builds and runs No instrumentation-client.ts won't be auto-loaded in Pages Router - PostHog will NOT initialize
Preserves existing env vars & configs Yes Existing code structure preserved, new env vars added
No syntax or type errors Yes All TypeScript is syntactically correct
Correct imports/exports Yes Imports are valid
Minimal, focused changes Yes Changes are appropriately scoped to PostHog integration

Issues

  • Wrong initialization pattern for Pages Router: instrumentation-client.ts is an App Router (Next.js 15.3+) feature that relies on the app directory's automatic loading mechanism. Pages Router apps require PostHog initialization in _app.tsx. The current implementation means PostHog will not initialize at all and no events will be captured. Move initialization to _app.tsx using a useEffect hook or PostHogProvider pattern. [CRITICAL]
  • .env file committed to repository: The .env file contains the PostHog API key and is included in the PR. While PostHog public keys are not secrets, committing .env files is generally poor practice. Consider using .env.example instead. [LOW]

Other completed criteria

  • TypeScript types are properly used
  • Error handling preserves existing console.error behavior
  • No breaking changes to existing UI components
  • reactStrictMode: true and skipTrailingSlashRedirect: true are appropriate additions

PostHog implementation: 2/5 ❌

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.321.1 added to dependencies
PostHog client initialized No instrumentation-client.ts will NOT be loaded in Pages Router - initialization is non-functional
capture() Yes Multiple posthog.capture() calls implemented for all CRUD operations
identify() No No posthog.identify() calls to associate events with users
Error tracking Yes posthog.captureException() called in all catch blocks with capture_exceptions: true
Reverse proxy Yes Properly configured in next.config.ts with rewrites to /ingest

Issues

  • PostHog will not initialize: The instrumentation-client.ts approach does not work with Pages Router. PostHog must be initialized in _app.tsx. Without initialization, all posthog.capture() calls in todo-list.tsx will be no-ops. [CRITICAL]
  • No pageview tracking: Automatic pageview capture is not configured (capture_pageview option not set), and there's no manual pageview tracking for route changes via Next.js Router events. [MEDIUM]
  • No user identification: posthog.identify() is never called. Without identification, all events appear as anonymous users, limiting analytics value. [MEDIUM]
  • NEXT_PUBLIC_POSTHOG_HOST env var unused: The instrumentation-client.ts hardcodes api_host: "/ingest" but the setup report claims it uses NEXT_PUBLIC_POSTHOG_HOST. This inconsistency is confusing. [LOW]

Other completed criteria

  • Exception tracking enabled via capture_exceptions: true
  • Debug mode correctly configured for development
  • defaults: '2025-05-24' option included
  • Reverse proxy correctly routes to US PostHog instance
  • No PII captured in event properties

PostHog insights and events: 4/5 ✅

Filename PostHog events Description
todo-list.tsx todo_created, todo_completed, todo_uncompleted, todo_deleted Core user actions tracked - enables funnel analysis (create → complete), engagement metrics, and deletion patterns
todo-list.tsx todos_fetch_failed, todo_create_failed, todo_update_failed, todo_delete_failed Error tracking events with error messages - enables reliability monitoring
todo-list.tsx captureException (4 locations) Unhandled exceptions captured for error tracking dashboard

Issues

  • Events won't actually be captured: Due to the initialization issue, these well-designed events will never reach PostHog. [CRITICAL]
  • Missing pageview events: No `` events captured, limiting session analysis. [MEDIUM]

Other completed criteria

  • Events represent real user actions (create, complete, delete todos)
  • Properties include relevant context (todo_id, has_description, error)
  • Error events paired with success events for conversion analysis
  • Events follow consistent naming convention (todo_<action>, todo_<action>_failed)
  • No PII in event properties

Reviewed by wizard workbench PR evaluator

@wizard-ci-bot wizard-ci-bot bot added the CI/CD label Jan 14, 2026
@wizard-ci-bot wizard-ci-bot bot closed this Jan 14, 2026
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