A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
docs: the web release is built with gzip, not Brotli (owner decision on #879) (#965)
Eyal Golandb4350f8eeb1
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 98d67ecd7..c8a789f06 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -72,6 +72,9 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIBThe checks file is now written in the bundle cache and copied beside the shipped bundles.### Changed+- The web release build is gzip-compressed instead of Brotli, one zip for GitHub Releases and itch.io (owner decision on+ #879): itch.io's CDN sends a Brotli build's `.data` uncompressed, an estimated 46 MB to download against about 34 MB+ with gzip. `docs/RELEASING.md` step 5 and `tools/package_release.py` default to `unity/Builds/Web-gzip`.- Hebrew names: a native speaker read the 12 government and legislature names (#874) and 27 office rows, 29 titles (#876), and the start, new-game, save and loading UI strings (#877, no wording changed). The `agent-checked` flags on the names and titles were cleared; the 24 party names (#875) keep theirs (refs #564).- In the Hebrew UI the population-tier badge sits on the right of a map pill, at the start of the Hebrewname, as the owner decided on #897 ("Yes, mirror it"; refs #880, #710). The English pill keeps it on the left.diff --git a/docs/RELEASING.md b/docs/RELEASING.mdindex c833ace93..479adef2d 100644--- a/docs/RELEASING.md+++ b/docs/RELEASING.md@@ -16,15 +16,21 @@ GitHub Releases page (and, from M4, on itch.io). Steps 1–3 are a normal pull r5. **Build and package** on the owner's machine, from the merged `main`:```bash- "$UNITY" -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget WebGL -executeMethod Statecraft.Game.EditorTools.Build.Web -compression brotli -shareable -logFile "$PWD/unity-build-web-br.log"+ "$UNITY" -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget WebGL -executeMethod Statecraft.Game.EditorTools.Build.Web -compression gzip -shareable -logFile "$PWD/unity-build-web-gz.log"git checkout -- unity/Assets/Settings unity/ProjectSettings/ProjectSettings.asset- uv run tools/web_check.py unity/Builds/Web-brotli --query "golden&smoke=5" \+ uv run tools/web_check.py unity/Builds/Web-gzip --query "golden&smoke=5" \--expect "GOLDEN OK 1950 e4ebff9b317a02b908434cedb18674608ae820e5e60769ef78272493884590c4" \--expect "GOLDEN OK 1952 e0d8212a1f6ea8af9211166aa52b76c741c739807d4326b6b6664a5c5d26857f" \--expect "SMOKE OK 5 turns 1948-10-15 2436927c8b24f28c42be0e7b5a6fe30900f2f6c6a3ba77e4be943c1f50db57cc"- bash scripts/oss/package_web.sh unity/Builds/Web-brotli unity/Builds/statecraft-israel-vX.Y.Z-web.zip+ bash scripts/oss/package_web.sh unity/Builds/Web-gzip unity/Builds/statecraft-israel-vX.Y.Z-web.zip```+ The release build is gzip, not Brotli (owner decision on #879, 17 October 2026: "gzip for both", one zip for GitHub+ Releases and itch.io). itch.io's CDN decodes a `.br` file and re-encodes it by content type, and it sends Unity's+ `.data` (`application/octet-stream`) to the player uncompressed; a gzip `.data` stays gzip. Estimated from the 15 October+ build's files, that is about 34 MB to download per player instead of about 46 MB. Both load in a browser with Decompression+ Fallback off, as `Build.Web` sets it, and `web_check.py` serves `*.gz` with `Content-Encoding: gzip`.+`package_web.sh` copies the licence and attribution files into the build folder, then runs`tools/package_release.py`, M3's sensitivity gate, which zips the folder and prints `PACKAGED …` or`PACKAGE REFUSED …`. It refuses a build that was not made with `-shareable` (the build's `event-photos.json` saysdiff --git a/docs/dev-setup.md b/docs/dev-setup.mdindex 5477c3538..a79f08482 100644--- a/docs/dev-setup.md+++ b/docs/dev-setup.md@@ -80,4 +80,4 @@ Not possible without Unity and not in CI: the Unity EditMode tests, player build- A player build rewrites some URP asset and player-setting fields as build-time caches; drop them afterwards with`git checkout -- unity/Assets/Settings unity/ProjectSettings/ProjectSettings.asset`.- Play a build locally: `python3 -m http.server 8000 --directory unity/Builds/Web-disabled`, then open http://localhost:8000/.- A Brotli build needs `Content-Encoding: br`; serve it with web_check's handler (command in `docs/m3-release.md`).+ A gzip or Brotli build needs `Content-Encoding`; serve it with web_check's handler (command in `docs/m3-release.md`).diff --git a/docs/m3-release.md b/docs/m3-release.mdindex 55f7005b0..81cd98e70 100644--- a/docs/m3-release.md+++ b/docs/m3-release.md@@ -4,7 +4,7 @@start of M4, as a private Draft (owner ruling, 2026-10-10); their sections below are kept, marked "Deferred to M4".## What ships-- **Folder and zip:** `unity/Builds/Web-brotli/` uses Brotli compression with no decompression fallback. It is zipped as `unity/Builds/statecraft-m3-web.zip`, with `index.html` at the zip root. Both are build output and are not committed.+- **Folder and zip:** `unity/Builds/Web-gzip/` uses gzip compression with no decompression fallback (it was Brotli until the owner's decision on #879, 17 October 2026: "gzip for both"; `docs/RELEASING.md`, step 5, says why). It is zipped as `unity/Builds/statecraft-m3-web.zip`, with `index.html` at the zip root. Both are build output and are not committed.- **File names:** the files under `Build/` are named by their content hash (issue #437), for example`Build/814d5f9032ce4b5847cf75e492700bbb.loader.js`, so a browser that cached an earlier build cannot mix its files intothis one. The build's `index.html` names them; nothing else may assume a name. `index.html` keeps its fixed name and@@ -13,11 +13,11 @@ start of M4, as a private Draft (owner ruling, 2026-10-10); their sections belowfiles (`content/`, `map/`, `video/` and the start screen's recording) keep their names; the player adds the build'sid to every URL it fetches them by (`?b=<Application.buildGUID>`,`GameInputs.WithBuildId`), so a browser cannot serve one build's cached content to another.-- **Built by:** `"$UNITY" -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget WebGL -executeMethod Statecraft.Game.EditorTools.Build.Web -compression brotli -shareable -logFile "$PWD/unity-build-web-br.log"`, then `python3 tools/package_release.py` (it zips the folder, `index.html` at the root, and refuses while any sensitive event is not sensitivity-reviewed, and when the build's `event-photos.json` is missing, says the build was not `-shareable`, or lists an unreviewed sensitive event photograph). Never zip by hand.+- **Built by:** `"$UNITY" -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget WebGL -executeMethod Statecraft.Game.EditorTools.Build.Web -compression gzip -shareable -logFile "$PWD/unity-build-web-gz.log"`, then `python3 tools/package_release.py` (it zips the folder, `index.html` at the root, and refuses while any sensitive event is not sensitivity-reviewed, and when the build's `event-photos.json` is missing, says the build was not `-shareable`, or lists an unreviewed sensitive event photograph). Never zip by hand.- **After building:** drop the build's rewrites of the settings with`git checkout -- unity/Assets/Settings unity/ProjectSettings/ProjectSettings.asset` (as in `dev-setup.md`), so nobuild-cache change gets committed.-- **Verified locally by:** `uv run tools/web_check.py unity/Builds/Web-brotli --query "golden&smoke=5"` with the three+- **Verified locally by:** `uv run tools/web_check.py unity/Builds/Web-gzip --query "golden&smoke=5"` with the threefull `--expect` values pinned in `docs/determinism.md` (both goldens and the smoke line). This runs both golden hashesin the WebGL IL2CPP player, then plays five turns through the UI's own buttons (answering two events through the card:the IDF founding order on turn 2, the first truce on turn 4).@@ -58,9 +58,9 @@ start of M4, as a private Draft (owner ruling, 2026-10-10); their sections belowreal connection 4.3 MB less to fetch is worth far more (3.5 s at 10 Mbit/s).- **Goldens:** `uv run tools/web_check.py unity/Builds/Web-disabled --query "golden&smoke=5"` with the three `--expect`values from `docs/determinism.md`: PASS on both builds (the Brotli build too).-- **Play it locally:** serve the folder with web_check's handler, which sends `Content-Encoding: br` for `*.br`. Plain `python3 -m http.server` does not, so the Brotli build would not load. Then open http://localhost:8000/.+- **Play it locally:** serve the folder with web_check's handler, which sends `Content-Encoding: gzip` for `*.gz` (and `br` for `*.br`). Plain `python3 -m http.server` does not, so a compressed build would not load. Then open http://localhost:8000/.```- uv run --python 3.12 python -c "import sys,functools,http.server; sys.path.insert(0,'tools'); import web_check as w; http.server.ThreadingHTTPServer(('127.0.0.1',8000), functools.partial(w.Handler, directory='unity/Builds/Web-brotli')).serve_forever()"+ uv run --python 3.12 python -c "import sys,functools,http.server; sys.path.insert(0,'tools'); import web_check as w; http.server.ThreadingHTTPServer(('127.0.0.1',8000), functools.partial(w.Handler, directory='unity/Builds/Web-gzip')).serve_forever()"```The uncompressed build also works with `python3 -m http.server 8000 --directory unity/Builds/Web-disabled`.- **Console lines a browser check can rely on:**@@ -280,7 +280,7 @@ Deferred to the start of M4, as a private Draft (owner ruling, 2026-10-10). Theowner's itch.io account and is never automated, and the build must pass the sensitivity gate above (`-shareable`).1. Sign in at https://itch.io. Go to Dashboard, then **Create new project**.2. Set the title to "Statecraft: Israel (M3 preview)", Kind of project to **HTML**, and Classification to Games.-3. Under Uploads, upload the zip made by `bash scripts/oss/package_web.sh unity/Builds/Web-brotli unity/Builds/statecraft-m3-web.zip` (it puts the licence and attribution files inside, then runs `tools/package_release.py`; see `docs/RELEASING.md`) and tick **This file will be played in the browser**.+3. Under Uploads, upload the zip made by `bash scripts/oss/package_web.sh unity/Builds/Web-gzip unity/Builds/statecraft-m3-web.zip` (it puts the licence and attribution files inside, then runs `tools/package_release.py`; see `docs/RELEASING.md`) and tick **This file will be played in the browser**.4. Embed options:- Viewport **1280 × 720**. It fits a 1366×768 or 1440×900 laptop page without scrolling, and under the UI'sScaleWithScreenSize (reference 1920×1080) it lays out exactly like 1920×1080; `UiLayoutTests` covers 1280×720.@@ -292,7 +292,10 @@ owner's itch.io account and is never automated, and the build must pass the sens- Then choose **Restricted** (password) or **Public**.6. Record the page URL below under "Published at".-itch.io serves `.br` files with `Content-Encoding: br`, because it detects the extension, so no server settings are needed.+No server settings are needed. itch.io detects gzip from the bytes and sends it with `Content-Encoding: gzip`; it also+detects `.br`, but its CDN decodes Brotli and re-encodes by content type, so a Brotli `.data` reached players+uncompressed (checked with curl on two public Unity games, 17 October 2026). That is why the release build is gzip+(#879); see https://itch.io/docs/creators/html5, "Compression".Published at: (owner fills in)diff --git a/scripts/oss/package_web.sh b/scripts/oss/package_web.shindex 7beef87a3..f39ebc340 100755--- a/scripts/oss/package_web.sh+++ b/scripts/oss/package_web.sh@@ -3,7 +3,7 @@# (tools/package_release.py: it refuses until every sensitive event is sensitivity-reviewed), then prove the notices# are in the zip by listing it. no_human shipped a bundle whose notices file pointed at a script that never copied# them; this script checks the artefact itself.-# Usage: bash scripts/oss/package_web.sh unity/Builds/Web-brotli unity/Builds/statecraft-israel-vX.Y.Z-web.zip+# Usage: bash scripts/oss/package_web.sh unity/Builds/Web-gzip unity/Builds/statecraft-israel-vX.Y.Z-web.zip# PACKAGE_RELEASE overrides the zipping script (tests only).set -euo pipefailbuild="${1:?usage: package_web.sh BUILD_DIR ZIP_PATH}"diff --git a/scripts/oss/tests/test_release.py b/scripts/oss/tests/test_release.pyindex dea3c9fd6..49a41c509 100644--- a/scripts/oss/tests/test_release.py+++ b/scripts/oss/tests/test_release.py@@ -74,3 +74,19 @@ def test_a_stale_zip_does_not_survive_a_refusal(tmp_path):def test_release_gate_uses_a_temp_file_not_a_fixed_path():text = (ROOT / "scripts/oss/release_gate.sh").read_text()assert "mktemp" in text and "/tmp/oss-release-scan.txt" not in text+++def test_the_release_web_build_is_gzip_end_to_end():+ """Owner decision on #879 (17 Oct 2026, "gzip for both"): one gzip zip for GitHub Releases and itch.io. itch.io's+ CDN passes a Brotli `.data` to the player uncompressed but keeps a gzip `.data` compressed. The release recipe in+ RELEASING.md step 5 must build gzip and check and package that same folder, and the packager's default must agree."""+ text = (ROOT / "docs/RELEASING.md").read_text()+ step5 = text[text.index("5. **Build and package**"):text.index("6. **Tag and publish")]+ build = re.search(r"^.*Build\.Web -compression (\S+).*$", step5, re.M) # the first Build.Web line: the release build+ assert build and build.group(1) == "gzip", "the release build must use -compression gzip"+ assert "-decompressionFallback" not in build.group(0) # itch.io sends Content-Encoding: no fallback (Build.Web)+ assert "uv run tools/web_check.py unity/Builds/Web-gzip " in step5+ assert "bash scripts/oss/package_web.sh unity/Builds/Web-gzip " in step5+ assert "Web-brotli" not in step5+ packager = (ROOT / "tools/package_release.py").read_text()+ assert 'default=str(REPO / "unity/Builds/Web-gzip")' in packagerdiff --git a/tools/README.md b/tools/README.mdindex 14fd581b3..c5337cd4b 100644--- a/tools/README.md+++ b/tools/README.md@@ -45,7 +45,7 @@ Offline data tools (uv inline-script Python). Run from the repo root.`run` checks one against GitHub's SHA-256 digest for the asset, unpacks it, checks the notices sit beside the player, runs itwith `-batchmode -nographics -golden` and passes only on exit 0 with both `GOLDEN OK` lines from the golden manifest,printing the player log otherwise. Stdlib only; no Unity and no licence needed.-- `package_release.py` zips a Brotli WebGL build for sharing (`unity/Builds/statecraft-m3-web.zip`) and refuses+- `package_release.py` zips a WebGL release build (gzip, `unity/Builds/Web-gzip`; #879) for sharing (`unity/Builds/statecraft-m3-web.zip`) and refuses(exit 1) until every sensitive event is `sensitivity-reviewed` (docs/m3-release.md). The files under `Build/` arenamed by their content hash (issue #437); it reads their names from the build's `index.html`, zips only those andrefuses a build that is missing one.diff --git a/tools/package_release.py b/tools/package_release.pyindex a42d14fda..11672df41 100644--- a/tools/package_release.py+++ b/tools/package_release.py@@ -2,7 +2,7 @@event with a sensitive tag (spec 5.5; docs/m3-release.md). The gate is the sim's own (Statecraft.Cli --release-gate),run on the content INSIDE the build folder, so it checks exactly what would ship. Stdlib only (plus the .NET SDK).- python3 tools/package_release.py [--build unity/Builds/Web-brotli] [--zip unity/Builds/statecraft-m3-web.zip]+ python3 tools/package_release.py [--build unity/Builds/Web-gzip] [--zip unity/Builds/statecraft-m3-web.zip]Exit 0 and "PACKAGED <zip> <bytes>" on success; exit 1 and "PACKAGE REFUSED ..." when the gate refuses or the build isnot a WebGL build folder.@@ -102,7 +102,7 @@ def package(build: Path, zip_path: Path) -> int:def main(argv=None) -> int:p = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)- p.add_argument("--build", default=str(REPO / "unity/Builds/Web-brotli"))+ p.add_argument("--build", default=str(REPO / "unity/Builds/Web-gzip"))p.add_argument("--zip", default=str(REPO / "unity/Builds/statecraft-m3-web.zip"))a = p.parse_args(argv)return package(Path(a.build), Path(a.zip))diff --git a/unity/Assets/Editor/Build.cs b/unity/Assets/Editor/Build.csindex 598387610..86bbf6091 100644--- a/unity/Assets/Editor/Build.cs+++ b/unity/Assets/Editor/Build.cs@@ -180,7 +180,7 @@ namespace Statecraft.Game.EditorToolsvar name = Arg("-compression") ?? "disabled";ProjectSetup.Apply();PlayerSettings.WebGL.compressionFormat = Compression(name);- PlayerSettings.WebGL.decompressionFallback = false; // itch.io serves .br/.gz with Content-Encoding+ PlayerSettings.WebGL.decompressionFallback = false; // itch.io and web_check send .gz/.br with Content-Encoding; the release is gzip (#879)var savedSubtarget = EditorUserBuildSettings.webGLBuildSubtarget;var sub = TextureSubtarget(Arg("-textureSubtarget"));if (sub.HasValue) EditorUserBuildSettings.webGLBuildSubtarget = sub.Value;