Game tests: cover CityHash64 length and block boundaries #2656

Open
XeNS1 wants to merge 1 commit from upstream-pr/2658 into main
XeNS1 commented 2026-11-25 17:41:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by XeNS1 on 2026-11-25T17:41:52Z.


The current CityHash64 regression checks 13 arithmetic-pattern inputs. It misses several length dispatch boundaries and exact 64-byte loop boundaries, so off-by-one changes there can pass the existing test. These hashes identify the compact pipeline states.

Add two tests with 42 independent reference cases: 36 generated inputs at short-input, 64-byte block and longer-loop boundaries, plus zero/0xff inputs at the compact 16/24/68-byte state sizes. Run each case at offsets 0 through 7 with unrelated bytes surrounding the slice (336 comparisons). All expected values come from Google's C++ CityHash64 at f5dc541, compiled locally with g++ -O2; that reference build also passes its upstream city-test.cc suite.

Validation on Linux x86-64 / Rust 1.100.0:

  • cargo test -p victory-game --locked --offline: 17 tests pass.
  • cargo clippy -p victory-game --all-targets --all-features --locked --offline -- -D warnings: passes.
  • rustfmt on the changed file, asset policy (184 files), and git diff --check: pass.
  • Five temporary mutations outside the repository are all detected: 4/17/33-byte boundary mistakes, an extra loop iteration at exact 64-byte multiples, and treating NUL as end of input. The pre-existing reference test passes all five mutations.

Test coverage only; production code is unchanged and no existing algorithm mismatch was found. Full Windows CI on pinned Rust 1.98.1 also passed: workspace Clippy, all-features Clippy, and workspace tests (run). Fixtures are generated in source, with no game files accessed or included and no new dependency.

