Skip to content

[CI] (17b1423) swift/hackers-ios#981

Closed
wizard-ci-bot[bot] wants to merge 7 commits intomainfrom
wizard-ci-17b1423-swift-hackers-ios
Closed

[CI] (17b1423) swift/hackers-ios#981
wizard-ci-bot[bot] wants to merge 7 commits intomainfrom
wizard-ci-17b1423-swift-hackers-ios

Conversation

@wizard-ci-bot
Copy link

@wizard-ci-bot wizard-ci-bot bot commented Mar 24, 2026

Automated wizard CI run

Source: manual
Trigger ID: 17b1423
App: swift/hackers-ios
App directory: apps/swift/hackers-ios
Workbench branch: wizard-ci-17b1423-swift-hackers-ios
Wizard branch: main
Context Mill branch: main
PostHog (MCP) branch: master
Timestamp: 2026-03-24T16:37:03.046Z
Duration: 527.1s

@wizard-ci-bot
Copy link
Author

wizard-ci-bot bot commented Mar 24, 2026

PR Evaluation Report

Summary

This PR integrates the PostHog iOS SDK into a Hacker News iOS client app ("Hackers"). It adds PostHog as an SPM dependency to the main Xcode project and four feature packages, creates a PostHogAnalytics helper for initialization, instruments 12 analytics events across authentication, feed, comments, and settings ViewModels, and configures environment variables in the Xcode scheme.

Files changed Lines added Lines removed
14 +303 -68

Confidence score: 4/5 👍

  • PII in event properties: The user_logged_in and login_failed events include username as an event property. Usernames should be set via person properties (e.g., in identify()) rather than attached to every event capture call. [MEDIUM]
  • Hardcoded API key in Xcode scheme: The scheme file contains value = "phx_API_KEY_IS_HARDCODED" — while this is a placeholder/dummy value, the scheme file is committed to version control, meaning any real key set here would be exposed. The PostHogEnv pattern correctly reads from environment variables at runtime, but the scheme's committed placeholder is misleading and the naming literally says "hardcoded." [MEDIUM]
  • No error tracking: There is no PostHog exception/error tracking integration (e.g., PostHogSDK.shared.captureException() or similar crash reporting setup). Only application-level error events are captured manually. [MEDIUM]
  • Username used as distinct_id in identify(): PostHogSDK.shared.identify(username, ...) uses the HN username as the distinct ID. Usernames are not ideal distinct IDs — a stable internal user ID would be better — but given this is a third-party HN client where the username IS the unique identifier, this is acceptable for this context. [LOW]

File changes

Filename Score Description
.github/workflows/wizard-ci.yml 3/5 CI workflow changes — not related to PostHog app integration
App/PostHogAnalytics.swift 5/5 New file: clean PostHogEnv enum + PostHogAnalytics setup helper following framework rules exactly
App/HackersApp.swift 5/5 Calls PostHogAnalytics.setup() in SwiftUI App init — correct pattern
Features/Authentication/Package.swift 5/5 Adds posthog-ios SPM dependency correctly
Features/Authentication/.../LoginViewModel.swift 3/5 Identify + capture events; username as event property is PII concern
Features/Comments/Package.swift 5/5 Adds posthog-ios SPM dependency correctly
Features/Comments/.../CommentsViewModel.swift 5/5 Good event captures for comments_viewed and comment_upvoted with properties
Features/Feed/Package.swift 5/5 Adds posthog-ios SPM dependency correctly
Features/Feed/.../FeedViewModel.swift 5/5 Comprehensive event tracking: upvote, bookmark, search, category change
Features/Settings/Package.swift 5/5 Adds posthog-ios SPM dependency correctly
Features/Settings/.../SupportViewModel.swift 4/5 Purchase events well tracked; error.localizedDescription in properties is borderline
Hackers.xcodeproj/project.pbxproj 5/5 Three correct pbxproj objects (PBXBuildFile, XCSwiftPackageProductDependency, XCRemoteSwiftPackageReference)
Hackers.xcodeproj/.../Hackers.xcscheme 3/5 Environment variables set but with literal "phx_API_KEY_IS_HARDCODED" placeholder committed
posthog-setup-report.md N/A Setup report, not code

