Skip to content

[CI] (38ef7e6) next-js/15-app-router-todo - #2595

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-38ef7e6-next-js-15-app-router-todo
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-38ef7e6-next-js-15-app-router-todo

Conversation

@wizard-ci-bot

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

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 38ef7e6
App: next-js/15-app-router-todo
App directory: apps/next-js/15-app-router-todo
Workbench branch: wizard-ci-38ef7e6-next-js-15-app-router-todo
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-09T19:18:09.574Z
Duration: 404.6s

YARA Scanner

✓ 35 tool calls scanned, 0 violations detected

No violations: ✓ 35 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 9, 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 App Router todo application. It adds client-side initialization via instrumentation-client.ts, a server-side PostHog singleton, custom event captures for CRUD todo operations on both client and server, exception tracking, and a reverse proxy via Next.js rewrites. Both posthog-js and posthog-node are added to dependencies.

Files changed Lines added Lines removed
9 +141 -0

Confidence score: 4/5 👍

  • No .env.example file created: The .env.local is gitignored (correctly), but no .env.example was created to document the required NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN and NEXT_PUBLIC_POSTHOG_HOST variables for collaborators. The setup report acknowledges this as a TODO. [MEDIUM]
  • No identify() call anywhere: This is a full-stack Next.js app but there is no posthog.identify() or posthog.reset() call. The app appears to lack authentication, so this may be partially justified, but for a complete integration identify should be wired in wherever user context is available. [MEDIUM]
  • Server-side events never call shutdown(): The API routes use a singleton getPostHogClient() but never call await posthog.shutdown(). With flushAt: 1 and flushInterval: 0, events fire immediately so data loss is unlikely in practice, but the PostHog docs explicitly recommend calling shutdown() in short-lived server contexts. Using a singleton with these settings is an acceptable pattern for Next.js API routes. [LOW]
  • Manual header forwarding instead of tracing_headers: The PR manually adds X-PostHog-Distinct-ID and X-PostHog-Session-ID headers to every fetch call. The PostHog docs recommend using the tracing_headers init option to automatically inject these headers. The manual approach works but is verbose and error-prone. [LOW]

File changes

Filename Score Description
instrumentation-client.ts 4/5 Client-side PostHog init via the recommended Next.js 15.3+ pattern. Uses reverse proxy, exception autocapture, and env vars. defaults uses 2026-01-30 instead of latest.
lib/posthog-server.ts 4/5 Server-side PostHog singleton with appropriate flushAt: 1 and flushInterval: 0 settings.
next.config.ts 5/5 Reverse proxy rewrites correctly configured with /ingest/static/* and /ingest/array/* routing to us-assets.i.posthog.com and catch-all to us.i.posthog.com.
components/todos/todo-list.tsx 4/5 Client-side captures for all CRUD actions with exception handling. Manual header forwarding is verbose but functional.
app/api/todos/route.ts 4/5 Server-side server_todo_created event with relevant properties.
app/api/todos/[id]/route.ts 4/5 Server-side server_todo_updated and server_todo_deleted events with relevant properties.
package.json 5/5 Both posthog-js and posthog-node added correctly.
.gitignore 5/5 .env.local added to gitignore.
posthog-setup-report.md 3/5 Setup report with event table and dashboard links. Acknowledges missing .env.example as a TODO.

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors, valid TypeScript, correct imports
Preserves existing env vars & configs Yes Existing code preserved, only PostHog additions made
No syntax or type errors Yes All files have valid syntax and correct TypeScript usage
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 Base app appears functional

Issues

  • No .env.example file: The PR creates .env.local (correctly gitignored) but does not create an .env.example to document required environment variables (NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN, NEXT_PUBLIC_POSTHOG_HOST). Collaborators won't know what to set. [MEDIUM]

Other completed criteria

  • Build configuration (package.json, next.config.ts) is valid with correct dependency versions
  • No unrelated modifications or reformatting
  • Correct framework-specific file conventions followed (instrumentation-client.ts at project root)

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js ^1.399.1 and posthog-node ^5.40.0 added to package.json
PostHog client initialized Yes Client initialized in instrumentation-client.ts (recommended for Next.js 15.3+); server singleton in lib/posthog-server.ts
capture() Yes 7 meaningful capture calls across client and server (todo CRUD operations)
identify() No No posthog.identify() call exists anywhere. The app has no visible auth system, but identify should still be wired in for when users are known. No posthog.reset() on logout either.
Error tracking Yes capture_exceptions: true in init config for autocapture, plus manual posthog.captureException(error) in catch blocks
Reverse proxy Yes Correctly configured via Next.js rewrites: /ingest/static/* and /ingest/array/* → us-assets.i.posthog.com, /ingest/* → us.i.posthog.com

Issues

  • Missing identify() implementation: No posthog.identify() call anywhere in the codebase. Even without current auth, a placeholder or documented TODO is expected. The server-side events fall back to 'anonymous' as distinctId when no header is present, which is a fabricated value. [MEDIUM]
  • Manual header forwarding vs tracing_headers: The PR manually adds X-PostHog-Distinct-ID and X-PostHog-Session-ID to every fetch call. Using tracing_headers in the posthog.init() config would automate this. [LOW]

Other completed criteria

  • API key loaded from NEXT_PUBLIC_POSTHOG_PROJECT_TOKEN environment variable (not hardcoded in source)
  • Host correctly configured — client uses /ingest reverse proxy, server uses NEXT_PUBLIC_POSTHOG_HOST env var
  • Correct SDK separation: posthog-js on client, posthog-node on server
  • Server-side client uses flushAt: 1 and flushInterval: 0 as recommended for Next.js

PostHog insights and events ⚠️

Filename PostHog events Description
components/todos/todo-list.tsx todo_created, todo_completed, todo_uncompleted, todo_deleted, captureException Client-side events for all CRUD user actions plus exception tracking in catch blocks
app/api/todos/route.ts server_todo_created Server-side event when a todo is created, includes todo_id and has_description
app/api/todos/[id]/route.ts server_todo_updated, server_todo_deleted Server-side events for update/delete with todo_id, completed status, and ``

Issues

  • todo_completed and todo_uncompleted lack properties: These events have no enriching properties (no todo_id, no context). Compare with todo_created which includes has_description. [MEDIUM]
  • todo_deleted lacks properties: No todo_id or other context included in the client-side delete event. [LOW]

Other completed criteria

  • Events represent real user actions (create, complete, uncomplete, delete todos)
  • Events enable product insights — can build creation-to-completion funnels, track deletion rates
  • Event names are descriptive and use consistent snake_case convention
  • No PII in event properties
  • Server-side events include enriching properties like todo_id, completed, has_description

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