feat(remote-config): support RC Container format in network stack and use for remote-config request#7037
Conversation
5e680dd to
b985dc0
Compare
4 builds increased size
RevenueCat 1.0 (1)
|
| Item | Install Size Change |
|---|---|
| DYLD.String Table | ⬆️ 12.8 kB |
| DYLD.Exports | ⬆️ 888 B |
| Code Signature | ⬆️ 624 B |
| RevenueCat.ETagManager.ETagManager | ⬇️ -520 B |
| Other | ⬆️ 16.5 kB |
BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.local-source
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance
Total install size change: ⬆️ 22.7 kB (0.18%)
Total download size change: ⬆️ 11.5 kB (0.27%)
Largest size changes
| Item | Install Size Change |
|---|---|
| 📝 RevenueCat.RCContainer.init(data) | ⬆️ 1.7 kB |
| 📝 RevenueCat.RCContainer.Parser.checksumString(in) | ⬆️ 1.5 kB |
| DYLD.String Table | ⬆️ 1.3 kB |
| 📝 RevenueCat.RCContainer.Parser.base64URLString(in) | ⬆️ 1.2 kB |
| 📝 RevenueCat.RCContainer.Parser.parseElement(index) | ⬆️ 920 B |
BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.cocoapods
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance
Total install size change: ⬆️ 43.6 kB (0.15%)
Total download size change: ⬆️ 12.4 kB (0.19%)
Largest size changes
| Item | Install Size Change |
|---|---|
| DYLD.String Table | ⬆️ 13.7 kB |
| 📝 RevenueCat.RCContainer.init(data) | ⬆️ 1.7 kB |
| 📝 RevenueCat.RCContainer.Parser.checksumString(in) | ⬆️ 1.5 kB |
| 📝 RevenueCat.RCContainer.Parser.base64URLString(in) | ⬆️ 1.2 kB |
| Code Signature | ⬆️ 1.0 kB |
BinarySizeTest 1.0 (1)
com.revenuecat.binary-size-test.spm
⚖️ Compare build
📦 Install build
⏱️ Analyze build performance
Total install size change: ⬆️ 18.9 kB (0.17%)
Total download size change: ⬆️ 11.9 kB (0.27%)
Largest size changes
| Item | Install Size Change |
|---|---|
| 📝 RevenueCat.RCContainer.init(data) | ⬆️ 1.7 kB |
| 📝 RevenueCat.RCContainer.Parser.checksumString(in) | ⬆️ 1.5 kB |
| 📝 RevenueCat.RCContainer.Parser.base64URLString(in) | ⬆️ 1.2 kB |
| Code Signature | ⬆️ 936 B |
| 📝 RevenueCat.RCContainer.Parser.parseElement(index) | ⬆️ 920 B |
🛸 Powered by Emerge Tools
|
|
||
| static func create(with data: Data, httpStatusCode: HTTPStatusCode) throws -> Wrapped? { | ||
| guard httpStatusCode != .noContent else { | ||
| return nil |
There was a problem hiding this comment.
Not the biggest fan of having this check in here, but without it the API client would pass the 204 since it's a successful response, and a 204 wouldn't report nil for data but just empty Data(). So the API client would just pass the 204 down, and in here we'd either fail (because Data() is empty) or if we'd check for !data.isEmpty we'd suddenly allow empty payloads for all 2xx responses, potentially treating empty 200's as successful instead of only 204's.
Alternatively I could put the parsing logic in the RemoteConfigAPI, but that'd mean every implementation that uses RCContainer would have to do the parsing on the callsite, which also isn't great.
|
@RCGitBot please test |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 b985dc0. Configure here.
b985dc0 to
4e4ae0d
Compare
tonidero
left a comment
There was a problem hiding this comment.
I think this makes sense! I'm just unsure about cursor's comment...
| return self.flatMap { response in // Convert the `Result` type | ||
| Result<VerifiedHTTPResponse<Value>, Error> { // Create a new `Result<Value>` | ||
| try response.mapBody { data in // Convert the from `Data` -> `Value` | ||
| try Value.create(with: data) // Decode `Data` into `Value` |
There was a problem hiding this comment.
To confirm, this old create method is still used? Just to check if it could be removed.
There was a problem hiding this comment.
Yes it's still used for all previous endpoints. Had a chat with Antonio and I'll probably revise this part a bit with the signature verification work I'm doing, so this may change in a follow up PR.
tonidero
left a comment
There was a problem hiding this comment.
Ah I was seeing an old version of the code. I think it's solved now indeed. Thank you!
|
@RCGitBot please test |
fecb801 to
4e4ae0d
Compare
4e4ae0d to
60efa0c
Compare
|
@RCGitBot please test |





Part of a stack of PRs, builds on #7030.
Implements support for the RCContainer format in the network stack, and implements it for the
POST /v2/configendpoint. The network stack part of this PR matches that of RevenueCat/purchases-android#3607Accept: application/x-rc-formatNo data is extracted from the RCContainer response yet, this will be done in a follow up PR.
Note
Medium Risk
Touches shared HTTP decoding and caching behavior plus a new binary remote-config contract; signature verification is intentionally disabled for this endpoint until signing lands.
Overview
Remote config is wired through the shared HTTP stack as
POST /v2/config, requestingAccept: application/x-rc-formatand decoding successful bodies intoRCContainer(callbacks now returnRCContainer?). 204 No Content is treated as success with a nil container instead of attempting binary parse.The client adds per-path headers, skips ETag caching for remote config (even if the server sends ETag headers), and leaves signature verification off for that path until binary responses are signed (TODOs in code). Decoding goes through
HTTPResponseBody.create(with:httpStatusCode:), withOptionalmapping noContent to nil andHTTPClient.responseBodyDatanormalizing 304 vs 204 body handling.Tests cover POST path/body, Accept header, no ETag/signature headers, RC Container parse success, 204 nil, and decode failures for invalid/JSON/empty 200 responses.
Reviewed by Cursor Bugbot for commit 60efa0c. Bugbot is set up for automated code reviews on this repo. Configure here.