Repository navigation
fix(formats,core): harden Layout::copy_table and ignore empty env vars in default_dir (#320) - #334
Merged
Androtim merged 1 commit intoDec 2, 2026
Conversation
Owner
|
Autonomous architectural audit PASSED on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all three platform-independent bugs tracked in #320 across
crates/victory-formats/src/texture.rsandcrates/victory-core/src/config.rs.Fixes #320
AI-Ready Context & Change Map
For downstream coding/review agents, here is the exact scope, behavioral invariants, and test coverage of this PR:
crates/victory-formats/src/texture.rs—Layout::copy_table(texture.rs:958-976)render_xorlayouts (texture.rs:958-960):configure_render_xormakesLayout::addressable()returntrueforSW_64KB_R_Xwhileself.patternremains&EMPTY_PATTERN([Vec::new(); 3]).|| self.render_xor.is_some()to the initial guard socopy_tablereturnsErr(Error::Unsupported)instead of panicking with out-of-bounds index0insideLayout::column(m, 0)(texture.rs:657). This restores clean fallback toWhy::NoTable/ CPU detiling incrates/victory-gpu/src/detile.rs:758.texture.rs:961-976):slice_bytes = (m.height - 1) * row_pitch + bytes(checked), rejectsrow_pitch < byteswithErr(Error::TooSmall), and rejectsdepth > 1 && depth_pitch < slice_byteswithErr(Error::TooSmall)before computingneed, matchingLayout::walk(texture.rs:751-764).texture.rs:2231-2274):copy_table_rejects_render_xor_layout: verifiesSW_64KB_R_X+configure_render_xorreportsaddressable() == trueand returnsErr(Error::Unsupported)fromcopy_table.copy_table_rejects_overlapping_depth_slices: verifiesTex3d(depth = 4) returnsErr(Error::TooSmall)fordepth_pitch = 0andslice_bytes - 1, andOk(_)fordepth_pitch = slice_bytes.crates/victory-core/src/config.rs—default_dir/default_dir_from(config.rs:146-163)default_dir_from(name, env)called bydefault_dir(name)so directory resolution can be unit-tested deterministically without mutating process environment variables.filter(|v| !v.is_empty())) acrossVICTORY_HOME,LOCALAPPDATA,XDG_CACHE_HOME, andHOME, matchingenv_path,explicit_config_path, andhome_override. Prevents empty env vars (e.g.XDG_CACHE_HOME="") from producing relative paths (victory/<name>/.cache/victory/<name>) in CWD.config.rs:249-280):default_dir_ignores_empty_env_varscovers emptyVICTORY_HOME/LOCALAPPDATA/XDG_CACHE_HOMEfalling back toHOME/.cache, fallback toXDG_CACHE_HOME, and error when all four are empty.Rig Specs Tested On
x86_64)victory-formatsandvictory-corefixes)x86_64) — Windowsx86_64-pc-windows-msvcfull workspace clippy and tests verified by GitHub Actions (windows-latest)Run Settings & Profile
origin/main(3230974)VICTORY_*Overrides: N/AMeasurements & Verification
cargo clippy --workspace --all-targets --locked -- -D warnings(requiresx86_64-pc-windows-msvc; verified on GitHub Actionswindows-latestCI)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings(requiresx86_64-pc-windows-msvc; verified on GitHub Actionswindows-latestCI)cargo test --locked -p victory-core-> 15 passed, 0 failedcargo test --locked -p victory-formats-> 69 passed, 0 failed, 7 ignoredcargo clippy --locked -p victory-formats -p victory-core --all-targets -- -D warnings-> 0 warnings, exit 0cargo test --locked -p xtask-> 8 passed, 0 failedcargo xtask policy->asset policy: 324 files ok