docs(runtime): close h5 cache acceleration

This commit is contained in:
2026-08-14 19:33:58 +08:00
parent aecfc43216
commit 7ca0302ff2
5 changed files with 83 additions and 17 deletions
@@ -1,7 +1,7 @@
# P9.5 H5 Cache Acceleration Plan
> Status: `IN_PROGRESS`
> Active step: `P9.5-H5-CACHE-STEP-1`
> Status: `COMPLETE`
> Active step: `NONE`
> Baseline: `5e15dbd`
> Goal: `docs/goals/PHASE9_5_H5_CACHE_ACCELERATION_GOAL.md`
> Contract: `docs/runtime/p9_5/H5_CACHE_ACCELERATION_CONTRACT.md`
@@ -11,10 +11,10 @@
| Step | Status | Outcome | Gate |
|---|---|---|---|
| P9.5-H5-CACHE-STEP-0 Contract | `COMPLETE` | Repeat-load and first-load work are separated without changing the game. | Goal, contract, plan, checkpoint and ledger agree. |
| P9.5-H5-CACHE-STEP-1 Immutable runtime caching | `IN_PROGRESS` | Reopening the same H5 version reuses WASM/PCK/JS locally. | Long cache headers, stable ETag, 304, auth and public HTTPS checks pass. |
| P9.5-H5-CACHE-STEP-2 First-load assessment | `PENDING` | The remaining first-open cost is measured and the shortest safe improvement is recorded. | Compression ratios and browser compatibility are measured; enable only when verified. |
| P9.5-H5-CACHE-STEP-1 Immutable runtime caching | `COMPLETE` | Reopening the same H5 version reuses WASM/PCK/JS locally. | Long cache headers, stable ETag, 304, auth and public HTTPS checks pass. |
| P9.5-H5-CACHE-STEP-2 First-load assessment | `COMPLETE` | Gzip-capable first opens transfer about half the principal payload. | Selective precompression, public response headers, decompressed hash and isolated Chrome launch pass. |
## Active Step Contract
## Completed Step Contract
```text
ID: P9.5-H5-CACHE-STEP-1
@@ -31,12 +31,13 @@ EVIDENCE LEVEL EXPECTED: remote H5 delivery availability only.
COMMIT BOUNDARY: pushed task activation, then pushed verified closure.
LEGAL TERMINAL: Aetherbound Guild P9.5 H5 repeat-load acceleration ready, or
redesign required at the earliest delivery boundary.
NEXT STEP: Measure safe first-load compression without changing the game.
NEXT STEP: Owner reopens the existing signed link twice on the same phone and
reports the repeat-open wait plus the earliest gameplay confusion.
```
## Issue Register
| ID | Status | Finding |
|---|---|---|
| H5C-I01 | `ACTIVE` | Runtime resources expire after 300 seconds and have no conditional response path, causing full repeat downloads. |
| H5C-I02 | `OPEN` | First load transfers about 58 MB without compression; benefit and compatibility need separate measurement. |
| H5C-I01 | `RESOLVED` | Runtime JS/PCK/WASM use a one-year immutable cache with ETag and 304. |
| H5C-I02 | `RESOLVED` | Selective gzip cuts principal first-load transfer from 57.9 MB to 29.4 MB; PCK remains identity because gzip saves only 0.6%. |
+46
View File
@@ -55,3 +55,49 @@ Refresh before each comparison:
Human understanding, item-choice quality, fun/continuation, listening,
save/resume, physical device, native packaging, stores and release remain open.
## Delivery Acceleration
The Owner-reported repeated-download problem was confirmed on 2026-08-14. The
Gallery previously returned only `private, max-age=300` and no ETag, so opening
the same immutable item after five minutes transferred the runtime again.
The existing item and signed URL are unchanged. Runtime JS, PCK, WASM and
worklets now return:
```text
Cache-Control: private, max-age=31536000, immutable
ETag: <stable representation tag>
Vary: Accept-Encoding
```
Matching `If-None-Match` and `If-Modified-Since` requests return `304` without
a body. HTML remains on the shorter 300-second cache. Unauthorized file
requests still receive only the Gallery login response.
The Gallery publisher now creates deterministic gzip sidecars for runtime
files only when compression saves at least five percent. The current public
responses are:
| File | Identity bytes | Transferred bytes | Encoding |
|---|---:|---:|---|
| `index.html` | 5,915 | 5,915 | identity |
| `index.js` | 315,759 | 78,637 | gzip |
| `index.pck` | 19,901,780 | 19,901,780 | identity |
| `index.wasm` | 37,685,705 | 9,431,387 | gzip |
The principal transfer falls from `57,909,159` to `29,417,719` bytes, or
`49.2%`. PCK gzip was intentionally omitted because it saved only `0.6%`.
Public gzip response headers pass, and a complete decoded WASM body retains
SHA-256 `99962b29677e42f3ba0258bd90fdc52ad90295954c4473e816ad02cfe5ff1d4f`.
An isolated Chrome 151 cold profile loaded the signed public URL and rendered
the real Chinese Title at `844x390`. Reopening with the same cache produced the
same frame in five seconds; both screenshots have SHA-256
`67a754541846b432cd4124dd58b71b7ea4944d9114c81e76abdc5692b31dae59`.
Credential-bearing Cookie files and the 153 MB browser profile were deleted;
the two non-secret screenshots remain under
`/private/tmp/abg-p95-h5-cache-chrome-r1/`.
This proves browser delivery and repeat-load behavior, not physical iPhone
performance or Owner play acceptance.