Skip to content

[CI] (edaca63) nuxt/movies-nuxt-3-6 - #2891

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-edaca63-nuxt-movies-nuxt-3-6
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-edaca63-nuxt-movies-nuxt-3-6

Conversation

@wizard-ci-bot

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

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: edaca63
App: nuxt/movies-nuxt-3-6
App directory: apps/nuxt/movies-nuxt-3-6
Workbench branch: wizard-ci-edaca63-nuxt-movies-nuxt-3-6
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-16T17:15:26.246Z
Duration: 221.8s

YARA Scanner

✓ 94 tool calls scanned, 0 violations detected

No violations: ✓ 94 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Author

Now I have enough context to write the full evaluation.


PR Evaluation Report

Summary

This PR integrates PostHog into a Nuxt 3.0-3.6 movies app using a client-side plugin (posthog.client.ts) with posthog-js and server-side event capture with posthog-node. It instruments authentication flows (login/logout), search, media detail views, and tab selections. User identification uses a SHA-256 hashed username as the distinct ID, which is a thoughtful approach to avoid PII leakage.

Files changed Lines added Lines removed
12 +173 -5

Confidence score: 4/5 👍

  • SSR crash for authenticated users: app.vue calls posthog.identify() directly in <script setup> without guarding for SSR. The posthog.client.ts plugin only provides `` on the client side — during SSR, posthog is `undefined`. If the `auth-analytics-id` cookie is set (i.e., the user is authenticated), this will throw `TypeError: Cannot read properties of undefined (reading 'identify')`, crashing the server render. Wrap in `onMounted()` or add a null check: `if (analyticsId.value && posthog) posthog.identify(analyticsId.value)`. [CRITICAL]
  • No reverse proxy configured: The client-side PostHog SDK sends events directly to us.i.posthog.com. Without a reverse proxy, ad blockers will intercept these requests, causing data loss. [MEDIUM]
  • No .env.example file: The required env vars (NUXT_PUBLIC_POSTHOG_PROJECT_TOKEN, NUXT_PUBLIC_POSTHOG_HOST) are not documented for collaborators. The setup report acknowledges this as a TODO but doesn't implement it. [MEDIUM]

File changes

Filename Score Description
plugins/posthog.client.ts 4/5 New client plugin initializing PostHog with runtime config, error tracking via vue:error hook. Uses undocumented __add_tracing_headers option.
app.vue 2/5 Adds identify for returning users but will crash during SSR when `` is undefined on the server.
composables/useAuth.ts 4/5 Clean integration of identify on login, capture on login/logout, and reset on logout.
nuxt.config.ts 5/5 Adds PostHog config under runtimeConfig.public following Nuxt 3 conventions.
package.json 5/5 Adds posthog-js and posthog-node dependencies correctly.
server/api/auth/login.post.ts 4/5 Server-side capture with posthog-node, proper flushAt: 1/flushInterval: 0 and shutdown(). Hashed analytics ID is good practice.
server/api/auth/logout.post.ts 4/5 Server-side logout event capture with proper shutdown.
pages/[type]/[id].vue 5/5 Media detail view capture inside onMounted() — correctly SSR-safe.
pages/search.vue 4/5 Search event capture on user interaction.
components/media/Details.vue 5/5 Tab selection tracking with descriptive event and properties.
types/nuxt-app.d.ts 3/5 Type declaration for `` but declares it as non-optional, hiding SSR null issues from TypeScript.
posthog-setup-report.md 3/5 Wizard output documentation; not strictly necessary.

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes Build compiles successfully, but SSR will crash for authenticated users due to undefined `` access in app.vue.
Preserves existing env vars & configs Yes Existing config preserved; PostHog config added additively under runtimeConfig.public.
No syntax or type errors Yes Valid syntax throughout. TypeScript won't catch the SSR issue because the type declaration marks `` as non-optional.
Correct imports/exports Yes All imports resolve correctly — posthog-js in client, posthog-node in server.
Minimal, focused changes Yes All changes are PostHog-related. The setup report is extraneous but not harmful.
Pre-existing issues .env file with full API key exists locally (not committed) Not introduced by this PR.

