Skip to content

[CI] (3f39e0e) next-js/15-pages-router-todo - #4165

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

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

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 3f39e0e
App: next-js/15-pages-router-todo
App directory: apps/next-js/15-pages-router-todo
Workbench branch: wizard-ci-3f39e0e-next-js-15-pages-router-todo
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-09-23T22:10:01.728Z
Duration: 519.1s

YARA Scanner

✓ 185 tool calls scanned, 0 violations detected

No violations: ✓ 185 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown
Author

Now I have all the context I need. Let me produce the evaluation.


PR Evaluation Report

Summary

This PR integrates PostHog into a Next.js 15 Pages Router todo app. It adds client-side initialization via instrumentation-client.ts, an ErrorBoundary component for exception tracking, custom event captures for todo CRUD operations, and server-side OTEL log exporting. The posthog-node package is installed but never imported or used anywhere in the codebase.

Files changed Lines added Lines removed
11 +174 -3

Confidence score: 3/5 🤔

  • Likely invalid OpenTelemetry package versions: @opentelemetry/* packages at ^0.222.0 — OpenTelemetry JS packages have never reached this version. This will cause npm install / pnpm install to fail, breaking the build entirely. [CRITICAL]
  • No user identification: No posthog.identify() or posthog.reset() calls anywhere in the app. Events cannot be linked to known users. [CRITICAL]
  • No reverse proxy configured: No Next.js rewrites or middleware proxy set up for PostHog, leaving client-side events vulnerable to ad blockers. [MEDIUM]
  • posthog-node installed but never used: The package is in package.json but never imported. Server-side "events" use only OTEL logs, which are not PostHog analytics events and cannot power funnels or insights. [MEDIUM]

File changes

Filename Score Description
instrumentation-client.ts 4/5 Client-side PostHog init with env var validation and error tracking. Uses older defaults: '2026-01-30' instead of latest '2026-05-30'.
components/ErrorBoundary.tsx 4/5 Custom class-based error boundary using posthog.captureException(). Solid implementation.
components/todos/todo-list.tsx 3/5 Adds three capture() calls for todo actions. todo_deleted has zero properties.
pages/_app.tsx 5/5 Wraps app with ErrorBoundary. Clean and minimal.
package.json 1/5 OTEL packages at non-existent ^0.222.0 versions. posthog-node installed but unused.
instrumentation.ts 3/5 Server-side OTEL log initialization. Functional but unconventional for PostHog.
lib/posthog-logs.ts 3/5 OTEL log exporter to PostHog's /i/v1/logs endpoint. Logs are not analytics events.
pages/api/todos/[id].ts 3/5 Emits OTEL logs for todo updates/deletes. Not PostHog capture events.
pages/api/todos/index.ts 3/5 Emits OTEL log for todo creation. Not PostHog capture events.
.env.example 5/5 Documents both required env vars.
.gitignore 5/5 Excludes .env.local.

App sanity check ❌

Criteria Result Description
App builds and runs No OpenTelemetry packages at ^0.222.0 do not exist and will fail dependency resolution
Preserves existing env vars & configs Yes Existing code and configs preserved
No syntax or type errors Yes TypeScript code is syntactically valid
Correct imports/exports Yes All imports resolve to valid packages and paths
Minimal, focused changes No posthog-node installed but unused; OTEL logging adds unnecessary complexity
Pre-existing issues None No pre-existing issues detected

Issues

  • Invalid OpenTelemetry package versions: @opentelemetry/api-logs, @opentelemetry/exporter-logs-otlp-http, and @opentelemetry/sdk-logs are specified at ^0.222.0. OpenTelemetry JS packages are still in the 0.5x range — version 0.222.0 does not exist on npm. This will cause dependency installation to fail. Fix: use valid versions (e.g., ^0.57.0 or latest). [CRITICAL]
  • posthog-node is unused: The package is listed in package.json but never imported anywhere in the application code. This adds unnecessary bundle weight. Fix: either remove the dependency or use it for server-side event capture in API routes instead of OTEL logs. [MEDIUM]
  • Outdated defaults: instrumentation-client.ts uses defaults: '2026-01-30' instead of the latest recommended '2026-05-30'. Fix: update to '2026-05-30'. [LOW]

Other completed criteria

  • Environment variables documented in .env.example
  • .env.local added to .gitignore
  • Build configuration scripts are correct (dev/build/start)

PostHog implementation ❌

Criteria Result Description
PostHog SDKs installed Yes posthog-js and posthog-node added to package.json
PostHog client initialized Yes posthog.init() in instrumentation-client.ts with env vars and capture_exceptions: true
capture() Yes Three client-side events: todo_created, todo_completion_changed, todo_deleted
identify() No No posthog.identify() or posthog.reset() calls anywhere in the app
Error tracking Yes Custom ErrorBoundary with posthog.captureException() and capture_exceptions: true in init
Reverse proxy No No Next.js rewrites or middleware proxy configured

Issues

  • No user identification: The app has no posthog.identify() call. All events are captured with anonymous IDs that can never be linked to a known user. There is also no posthog.reset() on logout. For a full-stack Next.js app, this is a significant gap. Fix: add posthog.identify(userId, { email, name }) after login/auth and posthog.reset() on logout. [CRITICAL]
  • No reverse proxy: No Next.js rewrites or middleware configured to proxy PostHog requests. Client-side events will be blocked by ad blockers. Fix: add rewrites in next.config.js or use PostHog's managed reverse proxy. [MEDIUM]
  • Server-side uses OTEL logs instead of PostHog events: The API routes emit OTEL logs to PostHog's log endpoint, but these are not proper PostHog analytics events. They cannot be used in funnels, trends, or retention charts. The installed posthog-node package is never used. Fix: use posthog-node to capture() server-side events instead of OTEL logs. [MEDIUM]

Other completed criteria

  • API key loaded from NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN environment variable
  • API host loaded from NEXT_PUBLIC_POSTHOG_HOST environment variable
  • instrumentation-client.ts is the correct file for Next.js client-side initialization
  • Error boundary properly wraps the app in _app.tsx

PostHog insights and events ⚠️

Filename PostHog events Description
components/todos/todo-list.tsx todo_created, todo_completion_changed, todo_deleted Client-side captures for core CRUD actions on todos
components/ErrorBoundary.tsx captureException Captures React component errors with component stack traces
instrumentation-client.ts autocaptured events capture_exceptions: true enables automatic exception tracking
lib/posthog-logs.ts OTEL logs (not PostHog events) Server-side OTEL log emissions — these are logs, not analytics events

Issues

  • todo_deleted has no properties: The todo_deleted event is captured with zero properties, making it impossible to analyze what was deleted or the context around deletion. Fix: add relevant properties like todo_id or was_completed. [MEDIUM]
  • Server-side operations only emit logs, not events: Todo CRUD on the server side emits OTEL logs that won't appear in PostHog's event stream. You cannot build funnels with client + server events because the server-side "events" are logs. [MEDIUM]

Other completed criteria

  • Events represent real user actions (creating, completing, deleting todos)
  • Client-side events enable basic product insights (can build a funnel: create → complete → delete)
  • No PII in event properties
  • Event names use descriptive snake_case 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