Skip to content

refactor(remote-config): manifest persistence, request body handling#3612

Merged
tonidero merged 5 commits into
mainfrom
06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling
Jun 25, 2026
Merged

refactor(remote-config): manifest persistence, request body handling#3612
tonidero merged 5 commits into
mainfrom
06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling

Conversation

@tonidero

@tonidero tonidero commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

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 introduces on-disk state that affects what the server is told on each sync; behavior is mostly internal with safe fallbacks on parse/read failures, but incorrect persistence could cause extra full fetches or stale topic bookkeeping until later phases wire blob handling.

Overview
Adds incremental /v2/config sync by persisting an opaque server manifest and replaying it on the next request so the backend can return 204 when nothing changed.

Backend.getRemoteConfig now POSTs domain, optional manifest (omitted on first sync), and prefetched_blobs instead of an empty body. RemoteConfigDiskCache atomically stores sync bookkeeping (manifest, active topics, prefetch list, per-topic blob refs) under noBackupFilesDir; corrupt or legacy on-disk format reads as null and forces a fresh sync. RemoteConfigManager loads that state, drives the backend call, leaves the cache alone on 204/errors/bad payloads, and on 200 merges changed topic blob refs while pruning inactive topics. RemoteConfiguration.parse(ByteBuffer) duplicates the buffer so RC container views stay untouched.

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

tonidero commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

@tonidero tonidero changed the title Phase 2: /v2/config manifest persistence, request body + 204 handling refactor(remote-config): manifest persistence, request body + 204 handling Jun 16, 2026
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from 83d0b57 to b8c0117 Compare June 16, 2026 10:44
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.30%. Comparing base (a4772d2) to head (fd4d12c).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...hases/common/remoteconfig/RemoteConfigDiskCache.kt 72.72% 10 Missing and 2 partials ⚠️
...rchases/common/remoteconfig/RemoteConfigManager.kt 93.33% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3612      +/-   ##
==========================================
+ Coverage   80.29%   80.30%   +0.01%     
==========================================
  Files         379      381       +2     
  Lines       15568    15651      +83     
  Branches     2172     2181       +9     
==========================================
+ Hits        12500    12569      +69     
- Misses       2204     2214      +10     
- Partials      864      868       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tonidero tonidero changed the base branch from 06-16-phase_1__v2_config_wire-format_models_remove_stale_remote-config_scaffolding to graphite-base/3612 June 16, 2026 11:08
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from b8c0117 to d112e22 Compare June 16, 2026 11:09
@tonidero tonidero force-pushed the graphite-base/3612 branch from fb82861 to dd4061d Compare June 16, 2026 11:09
@tonidero tonidero changed the base branch from graphite-base/3612 to 06-16-phase_1__v2_config_wire-format_models_remove_stale_remote-config_scaffolding June 16, 2026 11:09
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from d112e22 to b5b7b6e Compare June 16, 2026 11:23
@tonidero tonidero force-pushed the 06-16-phase_1__v2_config_wire-format_models_remove_stale_remote-config_scaffolding branch from dd4061d to e4eb551 Compare June 16, 2026 11:23
@tonidero tonidero force-pushed the 06-16-phase_1__v2_config_wire-format_models_remove_stale_remote-config_scaffolding branch from e4eb551 to f50eab9 Compare June 16, 2026 14:20
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch 2 times, most recently from 2f56a66 to b7eccb8 Compare June 16, 2026 14:40
@tonidero tonidero force-pushed the 06-16-phase_1__v2_config_wire-format_models_remove_stale_remote-config_scaffolding branch from f50eab9 to 1468860 Compare June 16, 2026 14:40
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from b7eccb8 to 9e3d8b1 Compare June 17, 2026 13:05
@tonidero tonidero force-pushed the 06-16-phase_1__v2_config_wire-format_models_remove_stale_remote-config_scaffolding branch 2 times, most recently from a8a7b1f to db36f20 Compare June 18, 2026 10:02
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch 2 times, most recently from b9c0e74 to e40a0c5 Compare June 18, 2026 10:27
@tonidero tonidero force-pushed the 06-16-phase_1__v2_config_wire-format_models_remove_stale_remote-config_scaffolding branch 2 times, most recently from 6a666b9 to cea3fa5 Compare June 18, 2026 10:57
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from e40a0c5 to cbd6ee9 Compare June 18, 2026 10:57
@tonidero tonidero changed the title refactor(remote-config): manifest persistence, request body + 204 handling refactor(remote-config): manifest persistence, request body handling Jun 19, 2026

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ 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.

@tonidero tonidero marked this pull request as draft June 19, 2026 11:01
@tonidero

Copy link
Copy Markdown
Contributor Author

Moving back to draft since I'm still missing some things sorry for the noise!

@tonidero

Copy link
Copy Markdown
Contributor Author

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.

@rickvdl rickvdl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good overall! The implementation will probably slightly change after the modeled backend changes, so happy to do another pass after that

@tonidero tonidero changed the base branch from main to graphite-base/3612 June 23, 2026 12:42
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from 9355718 to 6095724 Compare June 23, 2026 12:42
@tonidero tonidero changed the base branch from graphite-base/3612 to v2_config_opaque_manifest_format June 23, 2026 12:42
@tonidero tonidero force-pushed the v2_config_opaque_manifest_format branch from 7c34516 to 448f2ba Compare June 23, 2026 13:32
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from 836f875 to 322e020 Compare June 23, 2026 13:32
@tonidero tonidero marked this pull request as ready for review June 23, 2026 13:47
@tonidero tonidero requested review from a team and rickvdl June 23, 2026 13:47
Base automatically changed from v2_config_opaque_manifest_format to main June 23, 2026 14:15
tonidero and others added 4 commits June 23, 2026 16:28
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>
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from 322e020 to 7a27cb4 Compare June 23, 2026 14:28

@rickvdl rickvdl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking good! Two non-blocking questions

@tonidero tonidero enabled auto-merge June 25, 2026 07:49
@tonidero tonidero added this pull request to the merge queue Jun 25, 2026
Merged via the queue into main with commit 02930fd Jun 25, 2026
38 checks passed
@tonidero tonidero deleted the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch June 25, 2026 08:31
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