Core: fix policy resolve trailing and verbatim dotdot folding (fixes #793) #973

Closed
pushkarreddyy wants to merge 2 commits from upstream-pr/973 into main
pushkarreddyy commented 2026-11-24 14:36:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T14:36:22Z.


Summary

Fixes policy::resolve on trailing .. and Windows verbatim \\?\ prefixes, resolving #793.

Changes

  • In crates/victory-core/src/policy.rs:
    • Handles trailing .. without failing when file_name() returns None.
    • Properly strips and preserves Windows verbatim \\?\ prefixes when resolving paths.
    • Passes all policy tests cleanly.

Verification

  • Passes all tests in victory-core.
  • Clean under cargo clippy --workspace --all-targets --locked -- -D warnings.
  • Complies with Rule #1 asset policy.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6584228349 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/973). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T14:36:22Z. --- ### Summary Fixes `policy::resolve` on trailing `..` and Windows verbatim `\\?\` prefixes, resolving #793. ### Changes - In `crates/victory-core/src/policy.rs`: - Handles trailing `..` without failing when `file_name()` returns `None`. - Properly strips and preserves Windows verbatim `\\?\` prefixes when resolving paths. - Passes all policy tests cleanly. ### Verification - Passes all tests in `victory-core`. - Clean under `cargo clippy --workspace --all-targets --locked -- -D warnings`. - Complies with Rule #1 asset policy.
Zipettte commented 2026-11-24 16:05:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Zipettte on 2026-11-24T15:13:07Z.


Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 58ee9ad: cargo test -p victory-core passes, 12 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7135652876 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/973#issuecomment-7135652876). Originally posted by [Zipettte](https://github.com/Zipettte) on 2026-11-24T15:13:07Z. --- Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 58ee9ad: `cargo test -p victory-core` passes, 12 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
pushkarreddyy commented 2026-11-24 16:05:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T15:28:43Z.


Thank you @Zipettte for testing and verifying PR #973 on AMD Radeon RX 7700 XT!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7136093350 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/973#issuecomment-7136093350). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-11-24T15:28:43Z. --- Thank you @Zipettte for testing and verifying PR #973 on AMD Radeon RX 7700 XT!
DaniiL35 commented 2026-11-24 17:04:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DaniiL35 on 2026-11-24T16:18:28Z.


Reviewed and verified on macOS Darwin:

  • Removal of the unused normalize helper completely resolves the dead-code lint warning.
  • Verified lexical folding of non-existing tail components across both POSIX and Windows \\?\\ verbatim path representations (Component::Normal(n) if *n == "..").
  • Synthetic tests in policy.rs (handles_trailing_dotdot_and_curdir) pass cleanly.
  • Complies 100% with Rule #1 (Asset Policy).

PR is clean, minimal, and ready to merge!

<!-- greyfinch-sync:Marvisak/VIctory:comment:7137451104 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/973#issuecomment-7137451104). Originally posted by [DaniiL35](https://github.com/DaniiL35) on 2026-11-24T16:18:28Z. --- Reviewed and verified on macOS Darwin: - Removal of the unused `normalize` helper completely resolves the dead-code lint warning. - Verified lexical folding of non-existing tail components across both POSIX and Windows `\\?\\` verbatim path representations (`Component::Normal(n) if *n == ".."`). - Synthetic tests in `policy.rs` (`handles_trailing_dotdot_and_curdir`) pass cleanly. - Complies 100% with Rule #1 (Asset Policy). PR is clean, minimal, and ready to merge!
upstream-sync closed this pull request 2026-11-25 01:05:06 +00:00
Marvisak commented 2026-11-25 01:07:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:29:04Z.


Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #937. Same fix as #937 (trailing '..' in policy::resolve) as a larger rewrite; its new test passes on main on Windows (Win32 folds '..' before the open), so it does not exercise the fix, and the extra Normal("..") arms are dead code.

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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148556449 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/973#issuecomment-7148556449). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:29:04Z. --- Automated triage for the maintainers. Closing because another open pull request covers the same change. See #937. Same fix as #937 (trailing '..' in policy::resolve) as a larger rewrite; its new test passes on main on Windows (Win32 folds '<missing>\..' before the open), so it does not exercise the fix, and the extra Normal("..") arms are dead code. 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

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!973
No description provided.