Coordination claim. AI-assisted: OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5496223558 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2658). Originally posted by [XeNS1](https://github.com/XeNS1) on 2026-11-25T17:41:52Z. --- The current CityHash64 regression checks 13 arithmetic-pattern inputs. It misses several length dispatch boundaries and exact 64-byte loop boundaries, so off-by-one changes there can pass the existing test. These hashes identify the compact pipeline states. Add two tests with 42 independent reference cases: 36 generated inputs at short-input, 64-byte block and longer-loop boundaries, plus zero/0xff inputs at the compact 16/24/68-byte state sizes. Run each case at offsets 0 through 7 with unrelated bytes surrounding the slice (336 comparisons). All expected values come from Google's C++ CityHash64 at [`f5dc541`](https://github.com/google/cityhash/blob/f5dc54147fcce12cefd16548c8e760d68ac04226/src/city.cc), compiled locally with g++ -O2; that reference build also passes its upstream city-test.cc suite. Validation on Linux x86-64 / Rust 1.100.0: - `cargo test -p victory-game --locked --offline`: 17 tests pass. - `cargo clippy -p victory-game --all-targets --all-features --locked --offline -- -D warnings`: passes. - rustfmt on the changed file, asset policy (184 files), and `git diff --check`: pass. - Five temporary mutations outside the repository are all detected: 4/17/33-byte boundary mistakes, an extra loop iteration at exact 64-byte multiples, and treating NUL as end of input. The pre-existing reference test passes all five mutations. Test coverage only; production code is unchanged and no existing algorithm mismatch was found. Full Windows CI on pinned Rust 1.98.1 also passed: workspace Clippy, all-features Clippy, and workspace tests ([run](https://github.com/Marvisak/VIctory/actions/runs/45667482618)). Fixtures are generated in source, with no game files accessed or included and no new dependency. [Coordination claim](https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7169785069). AI-assisted: OpenAI Codex.
kotekompotek commented 2026-11-25 18:02:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T17:54:52Z.


Reviewed: expected values pinned to Google's city.cc at a named commit, covering every algorithm boundary (0–4, 5–8, 9–16, 17–32, 33–64, 65–96/128, block multiples, >4 KiB). Deterministic input generator, no game data. Test-only; CI green.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7170175415 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2658#issuecomment-7170175415). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T17:54:52Z. --- Reviewed: expected values pinned to Google's city.cc at a named commit, covering every algorithm boundary (0–4, 5–8, 9–16, 17–32, 33–64, 65–96/128, block multiples, >4 KiB). Deterministic input generator, no game data. Test-only; CI green.
Marvisak commented 2026-11-25 23:06:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:21:02Z.


Automated triage for the maintainers.

Merge candidate (test only). Adds two tests to crates/victory-game/src/cityhash.rs that check CityHash64 at every length-dispatch boundary (0-4, 8/9, 16/17, 32/33, 64/65), at exact 64-byte block multiples and longer inputs, and for all-zero/all-0xff inputs at the 16/24/68-byte state sizes. Each case also runs at offsets 0-7 inside unrelated bytes. Expected values come from Google's public city.cc at a pinned commit; the inputs are generated in the test, and the empty-input value matches CityHash's k2 constant, which I checked. Production code is unchanged. It merges cleanly; CI check: passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176251802 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2658#issuecomment-7176251802). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T22:21:02Z. --- <!-- victory-triage v1 head=119addfe9eaafc87142643090862e4a4e8b7726c verdict=merge-candidate at=2026-11-25T22:21:20Z --> Automated triage for the maintainers. **Merge candidate** (test only). Adds two tests to `crates/victory-game/src/cityhash.rs` that check CityHash64 at every length-dispatch boundary (0-4, 8/9, 16/17, 32/33, 64/65), at exact 64-byte block multiples and longer inputs, and for all-zero/all-0xff inputs at the 16/24/68-byte state sizes. Each case also runs at offsets 0-7 inside unrelated bytes. Expected values come from Google's public `city.cc` at a pinned commit; the inputs are generated in the test, and the empty-input value matches CityHash's `k2` constant, which I checked. Production code is unchanged. It merges cleanly; CI `check`: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-26 01:04:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:56:20Z.


Code review and Windows 11 verification at head 119addfe9eaa merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-game/src/cityhash.rs):
    • Inputs are generated deterministically from synthetic byte formulas and constant fills (no external data or game hashes) and match reference Google CityHash v1.1 values across every city64 dispatch threshold (0, 1..3, 4..7, 8..16, 17..32, 33..64, 65..68, and multi-64B block boundaries up to 4097), plus unaligned subslice offsets (0..8) with 0xa5/0x5a guard bytes.
  • Verified (Windows 11, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy --locked -p victory-game --tests -- -D warnings: 0 warnings
    • cargo test --locked -p victory-game: 17/17 passed.

LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179264618 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2658#issuecomment-7179264618). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T00:56:20Z. --- Code review and Windows 11 verification at head `119addfe9eaa` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-game/src/cityhash.rs`)**: - Inputs are generated deterministically from synthetic byte formulas and constant fills (no external data or game hashes) and match reference Google CityHash v1.1 values across every `city64` dispatch threshold (`0`, `1..3`, `4..7`, `8..16`, `17..32`, `33..64`, `65..68`, and multi-64B block boundaries up to `4097`), plus unaligned subslice offsets (`0..8`) with `0xa5`/`0x5a` guard bytes. - **Verified (Windows 11, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy --locked -p victory-game --tests -- -D warnings`: 0 warnings - `cargo test --locked -p victory-game`: **17/17 passed**. LGTM.
futurepro62 commented 2026-11-26 02:06:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T01:16:02Z.


NVIDIA full-suite run, to go with the reports above by fuzeofficlal, since none of them names a GPU run. Tested exact head 119addf (on its base 13f91ca).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 775 passed, 0 failed, 9 ignored.
  • The new tests ran and passed: matches_reference_at_length_and_block_boundaries, matches_reference_for_binary_state_sizes.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7179600926 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2658#issuecomment-7179600926). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-26T01:16:02Z. --- NVIDIA full-suite run, to go with the reports above by fuzeofficlal, since none of them names a GPU run. Tested exact head `119addf` (on its base `13f91ca`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **775 passed, 0 failed, 9 ignored**. - The new tests ran and passed: `matches_reference_at_length_and_block_boundaries`, `matches_reference_for_binary_state_sizes`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
cloph-dsp commented 2026-11-26 15:02:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-26T15:00:11Z.


Independent verification of head 119addf on Windows, Rust 1.100.0/MSVC:

  • cargo test --locked -p victory-game --lib -- cityhash::tests::matches_reference_at_length_and_block_boundaries --exact — 1 passed, 0 failed, 16 filtered.
  • git diff --check against merge base — clean.

CPU-only synthetic reference comparison; worktree-local CARGO_TARGET_DIR. AI-assisted (Hy4 flash). GPU/driver N/A. No game data used.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7195639843 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2658#issuecomment-7195639843). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-26T15:00:11Z. --- Independent verification of head `119addf` on Windows, Rust 1.100.0/MSVC: - `cargo test --locked -p victory-game --lib -- cityhash::tests::matches_reference_at_length_and_block_boundaries --exact` — 1 passed, 0 failed, 16 filtered. - `git diff --check` against merge base — clean. CPU-only synthetic reference comparison; worktree-local `CARGO_TARGET_DIR`. AI-assisted (Hy4 flash). GPU/driver N/A. No game data used.
Dukestar69 commented 2026-11-26 18:10:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T18:10:24Z.

Review: APPROVED


Reviewed and verified locally on Windows 11 x64:

  • cargo test -p victory-game -- --test-threads=1: 17 passed, 0 failed (including matches_reference_at_length_and_block_boundaries and matches_reference_for_binary_state_sizes).
  • cargo clippy -p victory-game --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6078808624 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2658#pullrequestreview-6078808624). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T18:10:24Z. **Review:** APPROVED --- Reviewed and verified locally on Windows 11 x64: - `cargo test -p victory-game -- --test-threads=1`: 17 passed, 0 failed (including `matches_reference_at_length_and_block_boundaries` and `matches_reference_for_binary_state_sizes`). - `cargo clippy -p victory-game --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal commented 2026-11-27 02:49:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T02:49:27Z.

Review: APPROVED


Reviewed at 119addfe9eaafc87142643090862e4a4e8b7726c — APPROVE.

Verification

  • rustfmt --edition 2024 --check, cargo xtask policy (191 files ok), and cargo clippy -p victory-game --all-targets --all-features -- -D warnings all passed cleanly.
  • Independently cross-checked all 42 added reference vectors (lengths 0..=4097 across every CityHash64 length/64-byte block boundary plus all-0x00 and all-0xFF 16/24/68-byte inputs) against the CityHash64 v1.1 reference algorithm with zero mismatches, and check_subslices covers unaligned byte offsets 0..8 with surrounding guard bytes.
  • Passed cargo test -p victory-game --locked cityhash (3/3).
<!-- greyfinch-sync:Marvisak/VIctory:review:6082835684 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2658#pullrequestreview-6082835684). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-27T02:49:27Z. **Review:** APPROVED --- Reviewed at `119addfe9eaafc87142643090862e4a4e8b7726c` — **APPROVE**. ### Verification - `rustfmt --edition 2024 --check`, `cargo xtask policy` (`191 files ok`), and `cargo clippy -p victory-game --all-targets --all-features -- -D warnings` all passed cleanly. - Independently cross-checked all 42 added reference vectors (lengths `0..=4097` across every CityHash64 length/64-byte block boundary plus all-`0x00` and all-`0xFF` `16`/`24`/`68`-byte inputs) against the CityHash64 v1.1 reference algorithm with zero mismatches, and `check_subslices` covers unaligned byte offsets `0..8` with surrounding guard bytes. - Passed `cargo test -p victory-game --locked cityhash` (3/3).
andrewpozdnakov7-jpg commented 2026-11-28 12:53:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T12:53:25Z.


I combined your exact 119addf with #3732 94b4e7d on current main in 4c66ada. Git merged the single file cleanly and kept both commits as direct parents.

All 336 of your reference comparisons passed with inlining, including the eight slice offsets and the 16-, 24-, and 68-byte descriptions used by pipeline prebuild. The whole victory-game suite passed all 17 tests in both debug and optimized Windows builds. Strict all-feature Clippy, formatting, and the asset policy passed.

This provides an integration tree if both PRs are picked. Next step is maintainer review. Please retain Git authorship on cherry-pick or rebase. If folding #3732 into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7239538514 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2658#issuecomment-7239538514). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T12:53:25Z. --- I combined your exact `119addf` with #3732 `94b4e7d` on current `main` in [`4c66ada`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/4c66adaa12490ac112081b6080deff8ff933df6f). Git merged the single file cleanly and kept both commits as direct parents. All 336 of your reference comparisons passed with inlining, including the eight slice offsets and the 16-, 24-, and 68-byte descriptions used by pipeline prebuild. The whole `victory-game` suite passed all 17 tests in both debug and optimized Windows builds. Strict all-feature Clippy, formatting, and the asset policy passed. This provides an integration tree if both PRs are picked. Next step is maintainer review. Please retain Git authorship on cherry-pick or rebase. If folding #3732 into another commit, please add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. AI-assisted with OpenAI Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2658:upstream-pr/2658'
git switch 'upstream-pr/2658'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2658'
git switch 'upstream-pr/2658'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2658'
git switch 'upstream-pr/2658'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2658'
git switch 'main'
git merge --squash 'upstream-pr/2658'
git switch 'main'
git merge --ff-only 'upstream-pr/2658'
git switch 'main'
git merge 'upstream-pr/2658'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2656
No description provided.