App sanity check ⚠️

Criteria Result Description
App builds and runs Yes All SPM dependencies correctly declared, imports valid, syntax correct
Preserves existing env vars & configs Yes Existing functionality preserved; only additions made
No syntax or type errors Yes All Swift syntax is valid; PostHogSDK API usage matches documented patterns
Correct imports/exports Yes import PostHog used correctly in all feature modules
Minimal, focused changes No CI workflow changes (+120/-58 lines) are unrelated to PostHog integration
Pre-existing issues None No pre-existing issues noted

Issues

  • CI workflow changes are unrelated: The .github/workflows/wizard-ci.yml changes (timeout, macOS gh install, step refactoring) are infrastructure changes unrelated to the PostHog integration. [LOW]

Other completed criteria

  • Environment variables documented in Xcode scheme
  • Build configuration is valid — SPM packages correctly added to all necessary Package.swift files and project.pbxproj
  • All imports resolve to correct packages

PostHog implementation ⚠️

Criteria Result Description
PostHog SDKs installed Yes posthog-ios v3.48.0 added via SPM in project.pbxproj and four feature Package.swift files
PostHog client initialized Yes PostHogConfig(apiKey:host:) + PostHogSDK.shared.setup(config) in SwiftUI App init() via PostHogAnalytics.setup() — follows docs exactly
capture() Yes 12 meaningful capture calls across 4 ViewModels
identify() Yes PostHogSDK.shared.identify(username, userProperties:) on login, PostHogSDK.shared.reset() on logout — correct pattern
Error tracking No No PostHog exception/crash tracking configured (e.g., captureException). Only manual error event captures for business logic failures.
Reverse proxy N/A iOS native app — reverse proxy not applicable

Issues

  • No error/exception tracking: The PR captures business-logic error events (login_failed, purchase_failed) but does not set up PostHog's error/exception tracking feature for crash reporting. [MEDIUM]
  • API key placeholder committed in scheme: The Xcode scheme file contains value = "phx_API_KEY_IS_HARDCODED" which is committed to source control. While the runtime reads from environment variables correctly via PostHogEnv, the scheme value literally says "hardcoded" and would need manual replacement for actual use. [MEDIUM]

Other completed criteria

  • API key loaded from environment variable via PostHogEnv enum with ProcessInfo.processInfo.environment — follows framework rules exactly
  • Host correctly configured via environment variable, set to https://us.i.posthog.com in scheme
  • Three distinct pbxproj objects created with unique UUIDs (PBXBuildFile, XCSwiftPackageProductDependency, XCRemoteSwiftPackageReference)
  • captureApplicationLifecycleEvents = true enabled for automatic lifecycle tracking
  • PostHogSDK.shared.reset() called on logout — follows best practices

PostHog insights and events ⚠️

Filename PostHog events Description
LoginViewModel.swift user_logged_in, login_failed, user_logged_out Authentication lifecycle: login success with identify, login failure, logout with reset
FeedViewModel.swift post_upvoted, feed_category_changed, post_bookmarked, post_searched Core feed interactions: voting, browsing, bookmarking, searching
CommentsViewModel.swift comments_viewed, comment_upvoted Comment engagement tracking with post context
SupportViewModel.swift purchase_completed, purchase_failed, purchases_restored Monetization funnel: purchase success/failure and restoration

Issues

  • PII in event properties: user_logged_in and login_failed events include "username": username as an event property. The username is already set as a person property via identify() — including it again in event properties is redundant and puts PII on individual events rather than the person profile. [MEDIUM]

Other completed criteria

  • Events represent real user actions mapped to actual product flows (authentication, content engagement, monetization)
  • Events enable product insights — can build login funnels, engagement trends, purchase conversion funnels, search analysis
  • Events include relevant contextual properties (post_id, post_title, post_type, result_count, product_id, etc.)
  • Event names are descriptive, consistent snake_case convention

Reviewed by wizard workbench PR evaluator

@wizard-ci-bot wizard-ci-bot bot added the CI/CD label Mar 24, 2026
@wizard-ci-bot wizard-ci-bot bot closed this Mar 24, 2026
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.

1 participant