Skip to content

[CI] (22322bc) swift/hackers-ios - #3662

Closed
wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-22322bc-swift-hackers-ios
Closed

wizard-ci-bot[bot] wants to merge 1 commit into
mainfrom
wizard-ci-22322bc-swift-hackers-ios

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: swift/hackers-ios
App directory: apps/swift/hackers-ios
Workbench branch: wizard-ci-22322bc-swift-hackers-ios
Wizard branch: release-please--branches--main--components--wizard
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-08-28T19:46:30.052Z
Duration: 998.8s

YARA Scanner

✓ 137 tool calls scanned, 0 violations detected

No violations: ✓ 137 clean scans

@wizard-ci-bot

wizard-ci-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown
Author

Now I have all the information needed for the evaluation.


PR Evaluation Report

Summary

This PR integrates PostHog into an iOS Hacker News client app. It adds the PostHog iOS SDK via Swift Package Manager, initializes it in AppDelegate, adds event capture calls across navigation and web view interactions, and enables error tracking auto-capture. However, there is a critical issue: the API key and host are loaded exclusively from ProcessInfo.processInfo.environment, which only works when launching from Xcode and will cause PostHog to silently not initialize in production (TestFlight/App Store) builds.

Files changed Lines added Lines removed
7 +61 -1

Confidence score: 4/5 👍

  • CRITICAL: PostHog will not initialize in production builds. The token and host are loaded via ProcessInfo.processInfo.environment, which is only populated when launching from Xcode. In Archive/Release builds (TestFlight, App Store), these variables will be nil, the guard will fail, and configurePostHog() returns early — meaning zero events are ever captured in production. The PostHog docs recommend hardcoding the project token directly in code since it is a public client-side key.
  • MEDIUM: No identify() call. There is no call to PostHogSDK.shared.identify() anywhere in the app. The app has login functionality (showLogin()), but no user identification is wired up, so all events remain anonymous and cannot be tied to specific users.

File changes

Filename Score Description
App/AppDelegate.swift 2/5 Adds PostHog initialization using environment variables — correct structure but broken for production
App/EmbeddedWebView.swift 4/5 Adds 3 capture calls for share, open-in-Safari, and reload — appropriate and minimal
App/NavigationStore.swift 4/5 Adds 5 capture calls for post viewing, login, settings, and category selection — good coverage with properties
App/OnboardingCoordinator.swift 4/5 Adds onboarding_completed capture — appropriate
Hackers.xcodeproj/project.pbxproj 4/5 Correctly adds PBXBuildFile, XCSwiftPackageProductDependency, and XCRemoteSwiftPackageReference for PostHog
Package.resolved 4/5 Resolves posthog-ios to 3.70.1
.env.example 3/5 Documents env vars, but these env vars won't work in production iOS builds

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes SDK properly added via SPM; imports and calls use correct API
Preserves existing env vars & configs Yes Existing code and configs are untouched; PostHog additions are additive
No syntax or type errors Yes All Swift syntax is valid; PostHog API calls match the SDK's public interface
Correct imports/exports Yes import PostHog is correct for the iOS SDK
Minimal, focused changes Yes Only PostHog-related code added, no scope creep
Pre-existing issues None —

Issues

  • Environment variables do not work in production iOS builds: ProcessInfo.processInfo.environment only contains Xcode scheme environment variables during debug/simulator launches. In Archive/Release builds, these will be nil. The .env.example file is misleading for iOS — there is no .env loading mechanism in iOS apps. The token should be hardcoded in the binary as per PostHog's iOS documentation. [CRITICAL]

Other completed criteria

  • All imports resolve correctly (import PostHog in all files)
  • Build configuration (SPM dependency in pbxproj) is correctly structured with all three required objects
  • Existing app functionality is fully preserved

PostHog implementation ❌

Criteria Result Description
PostHog SDKs installed Yes posthog-ios added via SPM (version ≥3.59.3, resolved to 3.70.1)
PostHog client initialized No Initialization depends entirely on ProcessInfo.processInfo.environment which is empty in production builds — PostHog will never initialize outside of Xcode
capture() Yes 9 meaningful capture calls across 4 files
identify() No No identify() call anywhere despite the app having login functionality
Error tracking Yes config.errorTrackingConfig.autoCapture = true correctly enables automatic exception capture
Reverse proxy N/A Native iOS app — ad blocker bypass is not applicable

Issues

  • PostHog token loaded from environment variables only: The configurePostHog() method reads POSTHOG_PROJECT_TOKEN and POSTHOG_HOST from ProcessInfo.processInfo.environment. These are Xcode scheme env vars that do not exist in Archive/Release builds. The PostHog iOS docs explicitly state the project token is a public client-side key and should be set directly in code: PostHogConfig(projectToken: "<ph_project_token>", host: "https://us.i.posthog.com"). Reading env vars as an optional debug override is fine, but there must be a hardcoded fallback. [CRITICAL]
  • No user identification: The app has a showLogin() flow, but PostHogSDK.shared.identify() is never called. All events will remain anonymous with no way to tie them to specific users across sessions or devices. An identify() call should be added after successful login, and PostHogSDK.shared.reset() on logout. [MEDIUM]

Other completed criteria

  • PostHog SDK correctly added to dependencies via SPM with proper pbxproj structure
  • Error tracking auto-capture is properly enabled
  • API host is configured (though only via environment variable)

PostHog insights and events ✅

Filename PostHog events Description
EmbeddedWebView.swift web_content_shared, web_content_opened_in_safari, embedded_web_view_reloaded Tracks web view interactions: sharing, opening in Safari, and reloading
NavigationStore.swift post_opened, login_opened, settings_opened, feed_category_selected Tracks core navigation: viewing posts (with post_id), opening login/settings, and switching feed categories (with category name)
OnboardingCoordinator.swift onboarding_completed Tracks onboarding completion
AppDelegate.swift capturedException (via autoCapture) Automatic exception tracking enabled

Issues

  • No issues with event quality — events are well-named and represent real user actions.

Other completed criteria

  • Events represent real user actions (post viewing, sharing, navigation)
  • Events enable product insights (could build funnels: onboarding → post viewing → sharing)
  • Key events include properties (post_id, category name)
  • No PII in event properties
  • Consistent snake_case naming 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