Skip to content

fix(surveys): prevent color hex overflow - #795

Merged
dustinbyrne merged 2 commits into
mainfrom
fix/survey-color-hex-overflow
Sep 3, 2026
Merged

fix(surveys): prevent color hex overflow#795
dustinbyrne merged 2 commits into
mainfrom
fix/survey-color-hex-overflow

Conversation

@dustinbyrne

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Fixes #794.

Survey appearance colors come from remote config and are passed to UIColor(hex:). Seven-digit values were expanded beyond 32 bits, while values longer than eight digits remained too wide, causing Swift to trap when narrowing the parsed value to UInt32.

This change right-pads seven-digit values with one zero, preserves exactly eight digits, and truncates longer values to their first eight digits before parsing. Existing shorter color formats keep their current behavior.

💚 How did you test it?

  • make test — 765 tests passed
  • make testOniOSSimulator — 875 tests passed, including the new regression test
  • make lint — passed with pre-existing warnings
  • pnpm changeset status — recognized the patch changeset
  • make buildSdk — iOS, macOS, Mac Catalyst, and Swift Package builds passed; the remaining platform builds could not run because the local Xcode installation does not include the tvOS 26.5 runtime

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Added and validated a patch changeset.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Implemented with the Pi coding agent after the human directed the normalization behavior and discussed the backend reachability. A fresh read-only reviewer found no blockers. The agent session is not linked because it contains a test-project credential.

@dustinbyrne dustinbyrne self-assigned this Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

posthog-ios Compliance Report

Date: 2026-09-02 04:37:38 UTC
Duration: 224566ms

✅ All Tests Passed!

45/45 tests passed


Capture Tests

29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields 2917ms
Format Validation.Event Has Uuid 2767ms
Format Validation.Event Has Lib Properties 2817ms
Format Validation.Distinct Id Is String 2789ms
Format Validation.Token Is Present 2725ms
Format Validation.Custom Properties Preserved 310ms
Format Validation.Event Has Timestamp 2802ms
Retry Behavior.Retries On 503 11668ms
Retry Behavior.Does Not Retry On 400 4793ms
Retry Behavior.Does Not Retry On 401 4723ms
Retry Behavior.Respects Retry After Header 7822ms
Retry Behavior.Implements Backoff 19209ms
Retry Behavior.Retries On 500 5410ms
Retry Behavior.Retries On 502 9255ms
Retry Behavior.Retries On 504 9248ms
Retry Behavior.Max Retries Respected 21655ms
Deduplication.Generates Unique Uuids 2936ms
Deduplication.Preserves Uuid On Retry 8786ms
Deduplication.Preserves Uuid And Timestamp On Retry 16337ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry 7911ms
Deduplication.No Duplicate Events In Batch 2939ms
Deduplication.Different Events Have Different Uuids 2717ms
Compression.Sends Gzip When Enabled 2769ms
Batch Format.Uses Proper Batch Structure 2640ms
Batch Format.Flush With No Events Sends Nothing 212ms
Batch Format.Multiple Events Batched Together 2860ms
Error Handling.Does Not Retry On 403 4754ms
Error Handling.Does Not Retry On 413 4787ms
Error Handling.Retries On 408 8865ms

Feature_Flags Tests

16/16 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id 2789ms
Request Payload.Flags Request Uses V2 Query Param 2785ms
Request Payload.Flags Request Hits Flags Path Not Decide 2713ms
Request Payload.Flags Request Omits Authorization Header 2781ms
Request Payload.Token In Flags Body Matches Init 2839ms
Request Payload.Groups Round Trip 2665ms
Request Payload.Groups Default To Empty Object 2737ms
Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It 2700ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False 2720ms
Request Payload.Disable Geoip Omitted Defaults To False 2800ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key 2720ms
Request Lifecycle.No Flags Request On Init Alone 61ms
Request Lifecycle.No Flags Request On Normal Capture 2760ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests 5391ms
Request Lifecycle.Mock Response Value Is Returned To Caller 2811ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event 2973ms

@dustinbyrne
dustinbyrne marked this pull request as ready for review September 2, 2026 04:21
@dustinbyrne
dustinbyrne requested a review from a team as a code owner September 2, 2026 04:21
@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "refactor(surveys): clarify color normali..." | Re-trigger Greptile

@dustinbyrne
dustinbyrne merged commit 430b841 into main Sep 3, 2026
49 checks passed
@dustinbyrne
dustinbyrne deleted the fix/survey-color-hex-overflow branch September 3, 2026 14:20
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.

Surveys: UIColor(hex:) traps on an appearance color longer than eight hex digits

2 participants