Skip to content

[CI] (624abe2) astro/astro-hybrid-marketing - #4451

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-624abe2-astro-astro-hybrid-marketing
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-624abe2-astro-astro-hybrid-marketing

Conversation

@wizard-ci-bot

@wizard-ci-bot wizard-ci-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

Automated wizard CI run

Source: wizard-pr
Trigger ID: 624abe2
App: astro/astro-hybrid-marketing
App directory: apps/astro/astro-hybrid-marketing
Workbench branch: wizard-ci-624abe2-astro-astro-hybrid-marketing
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-10-08T09:06:25.126Z
Duration: 371.9s

YARA Scanner

✓ 160 tool calls scanned, 0 violations detected

No violations: ✓ 160 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown
Author

Now I have everything needed. Let me produce the evaluation.


PR Evaluation Report

Summary

This PR integrates PostHog into an Astro hybrid marketing site using the HTML snippet for client-side tracking (via a posthog.astro component in the layout) and posthog-node for server-side event capture in the contact form API route. It also adds OpenTelemetry-based log ingestion to PostHog.

Files changed Lines added Lines removed
8 +172 -1

Confidence score: 3/5 🤔

  • Missing distinctId in server-side capture() call: The posthog.capture() call on line 52 of contact.ts omits the required distinctId field. posthog-node requires distinctId for every capture call — this will cause a TypeScript compilation error or a runtime failure. The error path on line 99 correctly reads X-PostHog-Distinct-Id from headers but the success path does not. [CRITICAL]
  • No identify() call on client side: The PostHog snippet initializes correctly but never calls posthog.identify(). For a marketing site with a contact form that collects user info, identify should be called to link the anonymous session to the user. [MEDIUM]
  • No reverse proxy configured: Client-side snippet sends events directly to PostHog host, making them susceptible to ad blockers on a marketing site where this matters most. [MEDIUM]
  • Unused posthog-js in package.json: The posthog-js npm package is added as a dependency but never imported — the integration uses the HTML snippet instead. This is dead weight. [MEDIUM]

File changes

Filename Score Description
.env.example 4/5 Adds PUBLIC_POSTHOG_PROJECT_TOKEN and PUBLIC_POSTHOG_HOST with correct Astro PUBLIC_ prefix
.gitignore 5/5 Adds .env to gitignore
package.json 3/5 Adds posthog-node, posthog-js (unused), and 4 OpenTelemetry packages for logging
src/components/posthog.astro 4/5 PostHog snippet with is:inline, env var validation, define:vars pattern. Uses older snippet (missing -assets subdomain) and older defaults date
src/layouts/Layout.astro 5/5 Correctly imports and places PostHog component in <head>
src/lib/posthog-logs.ts 4/5 OpenTelemetry log exporter setup for PostHog logs endpoint. Well-structured singleton pattern
src/lib/posthog-server.ts 4/5 Server-side PostHog Node client with singleton pattern, proper flushAt: 1 and flushInterval: 0 for short-lived requests
src/pages/api/contact.ts 2/5 Missing required distinctId in capture() call; error path correctly reads header but success path does not

App sanity check ⚠️

Criteria Result Description
App builds and runs No Missing required distinctId in posthog.capture() will cause TypeScript error with posthog-node types
Preserves existing env vars & configs Yes Existing code and configs preserved; PostHog additions are additive
No syntax or type errors No posthog.capture({ event, properties }) missing required distinctId field
Correct imports/exports Yes All imports resolve correctly
Minimal, focused changes No OpenTelemetry logging setup (4 extra deps, 53-line file) goes beyond basic PostHog integration
Pre-existing issues None Base app appears clean

Issues

  • Missing distinctId in server-side capture: posthog.capture() on line 52 of contact.ts omits the required distinctId parameter. The posthog-node SDK requires distinctId for every capture call. Fix: read X-PostHog-Distinct-Id from request headers (as done in the error path on line 99) and pass it as distinctId. [CRITICAL]
  • Unused posthog-js dependency: posthog-js is added to package.json but the integration uses the HTML snippet loaded from CDN. Remove posthog-js from dependencies. [MEDIUM]
  • Scope creep with OpenTelemetry logging: Four OpenTelemetry packages and a 53-line log exporter file are added for PostHog log ingestion. While functional, this exceeds a basic PostHog integration. [MEDIUM]

Other completed criteria

  • Environment variables documented in .env.example
  • Build configuration (package.json) is structurally valid
  • .env added to .gitignore

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes PostHog HTML snippet for client-side; posthog-node@^5.55.0 for server-side
PostHog client initialized Yes Client: snippet in posthog.astro with is:inline. Server: singleton in posthog-server.ts with flushAt: 1, flushInterval: 0
capture() No Server-side capture() missing required distinctId — event will fail
identify() No No posthog.identify() call anywhere in the integration
Error tracking No Server-side has enableExceptionAutocapture: true and captureException in the error path, but client-side has no error tracking at all
Reverse proxy No No reverse proxy configured; snippet sends directly to PostHog host

Issues

  • Missing distinctId in capture call: The posthog.capture() call in the success path of contact.ts omits distinctId. The error path correctly reads it from X-PostHog-Distinct-Id header but the success path does not. Fix: read the header and pass distinctId in both paths. [CRITICAL]
  • No client-side identify: No posthog.identify() call exists. For a marketing site with a contact form, identify should be called when the user submits the form (e.g., using the form data). [MEDIUM]
  • No reverse proxy: Marketing sites are prime candidates for ad-blocker interference. Configure a reverse proxy to route PostHog traffic through your domain. [MEDIUM]
  • Older snippet version: The snippet uses p.src=s.api_host+'/static/array.js' instead of the newer s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js" pattern. [LOW]
  • Outdated defaults date: Uses defaults: '2026-01-30' instead of latest '2026-05-30'. [LOW]
  • No client-side error tracking: The snippet does not enable exception autocapture. Consider adding capture_exceptions: true to the init config. [LOW]

Other completed criteria

  • API key loaded from PUBLIC_POSTHOG_PROJECT_TOKEN environment variable (not hardcoded)
  • API host loaded from PUBLIC_POSTHOG_HOST environment variable
  • is:inline directive correctly used on script tag per Astro docs
  • PUBLIC_ prefix used for client-side env vars per Astro convention
  • PostHog component correctly placed in Layout <head>
  • Server-side client uses proper singleton pattern with flush settings for short-lived requests
  • tracing_headers configured on client to send distinct ID to server

PostHog insights and events ⚠️

Filename PostHog events Description
src/pages/api/contact.ts contact_form_submitted Server-side capture of form submission with interest and source properties (broken due to missing distinctId)
src/pages/api/contact.ts captureException Server-side exception capture in error path with distinct ID from header
src/lib/posthog-logs.ts OTLP logs: contact_form_processed Structured log events with severity, outcome, interest, and response status
src/components/posthog.astro Autocaptured events Pageviews, clicks, and other autocaptured events via the snippet

Issues

  • Server capture will fail: The contact_form_submitted event cannot be sent without distinctId. This is the only custom capture call in the integration. [CRITICAL]

Other completed criteria

  • Events represent real user actions (contact form submission)
  • Events could enable product insights (form submission funnel by interest type)
  • Events include relevant properties (interest, source, outcome)
  • No PII in event properties (email/name correctly excluded from capture properties)
  • Event names are descriptive and use snake_case convention
  • Log events include structured attributes for debugging

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