Issues

  • SSR crash in app.vue for authenticated users: posthog.identify() is called directly in <script setup> without an SSR guard. Since posthog.client.ts only provides `` on the client, posthog is `undefined` during SSR. When the `auth-analytics-id` cookie is set (authenticated user), this throws `TypeError`. Fix by wrapping in `onMounted()` or adding `if (analyticsId.value && posthog) posthog.identify(analyticsId.value)`. [CRITICAL]
  • Missing .env.example: Required environment variables NUXT_PUBLIC_POSTHOG_PROJECT_TOKEN and NUXT_PUBLIC_POSTHOG_HOST are not documented for collaborators. [MEDIUM]

Other completed criteria

  • Existing functionality and configs preserved
  • Dependencies correctly added to package.json
  • Runtime config follows Nuxt conventions
  • Server-side PostHog client properly initializes with flushAt: 1 and calls shutdown()

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-js ^1.402.3 and posthog-node ^5.44.0 added to dependencies in package.json.
PostHog client initialized Yes Client plugin posthog.client.ts initializes with posthog.init() using runtime config values for API key and host. Follows Nuxt 3.0-3.6 plugin pattern correctly.
capture() Yes Multiple meaningful capture calls: login_succeeded, logout_completed, search_submitted, media_details_viewed, media_tab_selected, plus server-side login_completed and logout_completed.
identify() Yes Called on login with hashed analytics ID (response.analyticsId), and attempted for returning users via cookie check in app.vue (though broken by SSR — see issues). posthog.reset() called on logout.
Error tracking Yes vue:error hook in the client plugin calls posthogClient.captureException(error). Server-side uses enableExceptionAutocapture: true.
Reverse proxy No No reverse proxy configured. Events sent directly to us.i.posthog.com, making them susceptible to ad blocker interception.

Issues

  • No reverse proxy: Client-side events go directly to PostHog's domain without a proxy, which ad blockers will likely intercept. Configure Nuxt server middleware or an external proxy to route /ingest/* to PostHog. [MEDIUM]
  • Undocumented __add_tracing_headers option: The plugin uses __add_tracing_headers: true, which is a private/internal option (prefixed with __). This is not documented and could break in future SDK versions. [LOW]

Other completed criteria

  • API key loaded from environment variable via runtimeConfig.public.posthog.publicKey
  • Host correctly configured from NUXT_PUBLIC_POSTHOG_HOST environment variable
  • Server-side PostHog Node client properly initialized with flushAt: 1, flushInterval: 0, and await posthog.shutdown()
  • posthog.reset() correctly called on logout
  • Hashed analytics ID (SHA-256 of username) used as distinct ID — avoids PII in distinct IDs

PostHog insights and events ✅

Filename PostHog events Description
composables/useAuth.ts login_succeeded, logout_completed Client-side auth flow tracking with identify on login and reset on logout.
server/api/auth/login.post.ts login_completed Server-side login confirmation event with session/distinct ID linking via tracing headers.
server/api/auth/logout.post.ts logout_completed Server-side logout event with distinct ID from cookie or tracing header.
pages/search.vue search_submitted Tracks when a user submits a search query.
pages/[type]/[id].vue media_details_viewed Tracks media detail page views with media_id and media_type properties.
components/media/Details.vue media_tab_selected Tracks tab selection (overview/videos/photos) with tab property.
plugins/posthog.client.ts captureException Captures Vue rendering errors via vue:error hook.

Issues

  • search_submitted lacks properties: The search event captures no properties (e.g., result count, search category). Adding non-PII contextual properties would improve analytics value. [LOW]

Other completed criteria

  • Events represent real user actions (login, logout, search, view details, select tab)
  • Events enable product insights — can build login→search→view→tab-select funnel
  • Media events enriched with media_id, media_type, and tab properties
  • No PII in event properties — uses hashed analytics ID, no emails/names in capture calls
  • Consistent snake_case naming convention across all events

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