Skip to content

Telemetry: every PostHog event says its environment (debug, testflight or appstore) - #1263

Merged
Skeyelab merged 3 commits into
mainfrom
telemetry-posthog-environment
Nov 23, 2026
Merged

Skeyelab merged 3 commits into
mainfrom
telemetry-posthog-environment

Conversation

@Skeyelab

@Skeyelab Skeyelab commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

App Store 1.2.14 went live today, and its PostHog events mix with TestFlight 1.2.14's: events carry $app_version but nothing that says which build sent them.

PostHogSink now takes the environment name SentrySink already gets (TelemetryEnvironment.name(isDebugBuild:isTestFlight:): debug, testflight or appstore) and puts it on every usage event as the property environment, the same name Sentry uses. AppTelemetry.launch() passes it in.

ADR 0007 (amended 2026-11-23) and the privacy page list the new property. It adds no new data type, so PrivacyInfo.xcprivacy and the App Store label don't change.

Test first

New test in PostHogSinkTests: "Every event says the build it came from: debug, testflight or appstore, the same name Sentry gets" (environmentOnEvents).

  • Red: swift test --filter TelemetrySinksTests failed to compile, extra argument 'environment' in call at PostHogSink(environment: "appstore", client: client).
  • Green: after the change, all 24 tests in TelemetrySinksTests pass.
  • A second test, "The app's sink takes the environment and calls the PostHog SDK only once started" (appSinkBeforeStart), runs the public PostHogSink(environment:) init, which codecov/patch counted as uncovered (60%, target 80%). It passed on its first run: it covers lines, it doesn't pin new behavior.
  • VERIFY_QUICK=1 ./scripts/verify.sh passed (spelling, vocabulary, package tests, site). The full ./scripts/verify.sh passed too (package tests, macOS build and AppTests, iOS Simulator build, site).

Checked by tests only, not on a device. The next TestFlight build's events in PostHog should show environment = testflight.

Assisted-by: Claude Code

…t or appstore)

PostHogSink now takes the same environment name SentrySink gets and puts it
on every usage event as `environment`, so App Store events can be told from
TestFlight and Debug ones. ADR 0007 and the privacy page list it.

Assisted-by: Claude Code
@Skeyelab
Skeyelab enabled auto-merge (squash) November 23, 2026 22:53
@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
App/AppTelemetry.swift 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Skeyelab
Skeyelab merged commit c6e6058 into main Nov 23, 2026
12 checks passed
Skeyelab added a commit that referenced this pull request Nov 23, 2026
…t or appstore) (#1263) (#1264)

* Telemetry: every PostHog event says its environment (debug, testflight or appstore)

PostHogSink now takes the same environment name SentrySink gets and puts it
on every usage event as `environment`, so App Store events can be told from
TestFlight and Debug ones. ADR 0007 and the privacy page list it.

Assisted-by: Claude Code

* Website: page dates for the privacy page change

Assisted-by: Claude Code

* Telemetry: test the app's PostHogSink init, for codecov/patch

Assisted-by: Claude Code
(cherry picked from commit c6e6058)
Skeyelab added a commit that referenced this pull request Nov 24, 2026
…1265)

v1.2.15 adds the distribution environment to usage events (#1263, #1264).
The changelog marks 1.2.14 as the App Store version (live 2026-11-23).

Assisted-by: Claude Code
Skeyelab added a commit that referenced this pull request Nov 24, 2026
…1266)

v1.2.15 adds the distribution environment to usage events (#1263, #1264).
The changelog marks 1.2.14 as the App Store version (live 2026-11-23).

Assisted-by: Claude Code
Skeyelab added a commit that referenced this pull request Nov 24, 2026
…1265)

v1.2.15 adds the distribution environment to usage events (#1263, #1264).
The changelog marks 1.2.14 as the App Store version (live 2026-11-23).

Assisted-by: Claude Code
(cherry picked from commit 17b0bc2)
Skeyelab added a commit that referenced this pull request Nov 24, 2026
…1265) (#1267)

v1.2.15 adds the distribution environment to usage events (#1263, #1264).
The changelog marks 1.2.14 as the App Store version (live 2026-11-23).

Assisted-by: Claude Code
(cherry picked from commit 17b0bc2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant