Skip to content

feat(remote-config): add RC Container format V1 + parser#7030

Merged
rickvdl merged 5 commits into
mainfrom
rickvdl/remote-config-rc-container-format
Jun 19, 2026
Merged

feat(remote-config): add RC Container format V1 + parser#7030
rickvdl merged 5 commits into
mainfrom
rickvdl/remote-config-rc-container-format

Conversation

@rickvdl

@rickvdl rickvdl commented Jun 17, 2026

Copy link
Copy Markdown
Member

Initial implementation of the RCContainer binary format for the remote-config API.

Implements the documented format while trying to be as consistent as possible with RevenueCat/purchases-android#3534

Contains the following components:

  • RCContainer - The parsed data structure itself
  • RCContainer.Element - Each element in the data structure, where element 0 is always the config blob itself, and subsequent elements will be (optionally) inlined blobs
  • RCContainer.Parser - The container parser, handles format validation and zero-copy parsing of the binary data into the RCContainer format.

Note

Low Risk
New isolated parsing code with broad tests and no production API integration in this diff; main risk is future wire-format mismatches if server and client diverge.

Overview
Adds RC Container v1 parsing under Sources/Networking for the upcoming remote-config binary response format, aligned with the documented wire layout and Android behavior.

RCContainer validates raw Data and exposes header flags, the first config element, and optional inlined blobs in contentElements keyed by 32-character base64url blob refs (duplicate checksums keep the last entry). RCContainer.Parser walks the buffer with typed FormatError cases (magic/version, truncation, padding, checksum mismatch, missing config). RCContainer.Element indexes into the retained container with withPayloadBytes / withChecksumBytes so payloads are not copied per element.

Unit coverage includes in-memory builders, malformed-input rejection, zero-copy address checks, frozen .bin backwards-compatibility fixtures, and a README for regenerating fixtures via GENERATE_RC_CONTAINER_FIXTURES=1. Xcode project entries wire the new sources and tests; this PR does not yet hook the parser into live remote-config HTTP handling.

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

@rickvdl rickvdl force-pushed the rickvdl/remote-config-rc-container-format branch from 1d18890 to baf939b Compare June 17, 2026 15:35
@rickvdl rickvdl changed the title Add RC Container format parser feat(remote-config): add RC Container format parser Jun 17, 2026
@rickvdl rickvdl force-pushed the rickvdl/remote-config-rc-container-format branch 2 times, most recently from b094183 to 1283e04 Compare June 17, 2026 15:47
@rickvdl rickvdl changed the title feat(remote-config): add RC Container format parser feat(remote-config): add RC Container format V1 + parser Jun 18, 2026
@rickvdl rickvdl force-pushed the rickvdl/remote-config-rc-container-format branch from 6f5f707 to b88c073 Compare June 18, 2026 07:23
@rickvdl rickvdl marked this pull request as ready for review June 18, 2026 07:25
@rickvdl rickvdl requested a review from a team as a code owner June 18, 2026 07:25
@rickvdl

rickvdl commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

@RCGitBot please test

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is looking really great! I didn't see any differences with the Android implementation. At your suggestion, I added some tests to test against an actual binary file which we might want to also add here

@rickvdl rickvdl force-pushed the rickvdl/remote-config-rc-container-format branch from 8cf5949 to b34b7ec Compare June 18, 2026 09:15
@rickvdl

rickvdl commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

@RCGitBot please test

@rickvdl

rickvdl commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

This is looking really great! I didn't see any differences with the Android implementation. At your suggestion, I added some tests to test against an actual binary file which we might want to also add here

Did the same and ran the tests against the Android binary files as well, no diff so byte-for-byte identical generation and all tests passed on them as well.

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice!!

@rickvdl rickvdl merged commit 8eb56f4 into main Jun 19, 2026
43 checks passed
@rickvdl rickvdl deleted the rickvdl/remote-config-rc-container-format branch June 19, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants