Skip to content

refactor(remote-config): Re-arm blob sources only when exhausted + in-memory blob-store index#3698

Merged
tonidero merged 2 commits into
mainfrom
phase_6_rearm_blob_sources_when_exhausted
Jul 2, 2026
Merged

refactor(remote-config): Re-arm blob sources only when exhausted + in-memory blob-store index#3698
tonidero merged 2 commits into
mainfrom
phase_6_rearm_blob_sources_when_exhausted

Conversation

@tonidero

@tonidero tonidero commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Add restartIfExhausted(purpose) to the source provider: re-arms a purpose only if it is currently exhausted, otherwise a no-op that preserves failover progress.
  • On-demand ensureDownloaded now re-arms exhausted blob sources before enqueuing, so a read after a prior cycle drained the sources retries instead of failing silently.
  • RemoteConfigManager.prefetchBlobs re-arms blob sources only when exhausted rather than unconditionally every sync.
  • RemoteConfigBlobStore keeps an in-memory index of on-disk refs so contains/cachedRefs no longer stat the disk on every call.

Note

Medium Risk
Changes hot-path blob cache checks and network source selection for remote config; behavior shifts from always retrying primary blob sources each sync to preserving failover state, which could delay recovery if exhaustion detection is wrong.

Overview
Remote config blob source failover no longer resets every sync or on every download. restartIfExhausted re-winds blob (and API) sources to the first entry only when that purpose has no healthy source left; otherwise failover progress is kept so a known-bad primary is not retried on each sync.

On-demand ensureDownloaded calls restartIfExhausted before enqueueing a missing blob so reads after an exhausted cycle can retry recovered sources. Sync prefetch uses the same conditional re-arm instead of unconditional restart. Individual download workers still do not restart inside the failover loop (one re-arm per on-demand request or prefetch cycle).

RemoteConfigBlobStore maintains a synchronized in-memory ref index (lazy one-time disk scan, updated on write / retainOnly / clear). contains and cachedRefs avoid per-call disk stats; read drops stale index entries when the file is missing. retainOnly still scans the blobs directory so orphan temp and invalid-named files are removed.

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

@tonidero tonidero changed the title Re-arm blob sources only when exhausted + in-memory blob-store index refactor(remote-config): Re-arm blob sources only when exhausted + in-memory blob-store index Jul 2, 2026
@tonidero tonidero marked this pull request as ready for review July 2, 2026 11:03
@tonidero tonidero requested a review from a team as a code owner July 2, 2026 11:03
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.50000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.55%. Comparing base (b9cc466) to head (fa9c39d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...hases/common/remoteconfig/RemoteConfigBlobStore.kt 74.07% 0 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3698      +/-   ##
==========================================
+ Coverage   80.52%   80.55%   +0.03%     
==========================================
  Files         395      395              
  Lines       16278    16300      +22     
  Branches     2315     2318       +3     
==========================================
+ Hits        13108    13131      +23     
+ Misses       2244     2243       -1     
  Partials      926      926              

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

Base automatically changed from phase_5_wire_blob_fetcher_into_manager to main July 2, 2026 11:55
@tonidero tonidero force-pushed the phase_6_rearm_blob_sources_when_exhausted branch from 760450f to 54e2307 Compare July 2, 2026 12:13

@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 54e2307. Configure here.

@tonidero tonidero requested a review from rickvdl July 2, 2026 12:27

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

Awesome! Thanks for iterating 🫶

tonidero and others added 2 commits July 2, 2026 16:12
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… miss

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tonidero tonidero force-pushed the phase_6_rearm_blob_sources_when_exhausted branch from 0535058 to fa9c39d Compare July 2, 2026 14:15
@tonidero tonidero enabled auto-merge July 2, 2026 14:16
@tonidero tonidero added this pull request to the merge queue Jul 2, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 2, 2026
@tonidero tonidero added this pull request to the merge queue Jul 2, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jul 2, 2026
@tonidero tonidero added this pull request to the merge queue Jul 2, 2026
Merged via the queue into main with commit 90387d7 Jul 2, 2026
37 checks passed
@tonidero tonidero deleted the phase_6_rearm_blob_sources_when_exhausted branch July 2, 2026 16:33
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.

3 participants