Skip to content

feat: Expose enableCompression on ObjcLDConfig - #543

Open
abelonogov-ld wants to merge 3 commits into
v11from
andrey/event-compression-default-on
Open

abelonogov-ld wants to merge 3 commits into
v11from
andrey/event-compression-default-on

Conversation

@abelonogov-ld

@abelonogov-ld abelonogov-ld commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Follows #399, which added LDConfig.enableCompression as an opt-in.

Describe the solution you've provided

enableCompression stays opt-in (default false), because older relay proxy versions do not accept gzip-encoded event payloads. This PR makes the setting reachable from Objective-C and covers both settings in tests; there is no behavior change for existing applications.

  • ObjcLDConfig.enableCompression: exposes the Swift setting to Objective-C (default NO).
  • DarklyServiceSpec: a default request carries no Content-Encoding and sends the payload as is; with compression enabled it carries Content-Encoding: gzip and the body gunzips to the payload.
  • LDConfigSpec: a default config has compression disabled, and the Objective-C property reads and writes the underlying config.

Describe alternatives you've considered

Turning compression on by default. The client SDK cannot tell whether its events URL is a relay proxy, or which version, so a default of true would break applications sending events through an older relay proxy on upgrade.

Additional context

Verified: LDConfigSpec and DarklyServiceSpec on macOS, 64 tests, 0 failures.


Note

Overview
Exposes the existing enableCompression setting on ObjcLDConfig so Objective-C apps can control whether analytics/diagnostic event bodies are gzip-encoded, with docs noting the default is off for older relay-proxy compatibility and that direct-to-LaunchDarkly customers should enable it.

Adds tests that lock in current behavior: LDConfig / ObjcLDConfig default to compression disabled, the Obj-C getter/setter updates the wrapped Swift config, and DarklyService.publishEventData sends an uncompressed body with no Content-Encoding unless compression is turned on (then gzip and a gunzippable body).

Reviewed by Cursor Bugbot for commit 1f1c8fb. Bugbot is set up for automated code reviews on this repo. Configure here.

LDConfig.enableCompression now defaults to true, so analytics and diagnostic
event payloads are sent gzip-encoded using the SDK's existing compression.
Applications sending events through a relay proxy that does not accept
gzip-encoded payloads can set it to false.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abelonogov-ld
abelonogov-ld requested a review from a team as a code owner October 20, 2026 00:15

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9d04f1b. Configure here.

Comment thread LaunchDarkly/LaunchDarkly/Models/LDConfig.swift Outdated
Objective-C applications sending events through a relay proxy that does
not accept gzip-encoded payloads need a way to opt out of the new default.

Co-authored-by: Cursor <cursoragent@cursor.com>
Older relay proxy versions do not accept gzip-encoded event payloads, so
enableCompression stays opt-in. The Objective-C setting and the tests
remain, with the default reversed.

Co-authored-by: Cursor <cursoragent@cursor.com>
@abelonogov-ld abelonogov-ld changed the title feat: Compress event payloads with gzip by default feat: Expose enableCompression on ObjcLDConfig Oct 20, 2026

This branch has not been deployed

No deployments
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