Game tests: every known build's hash is one identify() can match #303

Closed
github-bot wants to merge 1 commit from gh-pr/303/head into gh-pr/303/base
Owner

@⁠SkippySteve on GitHub · 2026-11-24 02:11 UTC · original
SkippySteve/victory-pr-own-next22 → main · +51 −0 · 1 files · 1 commits · closed without merging

KNOWN_BUILDS is matched against the hex BLAKE3 that run.rs computes for the executable. An entry with a typo, a truncated hash, stray whitespace or a duplicate would compile fine and simply never identify the build it names. victory-game/src/lib.rs has no tests today.

This adds a test module (tests only, no behaviour change):

  • known_builds_are_well_formed: each entry has a label, its hash is 64 lowercase hex digits (the form blake3::Hash::to_hex writes), and no label or hash appears twice.
  • every_known_build_is_identified_by_its_hash: identify() finds each build by its own hash, in lower or upper case.
  • unknown_hashes_are_not_identified: the BLAKE3 of empty input, an empty string and non-hex text identify nothing.

The list is empty on main, so the first two guard future entries. To check they bite, I temporarily added an entry with an uppercase hash; known_builds_are_well_formed failed as expected.

No game files or new dependencies; it runs on every host.

Tested on Linux:

  • cargo test -p victory-game: 5 passed
  • cargo clippy -p victory-game --all-targets -- -D warnings: clean
  • cargo fmt -p victory-game -- --check: clean
**@⁠SkippySteve** on GitHub · 2026-11-24 02:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/303) `SkippySteve/victory-pr-own-next22` → `main` · +51 −0 · 1 files · 1 commits · closed without merging `KNOWN_BUILDS` is matched against the hex BLAKE3 that `run.rs` computes for the executable. An entry with a typo, a truncated hash, stray whitespace or a duplicate would compile fine and simply never identify the build it names. `victory-game/src/lib.rs` has no tests today. This adds a test module (tests only, no behaviour change): - `known_builds_are_well_formed`: each entry has a label, its hash is 64 lowercase hex digits (the form `blake3::Hash::to_hex` writes), and no label or hash appears twice. - `every_known_build_is_identified_by_its_hash`: `identify()` finds each build by its own hash, in lower or upper case. - `unknown_hashes_are_not_identified`: the BLAKE3 of empty input, an empty string and non-hex text identify nothing. The list is empty on `main`, so the first two guard future entries. To check they bite, I temporarily added an entry with an uppercase hash; `known_builds_are_well_formed` failed as expected. No game files or new dependencies; it runs on every host. Tested on Linux: - `cargo test -p victory-game`: 5 passed - `cargo clippy -p victory-game --all-targets -- -D warnings`: clean - `cargo fmt -p victory-game -- --check`: clean
KNOWN_BUILDS is matched against the hex BLAKE3 that run.rs computes, so an
entry with a typo, a truncated hash, stray whitespace or a duplicate would
silently never identify the build it names. Check each entry is 64 lowercase
hex digits (the form blake3::Hash::to_hex writes), that labels and hashes are
unique, that identify() finds each build by its own hash in either case, and
that an unknown digest, an empty string or non-hex text identifies nothing.

The list is empty today, so the first two checks guard future entries; all
three run on every host without game files.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:58:34 +00:00
github-bot closed this pull request 2026-11-26 03:58:34 +00:00
Author
Owner

@⁠SkippySteve on GitHub · 2026-11-24 02:32 UTC · original

Superseded by #273, which now carries this commit (KNOWN_BUILDS tests) alongside the other victory-game fix.

**@⁠SkippySteve** on GitHub · 2026-11-24 02:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/303#issuecomment-7120246355) Superseded by #273, which now carries this commit (KNOWN_BUILDS tests) alongside the other victory-game fix.

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/Marvisak--VIctory!303
No description provided.