Skip to content

refactor(remote-config): inline blob store + extraction#3615

Draft
tonidero wants to merge 2 commits into
mainfrom
06-16-phase_3__v2_config_inline_blob_store_extraction
Draft

refactor(remote-config): inline blob store + extraction#3615
tonidero wants to merge 2 commits into
mainfrom
06-16-phase_3__v2_config_inline_blob_store_extraction

Conversation

@tonidero

Copy link
Copy Markdown
Contributor

Checklist

  • If applicable, unit tests
  • If applicable, create follow-up issues for purchases-ios and hybrids

Motivation

Description

tonidero commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@tonidero tonidero changed the title Phase 3: /v2/config inline blob store + extraction refactor(remote-config): inline blob store + extraction Jun 16, 2026
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from ab3e648 to 758b2b8 Compare June 16, 2026 14:20
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from b5b7b6e to 2f56a66 Compare June 16, 2026 14:20
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from 758b2b8 to fa63b72 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 2f56a66 to b7eccb8 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_3__v2_config_inline_blob_store_extraction branch from fa63b72 to 5129003 Compare June 17, 2026 13:05
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from 9e3d8b1 to b9c0e74 Compare June 18, 2026 10:02
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from 5129003 to 650f8d8 Compare June 18, 2026 10:02
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.51613% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.24%. Comparing base (7a27cb4) to head (428e708).

Files with missing lines Patch % Lines
...hases/common/remoteconfig/RemoteConfigBlobStore.kt 58.82% 11 Missing and 10 partials ⚠️
...rchases/common/remoteconfig/RemoteConfigManager.kt 90.90% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                                             Coverage Diff                                             @@
##           06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling    #3615      +/-   ##
===========================================================================================================
- Coverage                                                                    80.30%   80.24%   -0.07%     
===========================================================================================================
  Files                                                                          381      382       +1     
  Lines                                                                        15651    15711      +60     
  Branches                                                                      2181     2199      +18     
===========================================================================================================
+ Hits                                                                         12569    12607      +38     
- Misses                                                                        2214     2225      +11     
- Partials                                                                       868      879      +11     

☔ 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 force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from b9c0e74 to e40a0c5 Compare June 18, 2026 10:27
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from 650f8d8 to 2f49d86 Compare June 18, 2026 10:27
@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 force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from 2f49d86 to a6819b1 Compare June 18, 2026 10:57
@emerge-tools

emerge-tools Bot commented Jun 18, 2026

Copy link
Copy Markdown

📸 Snapshot Test

593 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
TestPurchasesUIAndroidCompatibility Paparazzi
com.revenuecat.testpurchasesuiandroidcompatibility.paparazzi
0 0 0 0 258 0 N/A
TestPurchasesUIAndroidCompatibility
com.revenuecat.testpurchasesuiandroidcompatibility
0 0 0 0 335 0 N/A

🛸 Powered by Emerge Tools

@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from a6819b1 to 19f3cac Compare June 18, 2026 13:24
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from cbd6ee9 to 41560da Compare June 18, 2026 13:24
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from 19f3cac to ba88ac7 Compare June 18, 2026 13:46
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch 2 times, most recently from 65f283e to a475265 Compare June 18, 2026 15:57
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from ba88ac7 to 6de1e60 Compare June 18, 2026 15:57
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from a475265 to 54dc5f5 Compare June 19, 2026 09:13
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from 6de1e60 to 0498f0d Compare June 19, 2026 09:13
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from 54dc5f5 to ef7cc7f Compare June 19, 2026 09:50
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from 0498f0d to 737f5be Compare June 19, 2026 09:50
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch from 0c7d740 to 4d924bb Compare June 19, 2026 10:56
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch 2 times, most recently from 248ddff to f2c8284 Compare June 19, 2026 13:27
@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 force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from f2c8284 to 05c4f49 Compare June 23, 2026 12:42
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from 05c4f49 to e746901 Compare June 23, 2026 13:32
@tonidero tonidero force-pushed the 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling branch 2 times, most recently from 322e020 to 7a27cb4 Compare June 23, 2026 14:28
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from e746901 to 428e708 Compare June 23, 2026 14:28
val referencedRefs = response.prefetchBlobs.toSet() + mergedBlobRefs.values.flatten()
blobStore.retainOnly(referencedRefs)

diskCache.write(

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.

FYI: On iOS we check if the remote config was persisted successfully before syncing the blobs to disk, that's probably a bit safer?

@rickvdl rickvdl Jun 25, 2026

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.

Bubot had a valid concern about the iOS approach as well though.. RevenueCat/purchases-ios#7073 (comment)

Let's discuss :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Both good points thank you!!


// Retain only blobs the current config still references: the prefetch set plus any topic blob ref.
val referencedRefs = response.prefetchBlobs.toSet() + mergedBlobRefs.values.flatten()
blobStore.retainOnly(referencedRefs)

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.

On iOS I added some extra checks before writing the blobs to ensure they're still 'wanted' after applying the new response. Wrote down the logic in the PR description here

Basically I think the main differences is that iOS does not store all inlined blobs first, but will first check if they are wanted / needed.

Happy to discuss of course!

Base automatically changed from 06-16-phase_2__v2_config_manifest_persistence_request_body_204_handling to main June 25, 2026 08:31
@tonidero tonidero changed the base branch from main to graphite-base/3615 June 25, 2026 09:28
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from 428e708 to 2afab8c Compare June 25, 2026 09:28
@tonidero tonidero changed the base branch from graphite-base/3615 to remote_config_v1_path_app_user_id_and_refresh_dedupe June 25, 2026 09:28
tonidero and others added 2 commits June 25, 2026 12:16
…edupe

- Move GetRemoteConfig endpoint from /v2/config to /v1/config
- Add app_user_id to the /v1/config request body (Backend.getRemoteConfig + RemoteConfigManager)
- Dedupe overlapping RemoteConfigManager.refreshRemoteConfig calls with a single in-flight guard

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add RemoteConfigBlobStore, a content-addressed on-disk cache for
remote-config blobs (one file per ref under RevenueCat/blobs/, keyed by
the URL-safe base64 of the blob's truncated SHA-256).

On a 200 sync, RemoteConfigManager now extracts inlined blob elements
from the RCContainer, caches each only when its checksum verifies,
evicts blobs no longer referenced by the manifest/topics, and records
which prefetch blobs are held locally in manifest.prefetched_blobs so
the server stops re-inlining them.

Fetching missing prefetch blobs over the network is deferred to Phase 5
(needs the resolved blob source provider).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tonidero tonidero force-pushed the 06-16-phase_3__v2_config_inline_blob_store_extraction branch from 2afab8c to 8c2a0fe Compare June 25, 2026 10:18
@tonidero tonidero force-pushed the remote_config_v1_path_app_user_id_and_refresh_dedupe branch from e817f23 to f070e8c Compare June 25, 2026 10:18
Base automatically changed from remote_config_v1_path_app_user_id_and_refresh_dedupe to main June 25, 2026 11:39
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