From 602a6597c9297ca3b269ffdc15b3ec95d9b1df6e Mon Sep 17 00:00:00 2001 From: Davide Angelocola Date: Tue, 7 Jul 2026 09:56:15 +0200 Subject: [PATCH] fix(ci): hydrate script crashes on snapshot entries with null byte sizes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Raincloud conformance workflow failed on its first real run: the size-cap computation used entry.get('parquet_bytes', 0), but .get returns the default only for ABSENT keys — a snapshot entry with an explicit "parquet_bytes": null (a not-yet-hashed slug: jsonbench-bluesky-100m, wikipedia-structured-contents, code-contests, bi-commongovernment) returns None, and None + int raised TypeError, aborting the whole hydrate step. Coerce both fields with 'or 0' so missing and null both cap as 0. Co-Authored-By: Claude Opus 4.8 --- scripts/hydrate-raincloud-corpus.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/hydrate-raincloud-corpus.sh b/scripts/hydrate-raincloud-corpus.sh index 5b11e76c..bc8f2713 100755 --- a/scripts/hydrate-raincloud-corpus.sh +++ b/scripts/hydrate-raincloud-corpus.sh @@ -77,8 +77,11 @@ import raincloud max_bytes = int(os.environ["MAX_MB"]) * 1024 * 1024 snapshot = json.loads(resources.files("raincloud").joinpath("_data/snapshot.json").read_text()) +# `.get(key, 0)` returns 0 only when the key is absent; a snapshot entry can carry +# an explicit "parquet_bytes": null (not-yet-hashed slug), which .get returns as None. +# `or 0` coerces both the missing and the null case to 0 so the size cap still applies. sizes = { - slug: entry.get("parquet_bytes", 0) + entry.get("vortex_bytes", 0) + slug: (entry.get("parquet_bytes") or 0) + (entry.get("vortex_bytes") or 0) for slug, entry in snapshot["slugs"].items() }