Skip to content

[CI] (c212e50) next-js/15-pages-router-todo - #4322

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

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

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: c212e50
App: next-js/15-pages-router-todo
App directory: apps/next-js/15-pages-router-todo
Workbench branch: wizard-ci-c212e50-next-js-15-pages-router-todo
Wizard branch: posthog/functional-r9-19-bring-docs-readmes-and-skills-in-line-wi
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-10-01T19:33:57.379Z
Duration: 320.9s

YARA Scanner

✓ 151 tool calls scanned, 0 violations detected

No violations: ✓ 151 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown
Author

Now I have everything I need to 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, custom event captures for CRUD operations, an error boundary with captureException, and server-side OpenTelemetry logging to PostHog's logs endpoint. No user identification or reverse proxy is configured.

Files changed Lines added Lines removed
11 +170 -3

Confidence score: 5/5 🧙

  • No posthog.identify() call anywhere in the app — all events are anonymous, preventing linking of sessions, replays, and errors to known users [MEDIUM]
  • No reverse proxy configured — next.config.ts has no rewrites, so client-side events are vulnerable to ad blockers [MEDIUM]
  • Server-side uses OpenTelemetry logging instead of posthog-node for event capture — this only sends logs, not proper PostHog events with distinct_id [MEDIUM]
  • defaults: '2026-01-30' is outdated; current docs specify '2026-05-30' [LOW]

File changes

Filename Score Description
instrumentation-client.ts 4/5 Client-side PostHog init with env validation; outdated defaults date
instrumentation.ts 3/5 OpenTelemetry logging setup; register() body is mostly empty beyond env checks
lib/posthog-logs.ts 3/5 OTel log helper for API routes; functional but unconventional approach
components/ErrorBoundary.tsx 4/5 Custom error boundary with captureException; correct implementation
components/todos/todo-list.tsx 5/5 Clean event captures in handlers for todo CRUD operations
pages/_app.tsx 5/5 Wraps app with ErrorBoundary correctly
pages/api/todos/[id].ts 4/5 Adds OTel logging for update/delete; async handler conversion correct
pages/api/todos/index.ts 4/5 Adds OTel logging for create; correct async conversion
package.json 4/5 Adds posthog-js and OTel dependencies
.env.example 5/5 Documents required env vars
.gitignore 5/5 Prevents .env from being committed

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes Packages install correctly; syntax is valid
Preserves existing env vars & configs Yes Existing code structure preserved; only additions
No syntax or type errors Yes TypeScript types are correct across all files
Correct imports/exports Yes All imports resolve; @/instrumentation path alias works
Minimal, focused changes Yes Changes are PostHog-focused, though OTel logging adds scope
Pre-existing issues None Base app appears clean

Issues

  • Outdated defaults config: defaults: '2026-01-30' in instrumentation-client.ts should be '2026-05-30' per current PostHog docs. [LOW]

Other completed criteria

  • Environment variables documented in .env.example with placeholder values
  • .gitignore updated to exclude .env file
  • Build configuration includes all necessary dependencies
  • Handlers correctly converted from sync to async for await flushPostHogLogs()

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js@^1.435.6 added to package.json
PostHog client initialized Yes posthog.init() in instrumentation-client.ts with env var validation
capture() Yes Three meaningful captures: todo_created, todo_completion_updated, todo_deleted
identify() No No posthog.identify() call anywhere; all events are anonymous
Error tracking Yes Custom ErrorBoundary with captureException + capture_exceptions: true in init config
Reverse proxy No next.config.ts has no rewrites; no proxy configured

Issues

  • No user identification: There is no posthog.identify() call in the app. For a full-stack Next.js app, identify() should be called after login or when user context is available to link events, session replays, and errors to known users. Add identify in a login handler or _app.tsx when user data is available. [MEDIUM]
  • No reverse proxy: The next.config.ts has no rewrites configured. Next.js rewrites are the standard way to proxy PostHog requests and avoid ad blocker interference. Add rewrites for /ingest/* pointing to the PostHog host. [MEDIUM]
  • No posthog-node for server-side: The server-side uses OpenTelemetry logging rather than posthog-node for event capture. This means server-side operations only produce logs, not proper PostHog events with distinct_id that appear in the activity feed and can be used in funnels. Consider installing posthog-node for server-side event capture. [MEDIUM]

Other completed criteria

  • API key loaded from NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN environment variable (not hardcoded)
  • API host loaded from NEXT_PUBLIC_POSTHOG_HOST environment variable
  • Initialization correctly placed in instrumentation-client.ts per Next.js docs
  • Error boundary wraps entire app in _app.tsx
  • capture_exceptions: true enables automatic exception autocapture

PostHog insights and events ⚠️

Filename PostHog events Description
components/todos/todo-list.tsx todo_created, todo_completion_updated, todo_deleted Client-side captures for todo CRUD operations with properties
components/ErrorBoundary.tsx captureException Captures React rendering errors
instrumentation-client.ts capture_exceptions: true Enables automatic exception autocapture
pages/api/todos/index.ts OTel log: "Todo created through API" Server-side log for create operation
pages/api/todos/[id].ts OTel logs: "Todo updated/deleted through API" Server-side logs for update/delete operations

Issues

  • Server-side logs are not PostHog events: The OTel logs sent via logTodoApiOperation go to PostHog's /i/v1/logs endpoint, which populates the logs view but not the events/activity feed. These cannot be used in funnels, trends, or retention analysis. If server-side event capture is desired, use posthog-node capture(). [MEDIUM]

Other completed criteria

  • Events represent real user actions (creating, completing, deleting todos)
  • Events enable product insights (todo creation funnel, completion rates, deletion patterns)
  • Events include relevant properties (has_description, completed status)
  • No PII in event properties
  • Event names use consistent snake_case convention and are descriptive

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