Pipeline: delimit converter id in cache keys #922
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!922
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/922/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@enzoduarte1 on GitHub · 2026-11-24 14:12 UTC · original
enzoduarte1:pipeline/cache-key-delimiter→main· +31 −2 · 1 files · 1 commits · closed without mergingWhat
CacheKey::newfed the converter id, a single0x00separator, the 4-byte version and the input straight into BLAKE3. A&'static strmay contain NUL, so the separator was ambiguous:id = "a\0", version = 1andid = "a", version = 256produced the same byte stream and therefore the same cache key. With two converters sharing a cache, whichever ran first could serve its output to the other.The id is now length-prefixed with a
u64, which makes every field boundary unambiguous while keeping the key stable for existing valid ids. A regression test asserts that the colliding pair and a differing-input pair produce distinct keys.Tested
x86_64-pc-windows-gnu(no MSVC linker on this machine).cargo test -p victory-pipeline --lib: 4 passed.git diff --checkandrustfmt --checkon the changed file: clean.cargo xtask policy: 151 files ok. No game files or data taken from them were added.cargo test -p victory-loader --test load_probe; its fixture uses MSVC/DELAYLOAD, which MinGW rejects here (same failure on unmodifiedmain).Checklist
cargo fmt --all --checkandcargo test --workspacepass — this workspace has pre-existing formatting diffs and the loader fixture limitation described above; the changed crate is clean.cargo xtask policypasses. The change adds no game files or data taken from them (docs/asset-policy.md).@shortselow-byte on GitHub · 2026-11-24 14:21 UTC · original
Tested at head
f7bce85(baseffe310e) on Windows 11, Rust 1.98.1,x86_64-pc-windows-msvc:cargo test --locked -p victory-pipeline: 5 passed.cargo clippy --workspace --all-targets --locked -- -D warnings, and with--all-features: clean.rustfmt --checkoncache.rs: clean.The fix itself looks right, but the regression test does not catch the bug. With
main's key code (id,0x00, version) put back,id_and_version_are_delimitedstill passes:"a\0"/1 and"a"/256 with the same empty input hash 7 bytes vs 6, so they never collided. The colliding pair needs the input to absorb the shifted byte:With the old key code this assertion fails (both keys
8502be22…ed13); with this PR it passes. Suggest using this pair in the test.One nit on the description: the length prefix changes the hashed bytes for every id, so every existing cache key changes (existing caches miss once and rebuild). Probably fine, but "keeping the key stable for existing valid ids" isn't accurate.
@MichaelSmithAI on GitHub · 2026-11-24 14:31 UTC · original
I checked the on-disk behavior behind the earlier review’s compatibility note. A Linux fixture prepopulated the old path for the ordinary converter ID
test.upper, version 1, inputabc, with outputABC. Onf7bce85the first lookup ran the converter and publishedABCat a different path. The second lookup hit that new entry. The original file still containedABC, and the converter ran exactly once across the two lookups. This measures a cold lookup for an existing input and no change in its converted bytes.@Zipettte on GitHub · 2026-11-24 15:41 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
f7bce85:cargo test -p victory-pipelinepasses, 5 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@Marvisak on GitHub · 2026-11-25 00:28 UTC · original
Automated triage for the maintainers. Closing because it does not change behaviour the project needs (formatting, guards for cases that cannot occur, or notes and translations that cannot be kept current).
Length-prefixes the converter id in CacheKey against a collision that needs a NUL inside an id; ids are string literals in our code (only "shader.dxil" exists). Contrary to the body, the new byte stream changes every key, so the whole translated-shader cache misses once and the old entries stay orphaned in the same translator folder: a cost without a benefit.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed