Play: say at the start when a newer release is out (#3720) #3727

Closed
github-bot wants to merge 1 commit from github-bot/gh-3727 into main AGit
Owner

@⁠sansj24k on GitHub · 2026-11-30 05:04 UTC · original
sansj24k:feat/update-check → main · +192 −0 · 4 files · 1 commits · closed without merging

Fixes #3720 (the check; see "Left out" for the parts it does not do)

What it changes

Releases come several a day, and nothing told a player that a newer one was out short of looking on GitHub, so reports kept arriving from builds a later one had already fixed.

  • The build stamps its commit. apps/victory/build.rs sets VICTORY_BUILD_COMMIT from git rev-parse HEAD, or from the environment when that is set (a build outside a checkout). It is empty when unknown, and then there is no check. The build script reruns only when HEAD, the branch's ref or packed-refs changes, and only files that exist are watched.
  • One line in the console when a newer release is out. New apps/victory/src/update.rs: after play::prepare has set the environment (its SAFETY note says no other thread runs before that), a thread victory-update-check runs Windows PowerShell, as get-dlss and the other fetchers already do, so there is no new crate and Cargo.lock is unchanged. It makes two requests to GitHub's API: releases/latest, then compare/<this build's commit>...<tag>. When the release has commits this build lacks (ahead, or diverged for a branch made from an older main) it prints:
    A newer release is out: v2026.11.29.05 (356 commits this build does not have). Download it from https://github.com/trustno1-coder/VIctory-NVIDIA/releases/latest (VICTORY_UPDATE_CHECK=0 turns this check off).
    identical or behind prints nothing.
  • It never gets in the way. The game starts at once and the line comes when the answer does (10 s timeout per request). Any failure is silent: no network, a commit GitHub doesn't know (a local build with unpushed commits), or an answer that doesn't parse. The reply is read only when the tag is plain characters, the status is one the API gives and the count is a number. The repository and commit go to PowerShell as environment variables, not into the script text, and the tag is URL-escaped. The requests carry nothing but a generic User-Agent.
  • VICTORY_UPDATE_CHECK=0 turns it off. It is read before prepare, because prepare clears VICTORY_* variables it doesn't keep, and again after it (--set, victory-settings.txt). The README's quick start says what the check does.

Left out, on purpose

  • No download or self-replace (the issue's item 2, victory update). victory.exe is unsigned, and a program that rewrites itself from the network is a bigger decision than a notice. The notice gives the link, and the player downloads as before.
  • No UPDATE AVAILABLE line in F1, and nothing in scripts\play-foxhound.ps1. Script users build from a checkout and git pull. Both could follow if this shape is wanted.

How it was tested

  • GPU and profile: not run with the game (no dump on this PC). prepare needs the title, so the thread itself was not started end to end. Its parts were tested separately:
    • The stamp: VICTORY_BUILD_COMMIT is in the built victory.exe (41adb551…), and a second cargo build is up to date (the build script doesn't rerun).
    • The request, run as the exact PowerShell the code sends, against the live API: with main's head commit it returns v2026.11.29.05 identical 0 (nothing printed), and with main~40 it returns v2026.11.29.05 ahead 356 (announced).
    • Unit tests in update.rs: the switch either way and no commit (wanted), reading the reply only when every part is the API's (parse), and which statuses are announced (notice).
  • cargo test -p victory: 86 passed (83 + 1 + 2), 0 failed.
  • cargo clippy -p victory --all-targets --no-deps -- -D warnings: clean for apps/victory. The workspace gate fails on main for the reasons #2019 / #3530 fix.
  • cargo xtask policy --staged: ok.
  • cargo test passed for the crates it touches: yes.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: none for #3720 (searched "update check", "updater", "latest release"). #3687 adds an early return at the top of the same build.rs main() for non-Windows targets: whichever lands second needs a small rebase there. Its order with build_commit() does not matter, since update.rs is cfg(windows). The main.rs change is two lines in the Play arm.
**@⁠sansj24k** on GitHub · 2026-11-30 05:04 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3727) `sansj24k:feat/update-check` → `main` · +192 −0 · 4 files · 1 commits · closed without merging Fixes #3720 (the check; see "Left out" for the parts it does not do) ## What it changes Releases come several a day, and nothing told a player that a newer one was out short of looking on GitHub, so reports kept arriving from builds a later one had already fixed. - **The build stamps its commit.** `apps/victory/build.rs` sets `VICTORY_BUILD_COMMIT` from `git rev-parse HEAD`, or from the environment when that is set (a build outside a checkout). It is empty when unknown, and then there is no check. The build script reruns only when HEAD, the branch's ref or `packed-refs` changes, and only files that exist are watched. - **One line in the console when a newer release is out.** New `apps/victory/src/update.rs`: after `play::prepare` has set the environment (its SAFETY note says no other thread runs before that), a thread `victory-update-check` runs Windows PowerShell, as `get-dlss` and the other fetchers already do, so there is no new crate and `Cargo.lock` is unchanged. It makes two requests to GitHub's API: `releases/latest`, then `compare/<this build's commit>...<tag>`. When the release has commits this build lacks (`ahead`, or `diverged` for a branch made from an older main) it prints: `A newer release is out: v2026.11.29.05 (356 commits this build does not have). Download it from https://github.com/trustno1-coder/VIctory-NVIDIA/releases/latest (VICTORY_UPDATE_CHECK=0 turns this check off).` `identical` or `behind` prints nothing. - **It never gets in the way.** The game starts at once and the line comes when the answer does (10 s timeout per request). Any failure is silent: no network, a commit GitHub doesn't know (a local build with unpushed commits), or an answer that doesn't parse. The reply is read only when the tag is plain characters, the status is one the API gives and the count is a number. The repository and commit go to PowerShell as environment variables, not into the script text, and the tag is URL-escaped. The requests carry nothing but a generic `User-Agent`. - **`VICTORY_UPDATE_CHECK=0` turns it off.** It is read before `prepare`, because `prepare` clears `VICTORY_*` variables it doesn't keep, and again after it (`--set`, `victory-settings.txt`). The README's quick start says what the check does. ## Left out, on purpose - **No download or self-replace (the issue's item 2, `victory update`).** `victory.exe` is unsigned, and a program that rewrites itself from the network is a bigger decision than a notice. The notice gives the link, and the player downloads as before. - **No `UPDATE AVAILABLE` line in F1, and nothing in `scripts\play-foxhound.ps1`.** Script users build from a checkout and `git pull`. Both could follow if this shape is wanted. ## How it was tested - GPU and profile: not run with the game (no dump on this PC). `prepare` needs the title, so the thread itself was not started end to end. Its parts were tested separately: - The stamp: `VICTORY_BUILD_COMMIT` is in the built `victory.exe` (`41adb551…`), and a second `cargo build` is up to date (the build script doesn't rerun). - The request, run as the exact PowerShell the code sends, against the live API: with main's head commit it returns `v2026.11.29.05 identical 0` (nothing printed), and with `main~40` it returns `v2026.11.29.05 ahead 356` (announced). - Unit tests in `update.rs`: the switch either way and no commit (`wanted`), reading the reply only when every part is the API's (`parse`), and which statuses are announced (`notice`). - `cargo test -p victory`: 86 passed (83 + 1 + 2), 0 failed. - `cargo clippy -p victory --all-targets --no-deps -- -D warnings`: clean for `apps/victory`. The workspace gate fails on main for the reasons #2019 / #3530 fix. - `cargo xtask policy --staged`: ok. - `cargo test` passed for the crates it touches: yes. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: none for #3720 (searched "update check", "updater", "latest release"). #3687 adds an early return at the top of the same `build.rs` `main()` for non-Windows targets: whichever lands second needs a small rebase there. Its order with `build_commit()` does not matter, since `update.rs` is `cfg(windows)`. The `main.rs` change is two lines in the `Play` arm.
Releases come several a day and nothing told a player that a newer one
was there short of looking on GitHub, so reports kept arriving from
builds a later one had fixed.

build.rs stamps the commit the program is built from
(VICTORY_BUILD_COMMIT, from git, or from the environment; empty when
unknown). After `prepare` has set up the start, a thread of its own asks
GitHub's API through Windows PowerShell for the latest release and how
its tag compares with that commit; when the release has commits this
build lacks (`ahead`, or `diverged` for a branch made from an older
main), the console says so with the link. Nothing is downloaded or
replaced: victory.exe is unsigned, and a program that rewrites itself
from the network stays out. Any failure (no network, a commit GitHub
does not know, an answer it does not read) says nothing, and the start
never waits for it.

VICTORY_UPDATE_CHECK=0 turns it off: read before `prepare` (which clears
the VICTORY_ variables it does not keep) and after it (--set,
victory-settings.txt).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 05:07:53 +00:00
github-bot closed this pull request 2026-12-01 18:51:27 +00:00
Author
Owner

@⁠trustno1-coder on GitHub · 2026-12-01 18:49 UTC · original

Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

**@⁠trustno1-coder** on GitHub · 2026-12-01 18:49 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3727#issuecomment-7321615390) Closing this as part of moving main to the texture and video-memory rework (v2026.12.01.01-test). A lot of the code changed, and this pull request no longer applies cleanly to it; it would need to be rewritten against the new main rather than rebased. Thank you for the work. If the change is still needed, please open a new pull request based on the current main.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!3727
No description provided.