WP-139: Beta game-data hosting, Phase 1

Status: ✅ Done (2026-12-02). All eight acceptance criteria met on the TCL 65Q77K (§Result). Phase: 5 (polish & distribution). Depends on: WP-134 ✅ (the packages); WP-085 ✅ and WP-096 ✅ (the installer, its resume and its manifest, in the fork’s test builds). Plan: the private ewiki page Beta game data on Cloudflare R2 (§Access, Phase 1), merged 2026-12-02. Jeff approved Phase 1 the same day; that’s the answer to the ISO-free study’s §L.3 (a Worker gate, not presigned links or Access tokens). Companion EC: — (one session). Targets generation(s): Gen 1 packages; any format-1 package. Estimated effort: one day.


Goal

Host game-data packages for the TV app’s test builds on Cloudflare: a private R2 bucket, read only by a Worker that checks a per-tester key on every request. Prove it end to end on the TCL 65Q77K with no app change.

Scope

In:

The Worker and the scripts live in the private repo (barefootbetters/scooby-engine-private, beta-data/). This repo keeps the WP and the result.

Out:

Acceptance criteria

These are the plan’s eight, run on the TCL with the test build:

  1. A known key loads the manifest and installs a package, and the app’s Verify passes.
  2. An unknown key, a malformed key and a bare /m/ each get an empty 404, on both the manifest and a package URL.
  3. Revoking a tester mid-download makes the next manifest load and the resume request 404. A suspended tester restored to active works again.
  4. A package whose bytes don’t match its manifest SHA-256 is refused, and nothing is installed.
  5. A download cut off resumes: the app logs HTTP 206 and appends. Replacing the object between attempts gets a 200 to If-Range, and the download starts over.
  6. A failed update over the Worker leaves the installed version playable.
  7. No key shows up in the Worker’s log lines or in the app’s shared diagnostic log.
  8. Get-BetaDownloads lists every download above with its tester, object and bytes.

Criteria 2 and 5’s headers are also checked with curl before the TV.

Pre-flight

Result

Built and live:

Uploaded:

Package Object Size
BASS bass-cd 1.2 packages/bass-cd/1.2/bass-cd-1.2.zip 69,377,781 B
Showdown showdown-en-aug2001 1 packages/showdown-en-aug2001/1/showdown-en-aug2001-1.zip 425,569,015 B
neg-wrong-hash 1 (its manifest SHA-256 is one digit off) packages/neg-wrong-hash/1/neg-wrong-hash-1.zip 199 B
The manifest manifests/beta.json —

One tester is active, jeff-tcl. Its first key was retired after the TV run (see the key swap).

Showdown went up over the S3 API. At 425,569,015 B it’s over wrangler’s 300 MiB upload limit. Jeff created an R2 token scoped to this bucket (Object Read & Write), and beta-data/tools/Set-R2Keys.ps1 saved its keys as User env vars R2_ACCESS_KEY_ID / R2_SECRET_ACCESS_KEY. rclone then uploaded it in 12 s, reading the keys from the environment. A full download through the Worker took 22 s, and its SHA-256 matches the manifest. R2’s ETag for a multipart upload, "2e5879bc…-82", is still strong, which is what Resume.java needs (it refuses only W/). A range request on the last bytes got 206.

HTTP checks with curl (criterion 2 and the headers criterion 5 relies on), all as specified:

Request Answer
Manifest, good key (dashed, or lower case without dashes) 200; each url is /p/<key>/<id>/<version>/<id>-<version>.zip
Unknown key, malformed key, bare /m/, /, package with an unknown key, a missing object, a wrong file name 404, 0 bytes
Whole package 200, 69,377,781 B; SHA-256 matches the manifest; strong ETag "1d4401cd…"
Range: bytes=1000-1999 206, Content-Range: bytes 1000-1999/69377781
Range with a matching If-Range (ETag or Last-Modified) 206
Range with a stale If-Range 200, the whole object
Range past the end 416, Content-Range: bytes */69377781
Multi-range 200, the whole object
Tester suspended; active but expired; restored 404; 404; 200

Criterion 7, Worker side: a wrangler tail taken during two requests shows only the Worker’s lines, which are tester, object, range start, bytes and status. The key appears only in Cloudflare’s own request metadata (the URL), as the plan expected.

On the TV (2026-12-02, 19:23–19:37 Pacific)

The test build is com.barefootbetters.classics.debug 2026.4.1-wp138.1 (26041074) on the TCL 65Q77K (Android 14), driven over Windows adb. The advanced mode was opened with its D-pad gesture, and its controls were tapped by their uiautomator bounds. The manifest URL was written into the app’s tv_packages preferences through run-as instead of typed. Before the run, BASS 1.2.1, Showdown 1 and Phantom 1 were installed from WP-134’s gist manifest; Showdown was removed (saves kept, 3 before and after) so it could come back through the Worker.

# Criterion What happened  
1 Known key installs, Verify passes The manifest loaded (3 packages). Showdown 1 downloaded through the Worker, verified (SHA-256 e5b9bee7…), extracted 48 files, and was added as showdown-win. Verify: PASS, 48 of 48 files match (556,351,281 B) ✅
2 Unknown key gets an empty 404 The app: Couldn’t load the manifest: HTTP 404 from beta-data.barefootbetters.com. The malformed-key, bare-/m/ and package-URL cases are in the curl table above ✅
3 Revoke mid-download; restore With 167,815,598 B kept: revoked, the resume request (Range: bytes=167815598-) got 404, the part kept; the next manifest load 404. Suspended: manifest 404. Restored to active: manifest loaded, resume worked (row 5) ✅
4 Wrong SHA-256 refused neg-wrong-hash downloaded (199 B) and was REFUSED: …d220 doesn’t match the manifest’s …d221. installed.json unchanged, staging empty ✅
5 Resume appends; a replaced object restarts Cut at 167.8 MB (force-stop). The retry sent If-Range: "2e5879bc…-82" and got HTTP 206, Content-Range bytes 167815598-425569014/425569015 → APPEND. Cut again at 317.8 MB, then the object was re-uploaded with a 16 MiB part size (same bytes, ETag "899a6085…-26"). The retry got HTTP 200 → RESTART_WITH_BODY, fetched all 425,569,015 B, and installed (row 1) ✅
6 A failed update leaves the installed version playable A temporary showdown-en-aug2001 2 (v1’s bytes, copied server-side; the manifest’s SHA-256 one digit off) offered Update to 2. All 425,569,015 B came through the Worker and were REFUSED; installed.json unchanged, v1’s folder untouched, staging empty. Launch showdown-win went to the game’s title screen. The v2 object and manifest entry were then removed ✅
7 No key in the app’s logs Key matches, dashed or not: the shared diagnostic log (Share diagnostic log, saved to Android/data/…/files/; 65 lines) 0; store.log (707 lines) 0; scummvm.log 0. The store log names only the host. Logcat’s one match was AccessibilityNodeInfoDumper printing the URL field during this run’s own uiautomator dumps, not the app ✅
8 Get-BetaDownloads lists every download Every TV request from an active key is a row: the 6 manifest loads, neg-wrong-hash (199 B, 200), Showdown 1 from 0 (200), from 167,815,598 (206, 257,753,417 B), from 0 again (200), and Showdown 2 (200) ✅

Noted:

The key swap

During the run, the session printed the staging sidecar, which holds the first key, into its own transcript. Nothing was committed. After the run that tester was renamed jeff-tcl-key1 and revoked (its download history stays), a new jeff-tcl was issued, and the TV’s preferences were moved to the new URL: the old key gets 404, the new key 200, and the TV loads the manifest with it.