Repository navigation
chore!: remove experimental screenshotModeBackgroundCapture - #937
Merged
turnipdabeets merged 1 commit intoOct 10, 2026
Merged
turnipdabeets merged 1 commit into
turnipdabeets merged 1 commit into
Conversation
Screenshots are always captured on the main thread with the settle-then-shoot path. Removes the opt-in off-main render path, its sweptRects mask helper and the tests that only covered it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
posthog-ios Compliance ReportDate: 2026-10-09 23:06:39 UTC
|
| Test | Status | Duration |
|---|---|---|
| Format Validation.Event Has Required Fields | ✅ | 3326ms |
| Format Validation.Event Has Uuid | ✅ | 2873ms |
| Format Validation.Event Has Lib Properties | ✅ | 2760ms |
| Format Validation.Distinct Id Is String | ✅ | 2826ms |
| Format Validation.Token Is Present | ✅ | 2938ms |
| Format Validation.Custom Properties Preserved | ✅ | 2982ms |
| Format Validation.Event Has Timestamp | ✅ | 2997ms |
| Retry Behavior.Retries On 503 | ✅ | 11836ms |
| Retry Behavior.Does Not Retry On 400 | ✅ | 4908ms |
| Retry Behavior.Does Not Retry On 401 | ✅ | 4756ms |
| Retry Behavior.Respects Retry After Header | ✅ | 7815ms |
| Retry Behavior.Implements Backoff | ✅ | 21683ms |
| Retry Behavior.Retries On 500 | ✅ | 9393ms |
| Retry Behavior.Retries On 502 | ✅ | 9267ms |
| Retry Behavior.Retries On 504 | ✅ | 9350ms |
| Retry Behavior.Max Retries Respected | ❌ | 19213ms |
| Deduplication.Generates Unique Uuids | ✅ | 3144ms |
| Deduplication.Preserves Uuid On Retry | ✅ | 5520ms |
| Deduplication.Preserves Uuid And Timestamp On Retry | ✅ | 10441ms |
| Deduplication.Preserves Uuid And Timestamp On Batch Retry | ✅ | 7907ms |
| Deduplication.No Duplicate Events In Batch | ✅ | 2989ms |
| Deduplication.Different Events Have Different Uuids | ✅ | 2974ms |
| Compression.Sends Gzip When Enabled | ✅ | 2797ms |
| Batch Format.Uses Proper Batch Structure | ✅ | 2833ms |
| Batch Format.Flush With No Events Sends Nothing | ✅ | 269ms |
| Batch Format.Multiple Events Batched Together | ✅ | 2862ms |
| Error Handling.Does Not Retry On 403 | ✅ | 4804ms |
| Error Handling.Does Not Retry On 413 | ✅ | 2351ms |
| Error Handling.Retries On 408 | ✅ | 9120ms |
Failures
retry_behavior.max_retries_respected
Expected 4 requests, got 6
Feature_Flags Tests
✅ 16/16 tests passed
View Details
| Test | Status | Duration |
|---|---|---|
| Request Payload.Request With Person Properties Device Id | ✅ | 2831ms |
| Request Payload.Flags Request Uses V2 Query Param | ✅ | 2831ms |
| Request Payload.Flags Request Hits Flags Path Not Decide | ✅ | 2737ms |
| Request Payload.Flags Request Omits Authorization Header | ✅ | 2722ms |
| Request Payload.Token In Flags Body Matches Init | ✅ | 2991ms |
| Request Payload.Groups Round Trip | ✅ | 2745ms |
| Request Payload.Groups Default To Empty Object | ✅ | 2877ms |
| Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It | ✅ | 3001ms |
| Request Payload.Disable Geoip False Propagates As Geoip Disable False | ✅ | 2829ms |
| Request Payload.Disable Geoip Omitted Defaults To False | ✅ | 2730ms |
| Request Payload.Flag Keys To Evaluate Contains Only Requested Key | ✅ | 2848ms |
| Request Lifecycle.No Flags Request On Init Alone | ✅ | 129ms |
| Request Lifecycle.No Flags Request On Normal Capture | ✅ | 466ms |
| Request Lifecycle.Two Flag Calls Produce Two Remote Requests | ✅ | 5623ms |
| Request Lifecycle.Mock Response Value Is Returned To Caller | ✅ | 2800ms |
| Side Effect Events.Get Feature Flag Captures Feature Flag Called Event | ✅ | 3163ms |
dustinbyrne
approved these changes
Oct 10, 2026
turnipdabeets
deleted the
chore/v4-remove-screenshot-background-capture
branch
October 10, 2026 01:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #873 (iOS 4.0).
💡 Motivation and Context
PostHogSessionReplayConfig.screenshotModeBackgroundCapturewas added in #594 as an opt-in workaround. It rendered replay screenshots off the main thread becausedrawHierarchyon main was too slow to keep up. UIKit documentsdrawHierarchyas main-thread-only, so the flag shipped as experimental, with Main Thread Checker warnings and a possible freeze on the first capture. It also needed its own capture path: sample the masks, render off-main, sample again, then mask the union of both samples (#786).The main-thread cost it worked around has since been dealt with, so we don't need the flag in 4.0:
UIGraphicsImageRendererwith a lightweight CoreGraphics renderer. That cut main-thread screenshot cost by about 92% on an iPhone XR (about 135 ms to about 11 ms per snapshot).screenshotMode". This PR drops that bullet.Changes
screenshotModeBackgroundCaptureproperty and its branch insnapshot(), so every capture goes throughscheduleSettledCapture.performBracketedBackgroundCaptureand thesweptRectshelper, which only it used, plus the 8sweptRectstests and their test-audit rows.💚 How did you test it?
make testOniOSSimulator: 1527 tests passed.make test(macOS): 1124 tests ran. 2 app-group storage tests failed with a group-container permission error (NSCocoaErrorDomain 513). They fail the same way on the base branch, so they're specific to this machine and unrelated to this change.make buildSdk: iOS, macOS, Mac Catalyst, tvOS, watchOS, visionOS and SPM (with and without traits) all built.swiftlintandswiftformat --linton the changed files: no new findings.make apiCheck: the only change from this PR is the removedscreenshotModeBackgroundCaptureline. The check still fails, because the base branch's snapshot is missing the@Sendableclosure signatures from the sendable-callbacks change. That needs ascripts/check-public-api.sh --updateon chore!: iOS Major Release 4.0 #873.Follow-ups outside this repo
ios/PosthogReactNativeSessionReplay.swiftfrom posthog-js'sscreenshotModeBackgroundCaptureoption. It pins posthog-ios~> 3.xtoday, so nothing breaks yet, but that line has to go when it moves to 4.0.session-replay/_snippets/ios-installation.mdxandsession-replay/installation/react-native.mdx. They suggest it for jank on 120 Hz iPhones, so the docs need updating when 4.0 ships.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Claude Code (Claude Opus 5.5) wrote the removal and ran the validation. No tests were added because this only removes code. The 8 deleted tests covered
sweptRects, which nothing calls after the background path is gone. I kept the defensive main-thread hop inUIView.toImageand only updated its comment, to keep the change small. The 2 macOS storage failures and the API snapshot drift were checked against the base branch before they were attributed to it.🤖 Generated with Claude Code