[PR #1847] scripts/carve_all.ps1: validate dirs, filter -File and publish coverage.json atomically #1860

Open
opened 2026-11-26 21:19:12 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1847
Author: @kirigayakazima
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/carve-all-safety


📝 Commits (1)

  • 3520583 scripts/carve_all.ps1: validate dirs, filter -File and publish coverage.json atomically

📊 Changes

2 files changed (+72 additions, -4 deletions)

View changed files

📝 scripts/carve_all.ps1 (+22 -4)
📝 tests/test_carve_all_paths.py (+50 -0)

📄 Description

Claimed in the coordination issue as: CARVE-ALL-FILE-FILTER-EMPTY-AND-ATOMIC-COVERAGE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163140447)

What and why

  • Validate -Game as a directory (Test-Path -LiteralPath $Game -PathType Container) and ensure -Out is not an existing file before creating $outFull via [System.IO.Directory]::CreateDirectory(...) (literal path safe with [ ] characters).
  • Add -File to Get-ChildItem -LiteralPath $Game -Recurse -File -Filter *.rpf so directories named *.rpf are skipped rather than passed to tools/rpf9_carve.py.
  • Emit valid "[]" JSON when no .rpf archives are found, write coverage.json atomically via .coverage.<pid>.<guid>.tmp UTF-8 no-BOM staging + Move-Item -LiteralPath ... -Force + finally cleanup, and skip Format-Table when $rows.Count -eq 0.
  • Preserve CRLF line endings on scripts/carve_all.ps1 and add PowerShell 5.1 regression tests in tests/test_carve_all_paths.py.

Tested

  • python -I tests/test_carve_all_paths.py -v (live Windows PowerShell 5.1) -> Ran 11 tests in 11.463s, OK.
  • python -I tests/test_carve_all_brackets.py -v -> Ran 1 test in 0.461s, OK.
  • Detached upstream/main (98c2f777) baseline worktree with updated tests/test_carve_all_paths.py -> Ran 11 tests in 11.603s, FAILED (failures=2, errors=1).
  • CRLF verification on scripts/carve_all.ps1 -> PS1_CRLF=81 PS1_LF_ONLY=0.
  • python -I tests/test_ci_registration.py -> Ran 16 tests in 5.282s, OK.
  • python -I tests/test_text_write_line_endings.py -> Ran 3 tests in 12.773s, OK.
  • python -I scripts/check_no_game_data.py scripts/carve_all.ps1 tests/test_carve_all_paths.py, python -I -m compileall -q tests/test_carve_all_paths.py, and git diff --check -> exit 0.

GPUs tested: n/a (Windows PowerShell 5.1 + stdlib Python tests on Windows 11 x64)

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. (n/a)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1847 **Author:** [@kirigayakazima](https://github.com/kirigayakazima) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/carve-all-safety` --- ### 📝 Commits (1) - [`3520583`](https://github.com/ubiquitarianism/leonida/commit/35205833160450ad0eaab80b18a1c712f22040c3) scripts/carve_all.ps1: validate dirs, filter -File and publish coverage.json atomically ### 📊 Changes **2 files changed** (+72 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `scripts/carve_all.ps1` (+22 -4) 📝 `tests/test_carve_all_paths.py` (+50 -0) </details> ### 📄 Description Claimed in the coordination issue as: CARVE-ALL-FILE-FILTER-EMPTY-AND-ATOMIC-COVERAGE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163140447) ### What and why - Validate `-Game` as a directory (`Test-Path -LiteralPath $Game -PathType Container`) and ensure `-Out` is not an existing file before creating `$outFull` via `[System.IO.Directory]::CreateDirectory(...)` (literal path safe with `[ ]` characters). - Add `-File` to `Get-ChildItem -LiteralPath $Game -Recurse -File -Filter *.rpf` so directories named `*.rpf` are skipped rather than passed to `tools/rpf9_carve.py`. - Emit valid `"[]"` JSON when no `.rpf` archives are found, write `coverage.json` atomically via `.coverage.<pid>.<guid>.tmp` UTF-8 no-BOM staging + `Move-Item -LiteralPath ... -Force` + `finally` cleanup, and skip `Format-Table` when `$rows.Count -eq 0`. - Preserve CRLF line endings on `scripts/carve_all.ps1` and add PowerShell 5.1 regression tests in `tests/test_carve_all_paths.py`. ### Tested - `python -I tests/test_carve_all_paths.py -v` (live Windows PowerShell 5.1) -> `Ran 11 tests in 11.463s`, `OK`. - `python -I tests/test_carve_all_brackets.py -v` -> `Ran 1 test in 0.461s`, `OK`. - Detached `upstream/main` (`98c2f777`) baseline worktree with updated `tests/test_carve_all_paths.py` -> `Ran 11 tests in 11.603s`, `FAILED (failures=2, errors=1)`. - CRLF verification on `scripts/carve_all.ps1` -> `PS1_CRLF=81 PS1_LF_ONLY=0`. - `python -I tests/test_ci_registration.py` -> `Ran 16 tests in 5.282s`, `OK`. - `python -I tests/test_text_write_line_endings.py` -> `Ran 3 tests in 12.773s`, `OK`. - `python -I scripts/check_no_game_data.py scripts/carve_all.ps1 tests/test_carve_all_paths.py`, `python -I -m compileall -q tests/test_carve_all_paths.py`, and `git diff --check` -> exit `0`. GPUs tested: n/a (Windows PowerShell 5.1 + stdlib Python tests on Windows 11 x64) 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. (n/a) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1860
No description provided.