Skip to content

[CI] (22322bc) javascript-node/native-http-contacts - #3641

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

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

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 22322bc
App: javascript-node/native-http-contacts
App directory: apps/javascript-node/native-http-contacts
Workbench branch: wizard-ci-22322bc-javascript-node-native-http-contacts
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-08-28T19:18:51.258Z
Duration: 343.6s

YARA Scanner

✓ 111 tool calls scanned, 0 violations detected

No violations: ✓ 111 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown
Author

PR Evaluation Report

Summary

This PR integrates PostHog into a native Node.js HTTP contacts API using the posthog-node SDK. It adds event capture for CRUD operations on contacts and groups, exception tracking in the error handler, graceful shutdown logic, and environment variable configuration via .env.example.

Files changed Lines added Lines removed
4 +66 -3

Confidence score: 5/5 🧙

  • All capture() calls are missing distinctId: The posthog-node SDK requires distinctId in every capture() call (e.g., posthog.capture({ distinctId: '...', event: '...' })). Every capture call in this PR omits it, meaning events will either error at runtime or be silently dropped. Since this is a server-only app with no session context, the integration needs a strategy to derive a distinct ID (e.g., from request headers, auth tokens, or IP). [CRITICAL]
  • captureException called with incorrect signature: posthog.captureException(err, undefined, { request_method, request_path }) passes three positional arguments; posthog-node's captureException expects (error, additionalProperties?) — two arguments. The additional context properties may be silently ignored. It also lacks distinctId. [MEDIUM]
  • enableExceptionAutocapture may not be a valid posthog-node config option: The Node SDK does not document this initialization option. The browser SDK uses capture_exceptions; the Node SDK has no equivalent autocapture mechanism built in. This option is likely silently ignored. [LOW]

File changes

Filename Score Description
posthog.js 3/5 New file initializing PostHog client from env vars with null fallback; good defensive coding but uses potentially invalid config option
index.js 2/5 Adds capture calls for CRUD events and exception tracking, but all calls are missing required distinctId
package.json 4/5 Adds posthog-node dependency and updates scripts to load env files
.env.example 5/5 Documents required environment variables

App sanity check ✅

Criteria Result Description
App builds and runs Yes App will install and start; capture failures are runtime-only
Preserves existing env vars & configs Yes All existing functionality preserved; PostHog additions are additive
No syntax or type errors Yes All JavaScript syntax is valid
Correct imports/exports Yes PostHog imported from posthog-node, local posthog.js module correctly imported
Minimal, focused changes Yes Only PostHog-related changes, no scope creep
Pre-existing issues None Base app appears functional

Issues

No app sanity issues.

Other completed criteria

  • Environment variables documented in .env.example
  • Build scripts updated to support env file loading
  • posthog-node added to dependencies with valid version
  • Graceful shutdown with posthog.shutdown() on SIGINT/SIGTERM

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-node ^5.51.4 added to package.json
PostHog client initialized Yes new PostHog(apiKey, { host }) in posthog.js with null fallback when env vars missing
capture() No All 4 capture calls are missing the required distinctId parameter
identify() N/A Server-only app
Error tracking No captureException called with 3 args instead of 2, also missing distinctId
Reverse proxy N/A Server-only app

Issues

  • Missing distinctId in all capture calls: posthog-node requires distinctId as a mandatory field in the capture({ distinctId, event, properties }) call object. All four capture() calls omit it entirely. Events will fail at runtime. The server should derive a distinct ID from the request context (e.g., an auth header, session cookie, or client IP) and pass it to each capture call. [CRITICAL]
  • Incorrect captureException signature: Called as posthog.captureException(err, undefined, { request_method, request_path }) with three arguments. The posthog-node method signature is captureException(error, additionalProperties?). The third argument with request context is likely ignored. Restructure to: posthog.captureException(err, { request_method: method, request_path: path }) and include a distinctId if available. [MEDIUM]
  • Invalid enableExceptionAutocapture config option: This option is not documented for posthog-node. The Node SDK does not have browser-style exception autocapture. This option is silently ignored. [LOW]

Other completed criteria

  • API key loaded from POSTHOG_API_KEY environment variable
  • Host loaded from POSTHOG_HOST environment variable
  • Graceful shutdown calls posthog.shutdown() to flush pending events
  • Defensive null checks (if (posthog)) before every SDK call

PostHog insights and events ⚠️

Filename PostHog events Description
index.js group_created Captured when a new contact group is created via POST /groups
index.js contact_created Captured when a new contact is created, includes group_id property
index.js contact_updated Captured on contact update, includes updated_fields array property
index.js contact_deleted Captured when a contact is deleted via DELETE /contacts/:id
index.js captureException Captures server errors with request_method and request_path context

Issues

  • Events not functional without distinctId: While the event names and properties are well-chosen and would enable product insights (CRUD funnel, update frequency analysis), none will actually arrive in PostHog due to the missing distinctId. [CRITICAL]

Other completed criteria

  • Event names are descriptive and use consistent snake_case convention
  • Events map to real CRUD user actions in the contacts API
  • contact_created enriched with group_id; contact_updated enriched with updated_fields
  • No PII in event properties
  • Events would enable funnel analysis (create → update → delete) if functional

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