refactor(remote-config): Support RC Container Format for remote config request, remove stale implementation temporarily#3607
Conversation
b0b0c57 to
a9c2140
Compare
4cd4c47 to
2538600
Compare
a9c2140 to
7b9d434
Compare
2538600 to
7ea7a07
Compare
| name = "get_remote_config", | ||
| ) { | ||
| override fun getPath(useFallback: Boolean) = pathTemplate | ||
| override val expectsBinaryResponse: Boolean = true |
There was a problem hiding this comment.
This endpoint is currently unused so not a problem to change it.
ajpallares
left a comment
There was a problem hiding this comment.
Looking good! I have some comments!
Thanks for making the effort to split these into smaller PRs. Really appreciated 🙏
| RCHTTPStatusCodes.isSuccessful(responseCode) | ||
| ) { | ||
| verifyResponse(path, connection, payload, nonce, postFieldsToSignHeader) | ||
| verifyResponse(path, connection, payloadText, nonce, postFieldsToSignHeader) |
There was a problem hiding this comment.
I think right now GetRemoteConfig doesn't support signature verification, but if it ever does, couldn't this (passing null / empty string to verify) be a problem?
There was a problem hiding this comment.
That's actually done in this follow-up PR, and yeah, so it has a different method to handle this case which will use only the main config hash to simplify it
| endpoint: Endpoint, | ||
| ): Map<String, String> { | ||
| return mapOf( | ||
| "Content-Type" to "application/json", |
There was a problem hiding this comment.
Is it okay to still send "Content-Type" to "application/json" for the remote config endpoint?
There was a problem hiding this comment.
That's a good question... need to check with the backend folks since I haven't been able to test this against that yet (code is unused right now though)
There was a problem hiding this comment.
Actually, I think this is right. Content-Type is supposed to be the format of the request, which will indeed still be plain json. Accept determined the accepted formats for the response, so I don't think this should be an issue.
7ea7a07 to
678860e
Compare
9cd9f13 to
4288db2
Compare
📸 Snapshot Test593 unchanged
🛸 Powered by Emerge Tools |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3607 +/- ##
==========================================
- Coverage 80.46% 80.30% -0.17%
==========================================
Files 382 378 -4
Lines 15594 15475 -119
Branches 2166 2147 -19
==========================================
- Hits 12548 12427 -121
- Misses 2172 2189 +17
+ Partials 874 859 -15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Introduces HTTPResult.Payload (Text/Binary) so the HTTP layer can carry raw bytes, and switches GetRemoteConfig to request the binary RC Container Format (Accept: application/x-rc-format), parsing the response into an RCContainer. Binary responses bypass the ETag cache. Signature verification for the endpoint remains disabled, unchanged from before; it is enabled in the follow-up PR. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
42d3db7 to
84b96ec
Compare
The RC Container Format migration left the previous RemoteConfigResponse-based processing commented out in RemoteConfigManager and kept several now-unused files alive as WIP placeholders. These are removed (rather than commented out) here so the intermediate state never lands; the reworked manager/disk-cache are reintroduced in later PRs in the stack. WeightedSource is kept as it survives the rework. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The HTTPResult.Payload.Binary variant is only ever used for the RC Container Format response. Rename it to RCFormat to describe its purpose rather than its encoding, consistent with the endpoint flag expectsRCFormatResponse. Updates the type plus associated comments, KDoc, log strings, error messages, and test names. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
rickvdl
left a comment
There was a problem hiding this comment.
Awesome work, just one remaining question 💪
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A 204 from the remote config endpoint can yield no readable body stream on some Android devices, which surfaced as a network IOException instead of reaching the 204 handler. Treat a missing body on a 204 as empty bytes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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 5052c31. Configure here.
5052c31 to
3362ea2
Compare


Stacked on #3534.
What
HTTPResult.Payload(Text/RCFormat) so the HTTP layer can carry raw bytes, with apayloadTextaccessor. Pure refactor; text call sites are unchanged.GetRemoteConfignow requests the RC Container Format (Accept: application/x-rc-format) and parses the response into anRCContainer. RCFormat responses bypass the ETag cache.This PR doesn't change any behavior, but adds initial support for RC Container format requests.
Note
Medium Risk
Touches shared HTTP/ETag behavior and deletes the remote-config refresh/download path, so config-related behavior is incomplete until replaced; JSON endpoints are largely unchanged via
payloadText.Overview
Refactors the HTTP layer so responses can be text (JSON) or raw RC Container bytes, via
HTTPResult.PayloadandpayloadTextfor existing JSON call sites.GetRemoteConfignow negotiatesAccept: application/x-rc-format, skips ETag caching, treats 204 as “no update” (nullRCContainer), and parses successful bodies withRCContainer.parse.HTTPClientreads bodies as bytes, sets RC-format headers only whenendpoint.expectsRCFormatResponse, and bypasses the ETag manager for those endpoints.The prior JSON-based remote config implementation is removed (
RemoteConfigManager,TopicFetcher,RemoteConfigResponse, disk cache, and related tests) until a follow-up wires the new container format end-to-end.Reviewed by Cursor Bugbot for commit 62f6bea. Bugbot is set up for automated code reviews on this repo. Configure here.