conformance: harden verify.ps1 and failure-log.cmd path safety #2340

Merged
kirigayakazima merged 1 commit from upstream-pr/2340 into main 2026-11-28 15:11:42 +00:00
kirigayakazima commented 2026-11-26 14:08:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-26T14:08:11Z.


Claimed in the coordination issue as: CONFORMANCE-VERIFY-AND-FAILURE-LOG-SAFETY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7194263351)

What and why

  • Harden tools/conformance/native/scripts/verify.ps1:
    • Switch Test-Path, Remove-Item, Get-ChildItem, Get-FileHash, Set-Content, and Get-Content to -LiteralPath (and use [IO.Directory]::CreateDirectory) so checkouts containing PowerShell wildcard characters such as [1] work reliably.
    • Compare both run A and run B filename lists symmetrically in determinism checks and guard missing run A/B files before Get-FileHash.
    • Guard $root\a\manifest.json existence before reading and expose optional param($ExpectedAdapter, $SecondAdapterPattern, $SecondAdapterIndex) with the existing defaults preserved.
  • Harden tools/conformance/native/scripts/failure-log.cmd:
    • Quote set "EXE=...", set "ROOT=...", and set "LOG=..." assignments (and echo "%EXE%") so paths containing & do not fail or split, and verify %EXE% exists before deleting %ROOT% or writing %LOG%.
  • Add regression tests in tests/test_conformance_verify_scripts.py.

Tested

  • python -I tests/test_conformance_verify_scripts.py -v: 2 passed, 0 failed (detached upstream/main baseline with only the new test file fails with 2 failures).
  • python -I tests/test_ci_registration.py: 16 passed.
  • python -I tests/test_text_write_line_endings.py: 3 passed.
  • python -I scripts/check_no_game_data.py, python -I -m compileall -q tests/test_conformance_verify_scripts.py, and git diff --cached --check: passed.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5511515918 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2340). Originally posted by [kirigayakazima](https://github.com/kirigayakazima) on 2026-11-26T14:08:11Z. --- Claimed in the coordination issue as: CONFORMANCE-VERIFY-AND-FAILURE-LOG-SAFETY (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7194263351) ### What and why - Harden `tools/conformance/native/scripts/verify.ps1`: - Switch `Test-Path`, `Remove-Item`, `Get-ChildItem`, `Get-FileHash`, `Set-Content`, and `Get-Content` to `-LiteralPath` (and use `[IO.Directory]::CreateDirectory`) so checkouts containing PowerShell wildcard characters such as `[1]` work reliably. - Compare both run A and run B filename lists symmetrically in determinism checks and guard missing run A/B files before `Get-FileHash`. - Guard `$root\a\manifest.json` existence before reading and expose optional `param($ExpectedAdapter, $SecondAdapterPattern, $SecondAdapterIndex)` with the existing defaults preserved. - Harden `tools/conformance/native/scripts/failure-log.cmd`: - Quote `set "EXE=..."`, `set "ROOT=..."`, and `set "LOG=..."` assignments (and echo `"%EXE%"`) so paths containing `&` do not fail or split, and verify `%EXE%` exists before deleting `%ROOT%` or writing `%LOG%`. - Add regression tests in `tests/test_conformance_verify_scripts.py`. ### Tested - `python -I tests/test_conformance_verify_scripts.py -v`: 2 passed, 0 failed (detached `upstream/main` baseline with only the new test file fails with 2 failures). - `python -I tests/test_ci_registration.py`: 16 passed. - `python -I tests/test_text_write_line_endings.py`: 3 passed. - `python -I scripts/check_no_game_data.py`, `python -I -m compileall -q tests/test_conformance_verify_scripts.py`, and `git diff --cached --check`: passed. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
zmasi commented 2026-11-28 07:35:44 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T07:35:44Z.


#2340 | head 240186034b (merged cleanly with main 09c153948) | python -I tests/test_conformance_verify_scripts.py | red on main: FAILED (failures=2) ('-LiteralPath' missing in verify.ps1, and bracket/ampersand path fails wildcard Test-Path with 1 != 0) | green on PR+main: 2 tests OK (-k test_verify_and_failure_log_with_brackets_and_ampersand_paths: 1 test OK) | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited tools/conformance/native/scripts/verify.ps1 and failure-log.cmd (-LiteralPath handling, run A vs run B filename-set equality check, quoted set "VAR=...", and pre-wipe executable check before rmdir /s /q "%ROOT%"), and verified both PR + main (09c153948) and a combined main + #2340 + #2337 merge (0 conflicts; 2 OK + 2 OK + 7 OK under Windows PowerShell and cmd.exe). Also passed tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), tests/test_runner_calls_all_tests.py (3 OK), and scripts/check_no_game_data.py.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7236040532 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2340#issuecomment-7236040532). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T07:35:44Z. --- #2340 | head 240186034ba23de8105c5fe87c9f33929a9c1531 (merged cleanly with main 09c153948) | `python -I tests/test_conformance_verify_scripts.py` | red on main: `FAILED (failures=2)` (`'-LiteralPath'` missing in `verify.ps1`, and bracket/ampersand path fails wildcard `Test-Path` with `1 != 0`) | green on PR+main: `2 tests OK` (`-k test_verify_and_failure_log_with_brackets_and_ampersand_paths`: `1 test OK`) | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `tools/conformance/native/scripts/verify.ps1` and `failure-log.cmd` (`-LiteralPath` handling, run A vs run B filename-set equality check, quoted `set "VAR=..."`, and pre-wipe executable check before `rmdir /s /q "%ROOT%"`), and verified both `PR + main` (`09c153948`) and a combined `main + #2340 + #2337` merge (`0` conflicts; `2 OK` + `2 OK` + `7 OK` under Windows PowerShell and `cmd.exe`). Also passed `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), `tests/test_runner_calls_all_tests.py` (`3 OK`), and `scripts/check_no_game_data.py`.
MoonEyes commented 2026-11-28 15:11:39 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T15:11:39Z.


Red/green: classified READY by cloud-6 (red on main 09c153948, green on head merged with main); head 240186034b unchanged since 2026-11-26, before that run.
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7241276043 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2340#issuecomment-7241276043). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T15:11:39Z. --- Red/green: classified READY by cloud-6 (red on main 09c153948, green on head merged with main); head 240186034ba2 unchanged since 2026-11-26, before that run. Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure. AI-assisted (Claude Code, Claude Opus 5.5)
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
ProjectLeonida/mandy!2340
No description provided.