Pre-Flight — WP-096 — 2026-11-28

Filled-in copy of docs/reference/pre-flight for WP-096. The verdict is at the bottom. The execution prompt is session-WP-096-2026-11-28.

Nothing had been done before this session (checked 2026-11-28): no wp-096 branch locally or on either origin, no fork PR mentioning WP-096, and no fork worktree. Every fact below comes from a command run in this session. The TV was off at first. Jeff turned it on and gave a pairing code, and its state was captured later the same day (§Device).


Pre-flight intent

Validating readiness for WP-096. Not implementing, not building, not installing anything on the TV. Verdict only, plus the claim (the fork worktree) and the execution prompt.

Dependency check

Prereq Status in WORK_INDEX Locked on Notes
WP-085 🚧 In progress — (installer merged 2026-11-27, 0d5a69c769) Bypass, Jeff’s call (below). WP-085’s milestones 3 and 4, the installer and its update path, are verified on the TCL and merged into the fork (barefootbetters/scummvm#13). Only its exit criterion 3, an import route without a computer, is open, and WP-096 doesn’t use import
ISO-free feasibility study Reference doc (PR #246) 2026-11-28 Source of the sizes and the gaps; not a WP

Rule check and bypass. pre-flight.md says any prereq that isn’t ✅ makes the verdict NOT READY. WP-096 needs only the part of WP-085 that’s done. The question was put to Jeff on 2026-11-28 with three options (note the bypass, split WP-085’s open criterion into its own WP, or NOT READY). He answered “Note the bypass (Rec)”. That applies wp-lifecycle’s “route around it and note the bypass”. It is recorded here, and nothing else is bypassed.

Repo + device state

Repos:

Code facts re-checked at 6b5b02c53b (the WP relies on them):

Fact Where Consequence for WP-096
minSdkVersion 16; compileSdk set, targetSdk defaults to it dists/android/build.gradle:48,57 getAllocatableBytes (API 26) needs the getUsableSpace fallback the WP specifies
setInstanceFollowRedirects(true); open() throws unless HTTP_OK PackageStore.java:149,155 Must accept 206 for a range request (WP engineering call 5)
fetch() calls cleanStaging() first, and deletes the zip in finally PackageStore.java:176,209 Scope items 6–9 change both
PackagesActivity.onCreate already calls cleanStaging() and cleanOrphans() PackagesActivity.java:59-60 Corrects the WP draft, which said staging was swept only when a download starts. The sweep must now keep .part files (scope item 15, reworded)
writeJson writes a temp file and renames it, with no sync PackageStore.java writeJson Scope item 14 adds the sync
No getFD().sync() anywhere in the advanced mode grep Scope item 14 is new code

Toolchain (WSL 2 Ubuntu, /opt/android-sdk; the variables come from /etc/profile.d/android-sdk.sh, so builds run in a login shell). Checked with a script run via wsl -u root -e bash:

Item Output
SDK platform android-37.0
NDK 23.2.8568313
Build tools 36.0.0; cmdline-tools/latest Pkg.Revision=23.0 with apkanalyzer (for the D4 release-APK check)
JDK OpenJDK 17.0.21.1
Oboe armeabi-v7a /opt/build/oboe-build-v7a/liboboe.a SHA-256 399a790e7837…, the same as WP-085’s
libpng armeabi-v7a /opt/build/png-v7a/lib/libpng16.a SHA-256 c1a2ca891e90… (the grid launcher needs it; WP-085 lesson 2)
App identity /root/.gradle/gradle.properties defines tvAppId, tvAppLabel, tvAppResDir (values not read into this doc)

Test host. Run from this session:

curl -sSIL https://github.com/barefootbetters/tv-test-packages/releases/download/packages-2026-11-26/bass-cd-1.2.zip
HTTP/1.1 302 Found        Location: https://release-assets.githubusercontent.com/… (signed, short-lived)
HTTP/1.1 200 OK           Content-Length: 69377781   Accept-Ranges: bytes
                          ETag: "0x8DF4C4699560DA0"  Last-Modified: Fri, 27 Nov 2026 05:23:41 GMT

curl -sSL -r 1000-1999 …
HTTP/1.1 302 Found
HTTP/1.1 206 Partial Content   Content-Range: bytes 1000-1999/69377781   (same ETag)
→ the 1,000 bytes match bytes 1000–1999 of a full read

So resume is testable against the real test host. The redirect target is signed, so a resume re-requests the manifest URL (WP engineering call 5).

Device: the TCL 65Q77K

First attempt: refused. Windows adb (winget platform-tools 1.0.41 / 37.0.3; WP-085 lesson 1: not WSL’s) saw the TV’s mDNS services, but adb connect was refused (10061): the TV was off. Jeff answered Q4 “At execution (Rec)”.

Second attempt: captured. Jeff turned the TV on and gave a pairing address and code, and adb pair reported Successfully paired. adb devices -l then listed the TV twice (two mDNS names, transports 4 and 5), so every command was pinned with adb -t <transport>. Captured 2026-11-28, with the address, serial and app id replaced:

getprop ro.build.version.release / .sdk / ro.product.cpu.abilist
14 / 34 / armeabi-v7a,armeabi

df /data
/dev/block/dm-27  21523300 4312636  17063208  21% /data/user/0     (≈16.3 GiB free)
dumpsys diskstats
Data-Free: 17063208K / 21523300K total = 79% free

pm list packages  →  package:<app-id>   package:org.scummvm.scummvm.debug
dumpsys package <app-id>
versionCode=26041001 minSdk=16 targetSdk=37   versionName=2026.4.1-wp085.2
flags=[ DEBUGGABLE HAS_CODE ALLOW_CLEAR_USER_DATA ALLOW_BACKUP ]

run-as <app-id> ls files/packages   →  bass-cd/  installed.json  store.log
run-as <app-id> ls files/saves      →  SKY-VM.001  SKY-VM.SAV  showdown-win.001  showdown-win.002  timestamps
run-as <app-id> du -sk files/packages files/saves   →  71192 / 72

ls -d /sdcard/wp096-filler   →  No such file or directory

fallocate through /sdcard (FUSE) — probed with 1 MiB, then removed:

which fallocate → /system/bin/fallocate   (Toybox 0.8.9-android)
mkdir -p /sdcard/wp096-filler && fallocate -l 1048576 /sdcard/wp096-filler/probe.bin   → rc=0
ls -ls → 1024 -rw-rw---- … 1048576 probe.bin     (real blocks allocated)
df /data → Available 17062180   (−1,028 KiB)
rm -rf /sdcard/wp096-filler → gone; df /data → Available 17063208   (back exactly)

So fallocate reserves real space on /data through the FUSE layer, in seconds, without writing 15 GB to flash, and its removal gives the space back exactly. The only write was this 1 MiB probe in the designated folder, which was removed at once.

Test data:

BASS 1.2:   tv-test-packages packages-2026-11-26/bass-cd-1.2.zip
            (69,377,781 B; SHA-256 53209b94…cc974593, WP-085's)
BASS 1.2.1: same release, bass-cd-1.2.1.zip (WP-085's update package)
Synthetic:  not yet created. Jeff's go, given here: "Yes, at execution (Rec)".
            ~420 MB of random bytes as a zip of several files, plus two manifests
            (with and without installedSize), on a new tv-test-packages release.

No disc data is used. Showdown’s numbers come from the study only.

Questions put to Jeff

Asked 2026-11-28, recommendation first. The answers are the option labels Jeff picked.

# Question Jeff’s answer
Q1 WP-085 is 🚧 (only its import criterion is open), and WP-096 needs its merged installer. How should the gate treat it? “Note the bypass (Rec)”
Q2 Run one physical power cut mid-extract on the TCL? kill -9 and adb reboot don’t test fsync, because the kernel still flushes the page cache “Yes, once (Rec)”
Q3 Create the synthetic package and its manifests on the public tv-test-packages releases at execution? “Yes, at execution (Rec)”
Q4 The TV refused adb. Check its free storage now or at execution? “At execution (Rec)”. Jeff then turned the TV on and gave a pairing code, so it was checked here as well (§Device)

Engineering calls (Claude’s, with reasoning)

  1. Resume re-hashes the existing .part from the start rather than saving digest state. MessageDigest state can’t be serialized portably. Re-reading ≤420 MB from internal flash costs seconds, which is less than the network time it saves.
  2. The filler uses fallocate on /sdcard/wp096-filler/ (the shared storage on /data, the same volume as the app’s files). The device probe confirmed it allocates real blocks through FUSE and frees them exactly. It reserves the space without writing it, which matters for a ~15 GB filler. The script checks the filler’s real size with df. It falls back to dd from /dev/zero only if fallocate fails, and refuses any fallback filler over 2 GiB rather than write it to flash.
  3. The power cut is the last interruption test, after kill -9 and adb reboot have passed. A fault the cheaper tests can catch is fixed before the TV is unplugged.
  4. tools/Invoke-TvFiller.ps1 is PowerShell 7, following Jeff’s script convention. It drives adb from Windows (WP-085 lesson 1).

Scope lock

Anything not listed is forbidden.

Fork (C:\claude-worktrees\scummvm-wp-096-tv-package-reliability, branch wp-096-tv-package-reliability):

backends/platform/android/advanced/**        (PackageStore, PackageManifest, PackagesActivity, AdvancedMode, new helpers)
backends/platform/android/advanced-stub/**   (only if the stub's signature must follow; say why in the commit)
dists/android/**                             (only for a manifest-merge or Gradle line the code needs; say why)

Public docs repo (barefootbetters/terraglyph-engine):

docs/work-packets/WP-096-tv-package-reliability.md
docs/execution-checklists/EC-014-tv-package-reliability.md
docs/reference/tv-package-manifest.md
docs/reference/pre-flight-WP-096-2026-11-28.md   (§Lessons learned only)
docs/work-packets/WORK_INDEX.md                  (the WP-096 row and the Last updated line)
dashboard.json                                   (the tv-package-reliability milestone)
tools/Invoke-TvFiller.ps1                        (new)

External, on Jeff’s go given above: one new release on barefootbetters/tv-test-packages holding the synthetic zip and its manifests.

Local only, never staged: build outputs, /root/.gradle/gradle.properties, logcat and run-as captures (they show the app’s id and the TV’s address), and the synthetic zip’s source bytes.

Forbidden (any change fails the WP):

Exit check (before every commit):

git diff --cached --name-only                          # each repo; match against the lists above
git diff origin/scooby-engine..HEAD --name-only        # the fork branch, before the PR

Also grep the staged diff for the private id and label before every fork or public commit. Any hit is a leak: git restore --staged and remove it.

Risk review

Risk Likelihood Impact Mitigation
The filler is left on the TV, or fills it completely low high One folder, a 256 MiB floor computed from a fresh df, and try/finally cleanup proven by EC-014’s Ctrl+C dry run before first use. Every filler step ends with a df within 1 MiB of its start
The power cut corrupts something outside the app (system or other apps’ data) low med One cut only, last in order (engineering call 3), during an extract with no other writes running. Android’s filesystems journal metadata. Jeff pulls the plug, so it’s never automated
Resume appends to bytes from a changed object low high If-Range with the stored validator, a 200 or changed ETag restarts from 0, and the final size and SHA-256 checks are unchanged. A bad resume can never install
HttpURLConnection drops Range on the redirect med med The JVM harness checks it against the real GitHub URL before the TV run. If it drops, follow the redirect by hand (setInstanceFollowRedirects(false), re-issue with Range), staying HTTPS-only as WP-085 requires
The sweep deletes a .part (the onCreate call found above) high if missed med Scope item 15 reworded. EC-014 Step 4 relaunches the app between the kill and the retry, so the sweep runs before the resume
getAllocatableBytes overstates the space that can really be used on this TV med med Exit criterion 11 measures it. A refusal is tested with a real filler, not only the override
fsync on every file slows the extract noticeably med low Record extract time with and without for the synthetic package in §Result. Durability wins unless the cost is extreme; if it is, sync once per file at close rather than mid-stream
Private id leaks in a capture pasted into docs low high Replace it with <app-id> in every quoted output (as EC-008 did); the grep exit check
Device evidence claimed without a capture (the 2026-11-21 lesson) low high No EC-014 box is checked without a logcat excerpt, command output or screenshot. Jeff’s power-cut confirmation is quoted as his
The TV has too little free space for the update test med med The pre-execution stop rule (under 2 GiB free). Don’t free space by deleting or uninstalling anything on the TV; ask Jeff

Verdict

Nothing carried forward. The TCL was unreachable at first because it was off. Its state was captured the same day once Jeff turned it on: 16.3 GiB free, the test app installed and debuggable, and fallocate proven (§Device). Execution still re-checks df /data (stop under 2 GiB) and connection, because that state can change before the run.

Reviewer: Claude (Opus 5.5), pre-flight for Jeff Date: 2026-11-28

A READY verdict authorizes opening the execution session. It doesn’t authorize any change beyond the §Scope lock. It goes stale if public main or origin/scooby-engine moves in a way that touches WP-096, EC-014 or backends/platform/android/advanced*/ (wp-lifecycle §Phase 2).

After execution: lessons learned

Execution ran 2026-11-28; every EC-014 step passed (WP-096 §Result). What a future pre-flight should check:

  1. Prove a tool at the size the run will use. Pre-flight proved fallocate with a small file. On the TCL, one 16.8 GB fallocate fails with Invalid argument. The filler now works in 1 GiB files.
  2. Probe the failure case of a protocol, not only the success case. The Range probe got a 206. It didn’t send a mismatched If-Range, which GitHub ignores. The design held because the app compares the validator itself, but the pre-flight would have caught it with one more request.
  3. A nearly full Android disk isn’t stable. When storage gets low, Android clears cache, so free space rises by up to ~258 MB during a step. A filler needs a wide margin to force ENOSPC, and a before/after df check will read positive drift. Plan for both.
  4. Read the device’s installed versionCode before the first build. The first APK was a downgrade and was refused.
  5. A step that needs a person’s hands needs its timing up front. The power cut’s window (an ~8 s extract) wasn’t in the run sheet, and the first cut missed. Give the operator the on-screen cue and the window before starting, or make the window longer.