Skip to content

[CI] (f51b3be) nuxt/movies-nuxt-4 - #2640

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-f51b3be-nuxt-movies-nuxt-4
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-f51b3be-nuxt-movies-nuxt-4

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: f51b3be
App: nuxt/movies-nuxt-4
App directory: apps/nuxt/movies-nuxt-4
Workbench branch: wizard-ci-f51b3be-nuxt-movies-nuxt-4
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-09T22:36:23.175Z
Duration: 340.8s

YARA Scanner

✓ 127 tool calls scanned, 0 violations detected

No violations: ✓ 127 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 9, 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 4 movies app using @posthog/nuxt and posthog-node. It adds client-side event tracking (navigation clicks, search, media views, login/logout), server-side event capture in API routes, user identification via a custom hash function, and error tracking across both client and server.

Files changed Lines added Lines removed
16 +257 -28

Confidence score: 4/5 👍

  • Fabricated distinct_id via weak hash function: getPostHogDistinctId() creates a 32-bit hash of the username (user_) instead of using the username directly. This weak hash is collision-prone — different usernames can map to the same distinct_id, silently merging unrelated users in PostHog. The identify() call also passes no person properties (email, name), losing enrichment. [CRITICAL]
  • No reverse proxy configured: The client-side posthog-js (via @posthog/nuxt) sends requests directly to us.i.posthog.com, making them susceptible to ad blockers. No Nuxt rewrite rules or proxy configuration is present. [MEDIUM]
  • No .env.example or documentation for env vars: NUXT_PUBLIC_POSTHOG_KEY and NUXT_PUBLIC_POSTHOG_HOST are referenced but not documented in any .env.example file. The setup report acknowledges this as a TODO. [MEDIUM]
  • Unnecessary refactoring in Card.vue: All prop accesses were changed from implicit (item.id) to explicit (props.item.id) — this is gratuitous reformatting unrelated to PostHog integration. [LOW]

File changes

Filename Score Description
nuxt.config.ts 4/5 Adds @posthog/nuxt module, configures posthogConfig with env vars, enables exception capture
package.json 5/5 Adds @posthog/nuxt and posthog-node dependencies
utils/posthog.ts 2/5 Custom hash function for distinct_id — weak, collision-prone, unnecessary
server/utils/posthog.ts 4/5 Singleton PostHog Node client, follows Nuxt docs pattern
composables/useAuth.ts 3/5 Adds identify on existing sessions, captureException on login errors; uses fabricated distinct_id
pages/login.vue 4/5 Captures login success/failure events with properties; uses fabricated distinct_id for identify
components/NavBar.vue 5/5 Clean navigation click tracking and logout event with posthog.reset()
components/media/Card.vue 3/5 Adds media selection tracking, but includes unnecessary prop access refactoring
pages/[type]/[id].vue 4/5 Captures media detail views with relevant properties
pages/person/[id].vue 4/5 Captures person detail views with relevant properties
pages/search.vue 4/5 Captures search submissions and exceptions on fetch errors
error.vue 5/5 Captures exceptions on Nuxt error page
server/api/auth/login.post.ts 3/5 Server-side login tracking; double readBody in catch block is fragile
server/api/auth/logout.post.ts 4/5 Server-side logout tracking with session context
server/api/index.ts 4/5 Captures API root requests — low-value event but not harmful
posthog-setup-report.md N/A Setup documentation (not code)

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes @posthog/nuxt module properly added, valid Nuxt config
Preserves existing env vars & configs Yes All existing config preserved; PostHog config added alongside
No syntax or type errors Yes Valid Vue/TypeScript syntax throughout
Correct imports/exports Yes posthog-node import, usePostHog composable, ~/utils/posthog all resolve correctly
Minimal, focused changes No Card.vue has unnecessary prop access refactoring (item.id → props.item.id)
Pre-existing issues None noted

Issues

  • Unnecessary refactoring in Card.vue: All template references changed from item.id to props.item.id throughout the component. This is unrelated to PostHog and adds noise to the diff. [LOW]
  • Double readBody in login.post.ts catch block: The catch block calls readBody(event) again after it was already consumed in the try block. While .catch(() => null) prevents a crash, the body will likely be empty, making the error-path username extraction unreliable. [LOW]

Other completed criteria

  • All changes relate to PostHog integration (aside from minor Card.vue refactoring)
  • Correct files modified for Nuxt framework (nuxt.config.ts, composables, server utils, pages, components)
  • Code follows existing codebase patterns (Vue SFCs, Nuxt composables, server event handlers)
  • Environment variables documented in setup report (though not in .env.example)
  • Build configuration is valid (package.json has correct dependency entries)

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes @posthog/nuxt ^1.7.80 and posthog-node ^5.40.0 added to dependencies
PostHog client initialized Yes Via @posthog/nuxt module in nuxt.config.ts with posthogConfig; server client via singleton useServerPostHog()
capture() Yes Multiple meaningful capture calls across pages, components, and server routes
identify() No Uses fabricated hash-based distinct_id via getPostHogDistinctId() — a 32-bit hash that's collision-prone. No person properties passed to identify()
Error tracking Yes capture_exceptions: true in client config, captureException() calls in error.vue, login, search; server-side captureException in login handler
Reverse proxy No No reverse proxy configured; requests go directly to PostHog host

Issues

  • Fabricated distinct_id via weak hash: getPostHogDistinctId() uses a simple 32-bit hash ((hash << 5) - hash + charCode) to derive user_ from the username. This is a DJB2-like hash with only ~4 billion possible values — collision risk is real for any non-trivial user base. Different usernames producing the same hash would merge unrelated users in PostHog. The username itself (already a string identifier from the auth system) should be used directly as the distinct_id, or a proper UUID should be generated and stored. Additionally, identify() is called without any person properties (email, name), losing the enrichment opportunity. [CRITICAL]
  • No reverse proxy: Client-side PostHog requests go directly to us.i.posthog.com, making them vulnerable to ad blockers. Nuxt supports server middleware or rewrite rules that could proxy PostHog requests. [MEDIUM]
  • Missing env var documentation: NUXT_PUBLIC_POSTHOG_KEY and NUXT_PUBLIC_POSTHOG_HOST are not in any .env.example file. [MEDIUM]

Other completed criteria

  • API key loaded from environment variables (process.env.NUXT_PUBLIC_POSTHOG_KEY)
  • Host correctly configured from environment variables (process.env.NUXT_PUBLIC_POSTHOG_HOST)
  • Server-side PostHog client follows Nuxt docs singleton pattern
  • posthog.reset() correctly called on logout
  • Exception autocapture enabled on both client and server

PostHog insights and events ⚠️

Filename PostHog events Description
pages/login.vue user_logged_in, user_login_failed, captureException Tracks login success/failure with auth method and surface; captures login errors
components/NavBar.vue navigation_item_clicked, user_logged_out Tracks nav clicks with destination; logout with surface; calls reset()
components/media/Card.vue media_result_selected Tracks media selection with ID, type, and source query
pages/[type]/[id].vue media_details_viewed Tracks detail page views with media ID, type, and recommendation presence
pages/person/[id].vue person_details_viewed Tracks person page views with biography and image availability
pages/search.vue media_search_submitted, captureException Tracks search submissions with query length; captures fetch errors
error.vue captureException Captures Nuxt error page exceptions
server/api/auth/login.post.ts server_login_succeeded, user_login_failed, captureException Server-side login tracking with session context
server/api/auth/logout.post.ts server_logout_succeeded Server-side logout tracking
server/api/index.ts api_root_requested Tracks API root endpoint hits — low-value event

Issues

  • api_root_requested is low-value: Capturing every hit to the API root endpoint adds noise without meaningful product insight. This endpoint likely receives health checks and bot traffic. [LOW]
  • media_details_viewed fires during SSR setup: The capture call in pages/[type]/[id].vue is in the top-level <script setup> without a lifecycle guard, so it may fire during SSR. usePostHog() returns undefined on server, so the optional chaining protects against errors, but the event simply won't fire on server-rendered navigations — only client-side ones. This is inconsistent behavior. [LOW]

Other completed criteria

  • Events represent real user actions (login, search, navigation, content viewing)
  • Events enable product insights (login funnel, content discovery, search behavior)
  • Events include relevant contextual properties (media_id, media_type, authentication_method, etc.)
  • No PII in event properties — usernames are not included in capture properties
  • Event names are descriptive and use consistent 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