diff --git a/AGENTS.md b/AGENTS.md index a4a2bfa6..18cafffe 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,7 @@ ## Authority and scope -- This is U-Jagd 1.3.292 (`src/core/version.py`); saves are written as v53 and older saves from v38 on are lifted to v53 on load (`src/core/save_migrate.py`). Treat these as compatibility contracts, not changelog entries. +- This is U-Jagd 1.3.293 (`src/core/version.py`); saves are written as v53 and older saves from v38 on are lifted to v53 on load (`src/core/save_migrate.py`). Treat these as compatibility contracts, not changelog entries. - Resolve conflicts in this order: executable code and focused tests; packaged JSON/runtime resources; `pyproject.toml` and provenance/license notices; `README.md`; design/history documents under `docs/`. A plan or old comment is not an implementation contract. - Preserve explicit compatibility tests and user data unless a task intentionally changes the contract. Add a regression test for behavior changes. - Older phase/milestone labels under `docs/GDD.md`, `docs/implementation-plan.md`, `docs/plan-0.1.6.md`, and `docs/plan-0.1.7.md` are historical, and so is `docs/plan-1.3.md` (the plan 1.3.0 was built from). Current resumable work is tracked in `docs/resume.md`. diff --git a/CHANGELOG.de.md b/CHANGELOG.de.md index cf496b2b..2b8bd2ff 100644 --- a/CHANGELOG.de.md +++ b/CHANGELOG.de.md @@ -4,6 +4,18 @@ Alle Versionen von U-Jagd, die neueste zuerst. Die [README](README.de.md) zeigt nur die neueste. +## 1.3.293 + +Version 1.3.293 lässt die uConsole wieder große Updates laden. Ein +Release mit vielen neuen Handbuchbildern ist viele MB groß, und der +Updater brach jeden Git-Download nach 60 s ab; im langsameren WLAN +scheiterte „Jetzt updaten“ deshalb jedes Mal und das Spiel blieb auf +seiner alten Version. Ein Download darf jetzt bis zu 30 Minuten dauern, +ein hängender bricht weiter nach 15 s unter 1 KB/s ab, und das +Startfenster zeigt beim Warten „Lade Update“. Eine uConsole mit 1.3.292 +oder älter holt das Release einmal von Hand (siehe uConsole-Anleitung). +Spielstände sind v53; v38 bis v52 laden weiter. + ## 1.3.292 Version 1.3.292 setzt Befehle per Sprache zuverlässig um. Bisher entschied diff --git a/CHANGELOG.md b/CHANGELOG.md index 1971d656..35bcd017 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ Every U-Jagd release, newest first. The [README](README.md) shows only the latest one. +## 1.3.293 + +Release 1.3.293 lets the uConsole download large updates again. A +release with many new manual pictures is tens of MB, and the updater cut +every git download off after 60 s, so on a slower WLAN "Update now" failed +each time and the game stayed on its old version. A download may now take +up to 30 minutes, a stalled one still stops after 15 s below 1 KB/s, and +the start window says "Downloading update" while it waits. A uConsole +still on 1.3.292 or older fetches the release once by hand (see the +uConsole install guide). Saves are v53; v38 to v52 saves still load. + ## 1.3.292 Release 1.3.292 carries out orders given by voice reliably. Before, a word diff --git a/README.de.md b/README.de.md index 532831c3..7519252f 100644 --- a/README.de.md +++ b/README.de.md @@ -10,18 +10,17 @@ die Fregatte F-217 mit neun Stationen oder ein U-Boot mit sieben und jagen die andere Seite oder entkommen ihr. Freunde können Stationen im Browser im selben Netz besetzen. -Aktuelle Version: **1.3.292** +Aktuelle Version: **1.3.293** -Version 1.3.292 setzt Befehle per Sprache zuverlässig um. Bisher entschied -eine Wortliste, ob ein gesprochener Satz ein Befehl ist, sodass "Kurs neunzig", -"Tiefe 80" oder "Fahrt 15" als Frage endeten und nichts gesetzt wurde. Jetzt -unterscheidet das Sprachmodell Befehl und Frage, auch mit gesprochenen Zahlen, -und Sprach- wie getippte Befehle umfassen zusätzlich Radar, aktiven Ping, -Baffles freifahren und die Rückkehr des Hubschraubers, im U-Boot Mast, -Schnorcheln, Auftauchen und Ausweichen; nie Waffen. Im Mehrspieler, solange -andere Spieler die Stationen besetzen, nimmt der Erste Offizier keine Befehle -an und beantwortet nur Fragen. Spielstände sind v53; v38- bis v52-Stände laden -weiterhin. +Version 1.3.293 lässt die uConsole wieder große Updates laden. Ein +Release mit vielen neuen Handbuchbildern ist viele MB groß, und der +Updater brach jeden Git-Download nach 60 s ab; im langsameren WLAN +scheiterte „Jetzt updaten“ deshalb jedes Mal und das Spiel blieb auf +seiner alten Version. Ein Download darf jetzt bis zu 30 Minuten dauern, +ein hängender bricht weiter nach 15 s unter 1 KB/s ab, und das +Startfenster zeigt beim Warten „Lade Update“. Eine uConsole mit 1.3.292 +oder älter holt das Release einmal von Hand (siehe uConsole-Anleitung). +Spielstände sind v53; v38 bis v52 laden weiter. Frühere Versionen: [CHANGELOG.de.md](CHANGELOG.de.md). diff --git a/README.md b/README.md index b14af427..691c569c 100644 --- a/README.md +++ b/README.md @@ -10,17 +10,16 @@ the frigate F-217 with nine stations, or a submarine with seven, and hunt or evade the other side. Friends can crew stations from a browser on the same network. -Current release: **1.3.292** +Current release: **1.3.293** -Release 1.3.292 carries out orders given by voice reliably. Before, a word -list decided whether a spoken sentence was an order, so "course ninety", -"depth 80" or "speed 15" ended up as questions and nothing was set. Now the -language model tells an order from a question, also with spoken numbers, and -voice and typed orders also cover radar, an active ping, clearing the baffles -and the helicopter's return, and on the submarine the mast, snorkeling, -surfacing and evading; never weapons. In multiplayer, while other people crew -the stations, the executive officer takes no orders and only answers -questions. Saves are v53; v38 to v52 saves still load. +Release 1.3.293 lets the uConsole download large updates again. A +release with many new manual pictures is tens of MB, and the updater cut +every git download off after 60 s, so on a slower WLAN "Update now" failed +each time and the game stayed on its old version. A download may now take +up to 30 minutes, a stalled one still stops after 15 s below 1 KB/s, and +the start window says "Downloading update" while it waits. A uConsole +still on 1.3.292 or older fetches the release once by hand (see the +uConsole install guide). Saves are v53; v38 to v52 saves still load. Earlier releases: [CHANGELOG.md](CHANGELOG.md). diff --git a/docs/install-uconsole.en.md b/docs/install-uconsole.en.md index f39dbb1c..a61315cb 100644 --- a/docs/install-uconsole.en.md +++ b/docs/install-uconsole.en.md @@ -40,10 +40,19 @@ notice appears. Only the button closes the game and runs release, runs `pip install -e .` when dependencies changed and starts the new version. A new version that does not even start (`main.py --version` fails) is rolled back, and only the next version is tried again. Local changes in the -checkout or a branch other than `main` leave everything untouched. A stalled -git download gives up after 60 s at most. Log: `~/.u-jagd/updater.log`. Saves +checkout or a branch other than `main` leave everything untouched. A git +download may take up to 30 minutes on a slow link; it gives up after 15 s +below 1 KB/s. Log: `~/.u-jagd/updater.log`. Saves under `~/.u-jagd/` are not touched. +Up to 1.3.292 the updater cut every git download off after 60 s. If the log +says `timed out after 60 seconds`, fetch once by hand and then press U in the +game: + +```sh +cd ~/games/u-jagd && git fetch --no-tags origin main +``` + **Crash log:** every game start writes a start and an end line to `~/.u-jagd/crash.log`. If the game ends on an error, the traceback is there; after a hard crash (a segmentation fault in SDL or audio, `SIGTERM`) the diff --git a/docs/install-uconsole.md b/docs/install-uconsole.md index 9f559325..b6933c2a 100644 --- a/docs/install-uconsole.md +++ b/docs/install-uconsole.md @@ -42,10 +42,19 @@ holt das Release, führt bei geänderten Abhängigkeiten `pip install -e .` aus und startet die neue Version. Startet eine neue Version nicht einmal (`main.py --version` schlägt fehl), wird sie zurückgerollt und erst die nächste Version wieder versucht. Bei eigenen Änderungen im Checkout oder auf -einem anderen Zweig als `main` wird nichts verändert. Hängende Git-Abrufe -brechen nach spätestens 60 s ab. Protokoll: `~/.u-jagd/updater.log`. +einem anderen Zweig als `main` wird nichts verändert. Ein Git-Download darf +auf langsamer Verbindung bis zu 30 Minuten dauern; er bricht ab, wenn 15 s +lang weniger als 1 KB/s ankommt. Protokoll: `~/.u-jagd/updater.log`. Speicherstände unter `~/.u-jagd/` bleiben unberührt. +Bis 1.3.292 brach der Updater jeden Git-Download schon nach 60 s ab. Steht im +Protokoll `timed out after 60 seconds`, einmal von Hand vorladen und danach +im Spiel U drücken: + +```sh +cd ~/games/u-jagd && git fetch --no-tags origin main +``` + **Absturzprotokoll:** Jeder Spielstart schreibt nach `~/.u-jagd/crash.log` eine Start- und eine Endzeile. Endet das Spiel durch einen Fehler, steht dort der Traceback; bei einem harten Absturz (Speicherzugriffsfehler in SDL oder diff --git a/packaging/uconsole/u_jagd_updater.py b/packaging/uconsole/u_jagd_updater.py index 58150614..0569e42e 100755 --- a/packaging/uconsole/u_jagd_updater.py +++ b/packaging/uconsole/u_jagd_updater.py @@ -53,6 +53,10 @@ NET_TIMEOUT_S = 6 PROBE_TIMEOUT_S = 2.5 PROBE_HOST = ("github.com", 443) GIT_TIMEOUT_S = 60 +# Downloading a release: one with new manual pictures is tens of MB, and git +# throws away a fetch cut off half way, so a short cap never finishes on a +# slow link. A stalled remote still stops after 15 s below 1 KB/s (GIT_ENV). +DOWNLOAD_TIMEOUT_S = 1800 # git gives up on a stalled or unreachable remote instead of hanging the start GIT_ENV = {"GIT_TERMINAL_PROMPT": "0", "GIT_HTTP_LOW_SPEED_LIMIT": "1000", "GIT_HTTP_LOW_SPEED_TIME": "15"} @@ -216,8 +220,12 @@ def verify(app: Path) -> str | None: return lines[-1] if result.returncode == 0 and lines else None -def resolve_target(app: Path, channel: str) -> tuple[str, str] | None: - """(label, commit) to move to, or None when there is nothing to do.""" +def resolve_target(app: Path, channel: str, + progress=None) -> tuple[str, str] | None: + """(label, commit) to move to, or None when there is nothing to do. + + ``progress("download", label=...)`` is reported before a release is + fetched, so the start window says what the wait is for.""" if channel != "main": tag = fetch_latest_release() if tag is None: @@ -228,12 +236,14 @@ def resolve_target(app: Path, channel: str) -> tuple[str, str] | None: current = installed_version(app) if current is not None and new <= current: return None + if progress is not None: + progress("download", label=tag) git(app, "fetch", "--quiet", "--no-tags", "origin", - f"+refs/tags/{tag}:refs/tags/{tag}") + f"+refs/tags/{tag}:refs/tags/{tag}", timeout=DOWNLOAD_TIMEOUT_S) return tag, git(app, "rev-parse", f"refs/tags/{tag}^{{commit}}") log("no GitHub release yet; following origin/main") try: - git(app, "fetch", "--quiet", "origin", "main") + git(app, "fetch", "--quiet", "origin", "main", timeout=DOWNLOAD_TIMEOUT_S) except (RuntimeError, subprocess.SubprocessError) as exc: log(f"fetch failed ({exc}); starting installed version") return None @@ -307,7 +317,7 @@ def update(app: Path = APP_DIR, channel: str | None = None, progress=_no_progres if not online(): log("offline (GitHub not reachable); update check skipped") return False - target = resolve_target(app, channel) + target = resolve_target(app, channel, progress) old = git(app, "rev-parse", "HEAD") if target is None or target[1] == old: return False @@ -320,7 +330,8 @@ def update(app: Path = APP_DIR, channel: str | None = None, progress=_no_progres return False deps_changed = bool(git(app, "diff", "--name-only", old, new, "--", *DEP_FILES)) log(f"updating to {label} ({new[:10]})") - progress("download", label=label) + if label == "main": # a release reported its download before fetching + progress("download", label=label) if branch == "main": git(app, "merge", "--quiet", "--ff-only", new) else: diff --git a/src/core/version.py b/src/core/version.py index c907f8ff..79333479 100644 --- a/src/core/version.py +++ b/src/core/version.py @@ -4,7 +4,7 @@ This module is deliberately dependency-free because setuptools imports the version while building the project. """ -APP_VERSION = "1.3.292" +APP_VERSION = "1.3.293" SAVE_VERSION = 53 SAVE_SCHEMA = "u-jagd-save-v53" SPLASH_TEXT = ( diff --git a/tests/test_packaging.py b/tests/test_packaging.py index 656e034b..e00e9ac0 100644 --- a/tests/test_packaging.py +++ b/tests/test_packaging.py @@ -86,7 +86,7 @@ def test_source_and_wheel_contain_editor_templates(tmp_path): (ROOT / "data/contact_analysis" / name).read_bytes() assert any(name.endswith(".dist-info/licenses/THIRD_PARTY_NOTICES.md") for name in wheel_names) - assert any(name.endswith("-1.3.292.dist-info/METADATA") for name in wheel_names) + assert any(name.endswith("-1.3.293.dist-info/METADATA") for name in wheel_names) source = next(tmp_path.glob("u_jagd-*.tar.gz")) with tarfile.open(source) as archive: @@ -139,7 +139,7 @@ def test_source_and_wheel_contain_editor_templates(tmp_path): [sys.executable, "-c", "from importlib import resources; " "assert resources.files('data.editor_templates').joinpath('mission.json').is_file(); " - "from src.core.version import APP_VERSION; assert APP_VERSION == '1.3.292'; " + "from src.core.version import APP_VERSION; assert APP_VERSION == '1.3.293'; " "from src.commander.server import CommanderServer; " "server=CommanderServer(); server.start('127.0.0.1',0); server.stop(); " "from src.core import manual; page=manual.html_page('de'); assert 'station-sonar' in page; " diff --git a/tests/test_startup.py b/tests/test_startup.py index c1b5e283..66afcdc0 100644 --- a/tests/test_startup.py +++ b/tests/test_startup.py @@ -14,9 +14,9 @@ from src.world.real_coast import sector_for_seed def test_release_version_and_exact_splash_text(): - assert APP_VERSION == "1.3.292" + assert APP_VERSION == "1.3.293" assert SPLASH_TEXT == ( - "Anti Sub Marine Warfare on uConsole by Dominik Bornhäußer Version 1.3.292" + "Anti Sub Marine Warfare on uConsole by Dominik Bornhäußer Version 1.3.293" ) diff --git a/tests/test_uconsole_updater.py b/tests/test_uconsole_updater.py index 4deb5120..b5038b12 100644 --- a/tests/test_uconsole_updater.py +++ b/tests/test_uconsole_updater.py @@ -254,6 +254,29 @@ def test_update_reports_each_step(repos, updater, monkeypatch): ("deps", {}), ("verify", {})] +def test_release_download_is_announced_and_not_cut_off_after_a_minute(repos, updater, monkeypatch): + # A release with new manual pictures is tens of MB: on the uConsole's + # WLAN the tag fetch took longer than the 60 s git cap, timed out at + # every "Update now" and the game stayed on 1.3.262. + work, app = repos + publish(work, "1.3.9") + monkeypatch.setattr(updater, "fetch_latest_release", lambda url=None: "v1.3.9") + events = [] + real_git = updater.git + + def git(app_dir, *args, timeout=updater.GIT_TIMEOUT_S): + if args[0] == "fetch": + events.append(("fetch", timeout)) + return real_git(app_dir, *args, timeout=timeout) + + monkeypatch.setattr(updater, "git", git) + assert updater.update(app, progress=lambda key, **v: events.append((key, v))) is True + assert events[:3] == [("check", {}), ("download", {"label": "v1.3.9"}), + ("fetch", updater.DOWNLOAD_TIMEOUT_S)] + assert updater.DOWNLOAD_TIMEOUT_S >= 15 * 60 + assert updater.GIT_ENV["GIT_HTTP_LOW_SPEED_TIME"] == "15" # stalls still stop + + def test_messages_have_same_keys_and_follow_saved_language(tmp_path, monkeypatch): module = load_updater() assert module.MESSAGES["de"].keys() == module.MESSAGES["en"].keys()