Refuse a Gaia answer that came back short, and read the body inside the retry

The merge gate asks whether Gaia contributed any stars, never how many. The TAP service truncates
on its own timeout and still serves a well-formed CSV with a 200, ordered by magnitude — so a half
answer is the bright half, which is the half HYG overlaps. Every gate passes: Gaia stars are
present, HYG survivors go down rather than up, unmerged twins can only fall. The weekly job would
publish a catalogue missing two hundred thousand stars and the runner would cache it for the weeks
after. `fetchGaiaStars` now refuses fewer than 95% of the 412 765 rows its query holds, as its
sibling query already did, and refuses an answer that fills the row limit.

`fetchText` retried the request but not the body: a connection reset part-way through the 57 MB
CSV rejected out of the loop, with no wait and no second attempt. The read now happens inside it.

Also corrected: the merge gate's account of the HYG survivors (two thirds of them are stars Gaia
measures but the main query never downloads, since Gaia puts them past the 250 pc cutoff), and the
refresh workflow's comment on what happens when the archive is unreachable.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016jxMkwA2rbicdGxHosecYi
This commit is contained in:
2026-09-18 12:12:49 +02:00
co-authored by Claude Opus 5
parent b4017fcafc
commit 44f6a8d086
4 changed files with 55 additions and 10 deletions
+9 -2
View File
@@ -66,8 +66,15 @@ function validateStars(stars: StarRecord[]): void {
* The other failure leaves no close pair at all, because proper motion had already carried the
* two entries tens of arcseconds apart — the 2026-08-24 refresh, where HYG sat at epoch 2000.0
* and Gaia at J2016.0. What it does leave is HYG rows that found no counterpart: 36 056 of them
* against the 10 876 Gaia genuinely lacks (bright stars it saturates on, red dwarfs past its
* magnitude cut).
* against the 10 886 today, and no counterpart was possible for most of those. Two thirds of them,
* 6 835, are the stars Gaia measures but the main query never downloads, because Gaia's parallax
* puts them past `ETL_GAIA_DISTANCE_PC` while Hipparcos put them inside `ETL_STAR_DISTANCE_PC`;
* they are every star in the published catalogue beyond 250 pc. The rest are what Gaia genuinely
* lacks: bright stars it saturates on, red dwarfs past its magnitude cut. So the headroom left to
* the ceiling tracks the gap between those two cutoffs as much as Gaia's completeness.
*
* This bounds a merge that went wrong. It cannot bound a Gaia download that came back short: that
* makes *fewer* survivors, not more, and is guarded where it can be seen, in `fetchGaiaStars`.
*/
const MAX_UNMERGED_TWINS = 100;
const MAX_HYG_SURVIVORS = 15_000;