Skip to content

[CI] (8dccaac) javascript-node/native-http-contacts - #2350

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-8dccaac-javascript-node-native-http-contacts
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-8dccaac-javascript-node-native-http-contacts

Conversation

@wizard-ci-bot

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

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 8dccaac
App: javascript-node/native-http-contacts
App directory: apps/javascript-node/native-http-contacts
Workbench branch: wizard-ci-8dccaac-javascript-node-native-http-contacts
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-07-03T00:26:36.981Z
Duration: 230.8s

YARA Scanner

✓ 17 tool calls scanned, 0 violations detected

No violations: ✓ 17 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates the posthog-node SDK into a native Node.js HTTP contacts API. It adds five business events (contact_created, contact_updated, contact_deleted, group_created, contacts_searched), exception tracking in the global error handler, and graceful shutdown hooks. The SDK is initialized with environment variables for the API key and host.

Files changed Lines added Lines removed
3 +118 -2

Confidence score: 4/5 👍

  • PII in event properties: contact_email and contact_name are included as regular event properties in contact_created, contact_updated, and contact_deleted capture calls. PII (emails, names) must not appear in capture() event properties — they belong exclusively in person properties (via ). The block in contact_created correctly places them on the person profile, but the duplicates in the event properties must be removed. [CRITICAL]
  • Raw email used as distinct_id: The contact_created, contact_updated, and contact_deleted events use body.email / contact.email as the distinctId. Using raw email addresses as distinct IDs is a PostHog anti-pattern — it leaks PII into the distinct_id field and creates fragmented user profiles since these contacts are not the application's users. Server-side events should use the requesting user's identity (e.g., from the x-posthog-distinct-id header already extracted) rather than the data subject's email. [CRITICAL]
  • No .env.example: The PR does not add or update a .env.example file documenting the required POSTHOG_API_KEY and POSTHOG_HOST variables. The setup report acknowledges this as a TODO but it should have been done. [MEDIUM]

File changes

Filename Score Description
apps/basic-integration/javascript-node/native-http-contacts/index.js 3/5 PostHog SDK initialization, 5 capture events, exception tracking, and graceful shutdown — but PII leaks in event properties and misuse of email as distinct_id
apps/basic-integration/javascript-node/native-http-contacts/package.json 5/5 Adds posthog-node dependency correctly
apps/basic-integration/javascript-node/native-http-contacts/posthog-setup-report.md 4/5 Setup report with event table, dashboard links, and next steps

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes No syntax errors; posthog-node added to dependencies
Preserves existing env vars & configs Yes Existing code structure, routes, and logic preserved
No syntax or type errors Yes All changes are syntactically valid JavaScript
Correct imports/exports Yes PostHog correctly imported from posthog-node
Minimal, focused changes Yes All changes relate to PostHog integration
Pre-existing issues .env file with real API key (phc_xxxx...CV6a) exists in the repo (not introduced by this PR) Should be gitignored

Issues

  • No .env.example file: POSTHOG_API_KEY and POSTHOG_HOST are required but not documented in a .env.example. Collaborators have no reference for required environment variables. [MEDIUM]

Other completed criteria

  • App builds without errors — valid JS, dependency added
  • Existing routes and logic fully preserved
  • Clean imports using the correct server-side SDK package
  • Graceful shutdown hooks added for SIGTERM and SIGINT to flush events

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-node@^5.39.4 added to package.json
PostHog client initialized Yes new PostHog(process.env.POSTHOG_API_KEY, { host, enableExceptionAutocapture }) — correct pattern for posthog-node
capture() Yes 5 capture calls across all mutating routes
identify() N/A Server-only app
Error tracking Yes posthog.captureException(err, distinctId) in the catch block; enableExceptionAutocapture: true in config
Reverse proxy N/A Server-only app

Issues

  • Raw email as distinct_id: contact_created uses body.email, and contact_updated/contact_deleted use contact.email as the distinctId. These contacts are data subjects, not application users — using their email as distinct_id creates orphan person profiles and leaks PII. All events should use the distinctId variable (from the x-posthog-distinct-id header) which is already extracted but unused for these routes. [CRITICAL]

Other completed criteria

  • API key and host correctly loaded from environment variables
  • posthog.shutdown() called on SIGTERM/SIGINT for graceful flush
  • enableExceptionAutocapture is a valid posthog-node config option
  • captureException(err, distinctId) matches the SDK's method signature

PostHog insights and events ⚠️

Filename PostHog events Description
index.js group_created Tracks group creation with group ID and name
index.js contacts_searched Tracks search/filter actions with query, group filter, and result count
index.js contact_created Tracks new contact creation with contact details and `` person properties
index.js contact_updated Tracks contact updates with updated field names
index.js contact_deleted Tracks contact deletion with contact details
index.js captureException Captures unhandled errors in the global catch block

Issues

  • PII in event properties: contact_email (email address) and contact_name (full name) appear as regular event properties in contact_created, contact_updated, and contact_deleted. These are PII and must not be in capture() event properties. The contact_created event already correctly uses `` for person properties — remove contact_email and `contact_name` from the regular properties in all three events. [CRITICAL]

Other completed criteria

  • Events represent real CRUD user actions (create, read/search, update, delete contacts and groups)
  • Events enable product insights — can build funnels (group_created → contact_created → contacts_searched), track churn signals via deletions
  • Events include enriched properties (result counts, updated field names, boolean flags for optional fields)
  • Event names are descriptive, 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