refactor(remote-config): manifest persistence, request body handling#3612
refactor(remote-config): manifest persistence, request body handling#3612tonidero wants to merge 3 commits into
Conversation
83d0b57 to
b8c0117
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 06-16-phase_1__v2_config_wire-format_models_remove_stale_remote-config_scaffolding #3612 +/- ##
======================================================================================================================
- Coverage 80.25% 80.25% -0.01%
======================================================================================================================
Files 379 381 +2
Lines 15530 15599 +69
Branches 2163 2172 +9
======================================================================================================================
+ Hits 12464 12519 +55
- Misses 2202 2209 +7
- Partials 864 871 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
b8c0117 to
d112e22
Compare
fb82861 to
dd4061d
Compare
d112e22 to
b5b7b6e
Compare
dd4061d to
e4eb551
Compare
e4eb551 to
f50eab9
Compare
2f56a66 to
b7eccb8
Compare
f50eab9 to
1468860
Compare
b7eccb8 to
9e3d8b1
Compare
a8a7b1f to
db36f20
Compare
b9c0e74 to
e40a0c5
Compare
6a666b9 to
cea3fa5
Compare
e40a0c5 to
cbd6ee9
Compare
cea3fa5 to
a7bc2cc
Compare
cbd6ee9 to
41560da
Compare
a7bc2cc to
aad99b8
Compare
41560da to
65f283e
Compare
📸 Snapshot Test593 unchanged
🛸 Powered by Emerge Tools |
65f283e to
a475265
Compare
aad99b8 to
99fa878
Compare
a475265 to
54dc5f5
Compare
99fa878 to
c8d4706
Compare
54dc5f5 to
ef7cc7f
Compare
|
|
||
| private fun persist(previous: PersistedRemoteConfig?, response: RemoteConfiguration) { | ||
| val previousTopics = previous?.topics ?: emptyMap() | ||
| // Changed bodies overwrite previous ones; topics dropped from the new manifest are pruned. |
There was a problem hiding this comment.
This is for now just in progress. This is not actually resolving the topics or anything, just assuming they are all already resolved.
Make the remote-config sync stateful:
- Backend.getRemoteConfig now accepts a ConfigManifest, replays it in full as
the {"manifest": {...}} request body (serialized via kotlinx so the model's
@SerialName fields are the single source of truth), and surfaces 204 No
Content as a null RCContainer (no-change) distinct from a 200 binary response.
- Add a ConfigurationResponse.parse(ByteBuffer) overload.
- New RemoteConfigDiskCache persists the manifest + resolved topic bodies to
noBackupFilesDir/RevenueCat/remote_config.json (atomic write, lenient read).
- New RemoteConfigManager replays the persisted manifest, and on 200 persists
the server manifest plus merged/pruned topic bodies; on 204/error keeps cache.
Not wired into the SDK lifecycle yet (Phase 7). Blob extraction (Phase 3) and
topic-handler dispatch (Phase 4) are intentionally not done here.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0c7d740 to
4d924bb
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ 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 4d924bb. Configure here.
|
Moving back to draft since I'm still missing some things sorry for the noise! |
|
This PR might need to change to make the manifest a client-abstracted format instead of what we do right now, but we can iterate on this after I would say. |


Description
This PR is part of the stack to support the new Remote configuration endpoint.
In this PR, we add support to cache the Manifest in the remote config response, and then post it back in the request so the backend can decide what needs updating.
Note
Medium Risk
Changes the remote config network contract and adds on-disk state that must stay consistent with server diffs; impact is limited while
RemoteConfigManageris not yet wired into SDK lifecycle.Overview
Adds manifest replay for
/v2/config:Backend.getRemoteConfignow takes aRemoteConfiguration.Manifest, serializes it into a{ "manifest": … }request body (instead ofnull), and treats HTTP 204 as “no change” via a nullRCContainercallback.Introduces
RemoteConfigDiskCacheto persist the last manifest plus merged topic bodies undernoBackupFilesDir/RevenueCat/, andRemoteConfigManagerto read that cache, send the persisted manifest (or a defaultappdomain on first run), merge/prune topics on 200, and skip writes on 204, errors, or parse failures.RemoteConfiguration.parse(ByteBuffer)duplicates the buffer so RC container views are not consumed.Lifecycle wiring and blob/topic handlers are not hooked up yet; this PR is the persistence + request/response handling layer, with expanded backend and unit tests.
Reviewed by Cursor Bugbot for commit 4d924bb. Bugbot is set up for automated code reviews on this repo. Configure here.