EC-014: Google TV package storage and download reliability: device checks
Paired WP: WP-096 Purpose: Verify each WP-096 behaviour on the TCL 65Q77K with evidence, in the order the WP builds them. A failed step is fixed on the WP branch before the next starts. Status: ✅ run 2026-11-28 on the TCL 65Q77K (Android 14). Every step passed.
Evidence rule: every checked box cites a logcat excerpt, a command
output or a screenshot captured during the run. No capture, no check. Jeff’s
live confirmations are quoted as his. Quoted output replaces the app’s id
with <app-id>. Raw captures stay local, as in
EC-008.
How the device is driven: Windows adb, as in EC-008. WSL’s NAT mode
can’t see the TV.
Before and after every step that touches packages: take a run-as
listing of files/packages/, files/saves/ and the library entries
(snapshot S). WP-096 exit criterion 8 compares them.
Times below are the TV’s clock, from the app’s store log
(files/packages/store.log) unless marked as the PC’s. Sizes are bytes
unless marked.
Pre-flight
- WP-096 D1–D4 answered (2026-11-28); pre-flight verdict READY (pre-flight-WP-096-2026-11-28). Jeff chose one physical power cut (exit criterion 12): “Yes, once (Rec)”.
- Any
/sdcard/wp096-filler/left from an earlier run is removed, anddf /datais recorded as the baseline (filler safeguards). None was there (ls: /sdcard/wp096-filler: No such file or directory). Baseline 17,063,364 KiB available. tools/Invoke-TvFiller.ps1is dry-run once: it creates a 16 MiB filler in/sdcard/wp096-filler/, is stopped with Ctrl+C, and leaves the folder gone anddf /datawithin 1 MiB of the baseline. Free space fell by 16,388 KiB with the filler. On the stop the script printedCleanup (interrupted (Ctrl+C or a stop)), the folder wasabsent, and the end was 17,063,364 KiB:PASS(0 KiB).- Fork branch, base commit and toolchain recorded:
wp-096-tv-package-reliabilityofforigin/scooby-engine6b5b02c53b; platformandroid-37.0, NDK23.2.8568313, armeabi-v7aliboboe.a399a790e…, libpng16 v7ac1a2ca89…(pre-flight §Repo + device state). - The GitHub Releases download of
bass-cd-1.2.zipwas requested withRange: bytes=1000-1999:302, then206 Partial Content,Content-Range: bytes 1000-1999/69377781, and the 1,000 bytes match the same span of a full read (pre-flight, 2026-11-28). - The synthetic package (D2) and its manifests are created as a new
tv-test-packagesrelease (Jeff’s go, given at pre-flight: “Yes, at execution (Rec)”), andGet-FileHashmatches them. Releasepackages-2026-11-28:wp096-synthetic.zip(419,431,397 B, SHA-256e618a4d5…794c41; five 80 MiB random files and a README, stored),manifest-wp096.json(e253827a…) andmanifest-wp096-no-installed-size.json(910a1a3c…). GitHub’s asset digests equal the localGet-FileHashvalues. - The TCL is reachable over Windows
adb, and its free internal storage is recorded (adb shell df /data). Stop if under 2 GiB free: the update test needs ~1.46 GiB. 17,063,364 KiB (≈16.3 GiB) free. The TV is listed twice, so every command was pinned with-s <serial>./datais ext4 withresgid=1065;stat -fshows 36,864 blocks (144 MiB) reserved for the system, which apps can’t use. - Snapshot S’s baseline includes the existing state: WP-085’s
bass-cd1.2.1 package andinstalled.json, and the savesSKY-VM.001,SKY-VM.SAV,showdown-win.001,showdown-win.002andtimestamps.
The pure-Java parts ran first on a desktop JVM (WP-096 Execution 3): the space
arithmetic, the resume decision table, the .files.json comparison and a live
Range request across GitHub’s redirect: 32 passed, 0 failed (Java 17).
Step 1: build and install (time-box 0:45)
- The debug APK installs over the WP-085 test build. Library, packages and
saves match snapshot S.
adb install -r:Success(versionCode 26041002,2026.4.1-wp096.1). Snapshot S identical after the install and the first launch. - The release APK passes the WP-085 D4 checks (no
advancedpackage,TVPKG_MANIFEST_URLcount 0). Release APK17a9bec1…: 0 classes in theadvancedpackage, 0TestFeatures, 0PackagesActivityin the manifest, 0TVPKG_MANIFEST_URLand 0debug-free-bytesstrings. The debug APK shows 288 / 6 / 1 / 1 / 1. After the status-text fix (Step 3) the release APK rebuilt byte-identical (17a9bec1…).
Outcome: pass. The first build carried versionCode 26041000 and was
refused as a downgrade (INSTALL_FAILED_VERSION_DOWNGRADE); it was rebuilt
as 26041002.
Step 2: storage preflight (time-box 1:00)
- Override (D4 b): with the debug free-space override set below the
requirement, installing the synthetic package is refused at once. The
message shows needed, free and shortfall, and
.staging/stays empty. Withdebug-free-bytes= 524288000:REFUSED wp096-synth 1.0: not enough space for wp096-synth 1.0: needs 864.0 MB (905970878 bytes), 500.0 MB (524288000 bytes) free, short by 364.0 MB (381682878 bytes)..staging/absent before and after;df17,066,000 KiB before and after; snapshot S identical. - Filler (D4 a), through
Invoke-TvFiller.ps1only: free space is left below the requirement but at or above the 256 MiB floor, withdfrecorded. The install is refused before any download, anddfis unchanged after the attempt. Filler leaving 600 MiB (df614,296 KiB):Space before download of wp096-synth 1.0: allocatable 104751104, usable 629039104, thenREFUSED … needs 864.0 MB (905970878 bytes), 99.9 MB (104751104 bytes) free, short by 764.1 MB (801219774 bytes).df614,296 KiB before and after;.staging/absent before and after; snapshot S identical. - Without
installedSize, with room for the zip only (filler again): the download completes and verifies, the post-download check refuses, and.staging/is emptied. Filler leaving 1,150 MiB:Space check passed … needs 464.0 MB (486540261 bytes), 649.9 MB (681480192 bytes) free (download only: the manifest has no installedSize);Downloaded … fetched 419431397 bytes;Verified … SHA-256 e618a4d5…;REFUSED … needs 464.0 MB (486539481 bytes), 249.9 MB (262033408 bytes) free, short by 214.1 MB (224506073 bytes) (to extract 400.0 MB (419430617 bytes))..staging/empty after (total 8,.and..); snapshot S identical. - The script’s cleanup has run:
/sdcard/wp096-filler/is gone anddfis within 1 MiB of the baseline. After 2b:absent,PASS (-4 KiB). After 2c:absent,PASS(−8 KiB).
Outcome: pass. Two findings:
- A single
fallocateof 16.8 GB fails on the TCL withfallocate: Invalid argument. The script refused its dd fallback (over 2 GiB) and cleaned up (drift 0). It now fills in 1 GiB files. - On this TV
getAllocatableBytesis alwaysgetUsableSpace− 500 MiB (524,288,000 B exactly, in every reading), so the app sees 500 MiB less thandf.
Step 2b: measure the headroom (time-box 0:45)
- With no filler, BASS and then the synthetic package are installed while
df /dataandgetAllocatableBytesare logged after the download, at the extract’s peak (polled once a second) and after install. - Each package’s overshoot over package size + installed size is recorded, with whether 64 MiB covered it (WP-096 exit criterion 11).
| Package | Zip | Installed | Drop after download | Drop at extract’s end (peak) | Drop after install | Overshoot at peak | 64 MiB covers it |
|---|---|---|---|---|---|---|---|
BASS 1.2 (as wp096-bass-measure) |
69,377,781 | 72,861,811 | 69,382,144 | 142,266,368 | 72,888,320 | 26,776 | yes |
| synthetic 1.0 | 419,431,397 | 419,430,617 | 419,483,648 | 838,889,472 | 419,454,976 | 27,458 | yes |
Drops are getAllocatableBytes from the store log. The once-a-second
df /data poll agrees: BASS peak 134,984 KiB down; synthetic peak
819,232 KiB (838,893,568 B) down. Library unchanged after --add; saves
identical.
Outcome: pass. The real overshoot is under 30 KB for both, so 64 MiB is about 2,400 times what the TCL needs. It stays at 64 MiB (D3).
Step 3: out of space mid-extract (time-box 0:45)
Jeff approved letting the app fill the disk below the 256 MiB floor for this step, 2026-11-28: “yes run #1 the out-of-space test”. The filler itself still left 500 MiB; the app’s own extract used the rest. The 144 MiB ext4 reserve kept the system running.
- An older version of the synthetic id is installed, then the newer one
is started with a filler sized so the extract runs out (
ENOSPC). The log names the cause,.staging/is empty, and the older version launches. The filler is deleted. - Synthetic 1.0 installed (14:42:10). Filler leaving 500 MiB (df511,292 KiB); the override set high so the preflight lets it through. -Space before download of wp096-synth 1.1: allocatable 2732032, usable 527020032, OVERRIDE 4000000000; download verified (419,431,397 B);Space after download …: allocatable 0, usable 107802624. - 14:44:16FAILED wp096-synth 1.1: out of space (ENOSPC) while extracting; deleting its staging files. java.io.IOException: write failed: ENOSPC (No space left on device). -.staging/empty;installed.jsonnames 1.0;packages/wp096-synth/holds only1.0and1.0.files.json. - 14:45:39Verify wp096-synth 1.0: PASS, 6 of 6 files match. Snapshot S (saves, library,installed.json, package files) identical. - The synthetic package isn’t a game, so “launches” is checked through the library: 14:45:49Launching target sky, then logcatCurrent activity Intent is: scummvm:sky,Found BASS version v0.0372 (5097 dnr entries). - Override removed; fillerabsent.
Outcome: pass, on the second attempt, with one fix:
- Attempt 1 (filler leaving 700 MiB) didn’t run out. By the tap, free
space had risen to 975,048 KiB: Android cleared about 258 MB of cache once
storage got low, and 1.1 installed cleanly (extract end
allocatable 0, usable 159703040). 1.0 was removed and reinstalled for attempt 2. - The failure message was wrong. The screen said
Failed (installed packages unchanged; a partial download is kept and resumes on retry), but an out-of-space failure deletes the staging files. The status now says what the store really kept. Rerun with the fixed build (debug3f31c035…): sameFAILED … (ENOSPC) while extractingline, and the screen readsFailed (installed packages unchanged; nothing is left in staging): out of space while extracting..staging/empty, 1.0 recorded. - The filler’s 1 MiB drift check printed FAIL for all three Step 3
fillers: +258,484, +3,132 and +5,976 KiB. Free space ended higher than it
started: that’s the cache Android cleared, not something left behind (the
folder was
absenteach time and.staging/empty). The script now says so when the drift is positive. The 1 MiB rule itself is unchanged.
Step 4: resume (time-box 1:00)
- The synthetic download is force-stopped at about 30%. The
.partfile and its sidecar remain.am force-stopat 31.3%:.part131,432,229 B and.part.json(URL, size, SHA-256, validator"0x8DF4D7BCABD0B18") both there after the stop and after the next start’s sweep. - On retry the log shows
Range: bytes=<n>-and206, and only the remainder is fetched. The SHA-256 matches and the package installs.Resuming wp096-synth 1.1: re-hashed the 131432229 bytes already downloaded in 969 ms;Range: bytes=131432229-, If-Range: "0x8DF4D7BCABD0B18";HTTP 206, Content-Range bytes 131432229-419431396/419431397 … -> APPEND;fetched 287999168 bytes this time, resumed from byte 131432229;Verified … SHA-256 e618a4d5…;Installed wp096-synth 1.1. Saves and library identical. - The no-
Rangecase (a200answer) and the changed-validator case restart from 0 and install, on the TV or in the JVM harness (say which). Both on the TV, and both in the harness too. - Changed validator (the sidecar’s edited to…B17):HTTP 206 … validator "0x8DF4D7BCABD0B18" -> RESTART_NEW_REQUEST (the validator changed …), thenfetched 419431397 bytes this time, verified, installed. -200: acodeload.github.comarchive at a fixed commit, with a 1,000-byte partial:HTTP 200, Content-Range null -> RESTART_WITH_BODY,fetched 4315 bytes, verified, installed, then removed.
Outcome: pass. Finding: GitHub’s asset host ignores If-Range.
Given a validator that doesn’t match, it still answers 206 with its real
ETag. The app compares that ETag with the stored one, so it restarts
anyway; the harness test was changed to accept either answer.
Step 5: verify (time-box 0:30)
- Verify passes on the fresh install.
Verify wp096-synth 1.1: PASS, 6 of 6 files match (419430617 bytes, 2011 ms). - One byte of an installed file is changed through
run-as. Verify names that file. The package is then reinstalled. Byte 5,000,000 ofdata3.binchanged49→5awithdd(size unchanged):Verify wp096-synth 1.1: FAILED; changed wp096-synthetic/data3.bin (CRC-32 eb6fb321, expected 02d35efb). Removed and reinstalled as 1.0:Verify … PASS, 6 of 6.
Outcome: pass. bass-cd, installed by WP-085 before file lists existed,
reports no file list (installed before Verify existed); reinstall it to
verify.
Step 5b: interrupted installation (time-box 1:00)
- With an older synthetic version installed, start the update and
kill -9the app process once the log shows extraction under way. After restarting: the log shows the staging sweep;installed.jsonnames the old version; the old version launches and passes Verify; snapshot S matches. - Killed with three files in.staging/wp096-synth-1.1.d(the third partly written, 2,359,300 B).installed.jsonnamed 1.0. - Next start:Staging sweep: deleting packages/.staging/wp096-synth-1.1.d (an incomplete extraction); the.partand sidecar kept. -Verify wp096-synth 1.0: PASS, 6 of 6; snapshot S identical;Launching target sky,Found BASS version v0.0372. - Repeat with
adb rebootmid-extract, with the same checks after boot. - Rebooted withdata3.binpartly written (17,854,464 B). After boot, before the app ran,installed.jsonnamed 1.0. - Sweep deleted the.dfolder;Verify wp096-synth 1.0: PASS; snapshot S identical; BASS launched. - After each interruption, retrying the update completes and passes Verify.
After the kill and the reboot:
Reusing the complete download of wp096-synth 1.1 (419431397 bytes); not fetching it again,Installed wp096-synth 1.1,Verify wp096-synth 1.1: PASS, 6 of 6. After the power cut: resumed (below), installed,Verify … PASS, 6 of 6. - Physical power cut at the wall (Jeff chose it at pre-flight). Start
the update. When the log shows extraction under way, tell Jeff to pull
the TV’s plug, and record his confirmation. After it boots, run the
same checks.
- Jeff: “Ready”. Update tapped at 15:11:00 (PC clock). The download was
verified and the extract began at 15:11:45 (TV clock). adb lost the TV
about 6 s into an 8 s extract, with no
Extractedline in the log. Jeff, after plugging it back in: “ok tv is up”. Uptimeup 0 min. - On disk after boot, before the app ran: -installed.jsonnamed 1.0 and there was nopending.json; -.staging/wp096-synth-1.1.dheldREADME.txtanddata1.binonly; - the.partwas 377,638,912 B, shorter than the 419,431,397 B that had downloaded and verified. -Staging sweep: deleting packages/.staging/wp096-synth-1.1.d (an incomplete extraction);Verify wp096-synth 1.0: PASS, 6 of 6; snapshot S (saves, library,installed.json, package files) identical;Launching target sky,Found BASS version v0.0372 (5097 dnr entries). - Retry:re-hashed the 377638912 bytes;Range: bytes=377638912-→HTTP 206 … -> APPEND;fetched 41792485 bytes; verified;Installed wp096-synth 1.1;Verify wp096-synth 1.1: PASS, 6 of 6.
Outcome: pass.
- The first cut missed. Jeff pulled after the extract had finished
(8 s), because the run sheet didn’t warn him how short the window was. As
a cut right after an install it still passed:
installed.jsonnamed 1.1,.staging/empty,Verify … 1.1: PASS, 6 of 6, saves and library identical. - Finding: the downloaded
.partisn’t synced after the download, so the power cut lost its last ~40 MB even though it had been verified. The resume measures the file, not the sidecar’s byte count, and re-hashes it, so it fetched just the missing bytes and the SHA-256 check passed.
Step 6: preservation and close (time-box 0:30)
- For steps 2–5b, snapshot S before vs. after matches for saves and
library entries. Every step’s before and after pair is identical. Over
the whole run the saves stay byte-identical to the baseline, and the
library keeps the same keys and values. ScummVM writes the two keys
pathandtitle_movies_seenin[showdown-win]in either order when it rewritesscummvm.ini. This happened on launches too, not just installs. /sdcard/wp096-filler/does not exist anddf /datais within 1 MiB of the pre-flight baseline.ls: /sdcard/wp096-filler: No such file or directory. The synthetic package was removed at the end (15:19:34);installed.jsonholdsbass-cd1.2.1 only,.staging/is empty and there’s nodebug-free-bytes.dfis 17,354,288 KiB against the baseline 17,063,364 KiB: +290,924 KiB. That’s not within 1 MiB, but free space is higher, by the cache Android cleared during Step 3 (+258,484, +3,132 and +5,976 KiB across its three fillers). Nothing of the run is left on the TV.- The manifest doc is updated, the fork PR is open, and WP-096 §Result is written (WP-096 §Result).
Outcome: pass, with the df note above.
Definition of done
Every step’s outcome is recorded with captures. WP-096’s exit criteria are met, its §Result is written, and its WORK_INDEX row is updated.
Out-of-scope captures
(One line per temptation, for a later WP.)
- Sync the
.part(and then its sidecar) once the download completes, so a power cut can’t shorten a verified download. Recovery already handles it. Done 2026-11-28 in fork PR barefootbetters/scummvm#25, merged 2026-11-28 (6e87dd1788), and checked with a second power cut: the.partcame back full length and the retry reused it without fetching. - A
.partstays in.staging/until the same id and version is installed again. Nothing deletes a stale one if it never is. Done 2026-11-28 in fork PR barefootbetters/scummvm#28: stale partial downloads are deleted at start-up and on a manifest load, andstore.logis synced after each line. - A test-only extract delay would make the power-cut window longer than 8 s
for a person at the plug. Done 2026-11-28 in fork PR
barefootbetters/scummvm#33.
For a rerun of Step 5b’s power cut, write a delay such as
5000tofiles/packages/debug-extract-delay-msfirst, and delete it afterwards. - Old packages (
bass-cd) have no file list until they’re reinstalled. Done 2026-11-28:bass-cd1.2.1 was removed (saves kept) and reinstalled on the TCL, and Verify now passes 5 of 5.