Skip to content

Make remote custom-data downloads robust to transient empty/failed responses#9544

Open
Martin-Molinero wants to merge 2 commits into
masterfrom
fix/remote-data-transient-empty-download
Open

Make remote custom-data downloads robust to transient empty/failed responses#9544
Martin-Molinero wants to merge 2 commits into
masterfrom
fix/remote-data-transient-empty-download

Conversation

@Martin-Molinero

@Martin-Molinero Martin-Molinero commented Jun 18, 2026

Copy link
Copy Markdown
Member

What this does

RemoteFileSubscriptionStreamReader treated a successful-but-empty download (byte[0], e.g. a transient HTTP 200 with no body) as valid: it passed the bytes != null check and was written/cached as an empty file, so the subscription silently yielded no data (and the empty file was reused with caching on). This:

  • retries the download a few times on a transient failure (empty response or exception), and
  • only persists/caches a non-empty result.

Scope (honest)

This recovers transient empties. It does not fix a sustained endpoint outage — if the remote source returns empty for the whole run, there's no data to get and the subscription still yields nothing. So this reduces, but does not eliminate, flakiness for regression algorithms that depend on a live remote source (e.g. CustomDataPropertiesRegressionAlgorithm fetching a Quandl/Nasdaq proxy URL). Fully de-flaking those needs the test data served locally/deterministically rather than from a live endpoint — a separate change.

Tests

RetriesTransientEmptyDownload, EmptyDownloadIsNotCached pass; Engine + Tests build clean.

🤖 Generated with Claude Code

A remote custom-data source can intermittently answer with a transient failure or
a successful-but-empty body (e.g. an HTTP 200 with no content from a proxied
endpoint). Previously a single such response made RemoteFileSubscriptionStreamReader
treat it as the file contents: an empty byte[] passed the 'bytes != null' check and
was written/cached as a valid (empty) file, so the whole subscription silently
yielded no data and, with caching enabled, reused the empty file.

Download with a bounded retry that treats an empty response or an exception as
transient, and only persist/cache a non-empty result. On HTTP errors a WebException
is still thrown after the retries are exhausted, preserving existing behavior.

Adds tests: retry recovers after empty responses, and an empty download is not cached.
@Martin-Molinero Martin-Molinero changed the title Retry transient empty/failed remote custom-data downloads Make remote custom-data downloads robust to transient empty/failed responses Jun 18, 2026
@Martin-Molinero Martin-Molinero marked this pull request as ready for review June 18, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants