[PR #2254] scripts/check_compute_journal_overlay: validate journal dirs/exe, enforce UTF-8, extract main, add tests #2256

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

📋 Pull Request Information

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

Base: main ← Head: fix/check-compute-journal-overlay-safety


📝 Commits (1)

  • aa95d15 Harden check_compute_journal_overlay checks, encoding, main entry, and tests

📊 Changes

2 files changed (+180 additions, -12 deletions)

View changed files

📝 scripts/check_compute_journal_overlay.py (+35 -12)
➕ tests/test_check_compute_journal_overlay.py (+145 -0)

📄 Description

Claimed in the coordination issue as: CHECK-COMPUTE-JOURNAL-OVERLAY-SAFETY-AND-TESTS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7189582869)

What and why

  • Check d.is_dir() in entries() (scripts/check_compute_journal_overlay.py) before iterating pipeline_cache.d.
  • Replace bare tuple-unpacking on new-B/pipeline_cache.d and cold/pipeline_cache.d with explicit directory, single-entry, and .is_file() checks giving clear RuntimeError messages.
  • Pass encoding="utf-8" alongside errors="replace" in subprocess.run(...) so redirected stdout/stderr does not depend on the host ANSI code page.
  • Extract a testable main(argv=None) -> int validating executable existence/regular-file status and allowing both d3d12_compute_journal_test.exe and POSIX d3d12_compute_journal_test, catching runtime errors cleanly on stderr with exit status 1/2.
  • Add mocked unit coverage in tests/test_check_compute_journal_overlay.py.

Tested

  • Patched: python -I tests/test_check_compute_journal_overlay.py -v -> Ran 3 tests in 0.755s (OK).
  • Baseline check (upstream/main a73a57e1 with tests/test_check_compute_journal_overlay.py copied into detached worktree): Ran 3 tests in 0.027s (FAILED (errors=3)).
  • Repo gates: python -I tests/test_ci_registration.py (Ran 16 tests in 13.847s, OK), python -I tests/test_text_write_line_endings.py (Ran 3 tests in 17.336s, OK), python -I scripts/check_no_game_data.py (exit 0), python -I -m compileall -q (exit 0), git diff --check (exit 0).

GPUs tested: n/a (mocked subprocess harness and CLI validation tests)

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.

🔄 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/2254 **Author:** [@kirigayakazima](https://github.com/kirigayakazima) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/check-compute-journal-overlay-safety` --- ### 📝 Commits (1) - [`aa95d15`](https://github.com/ubiquitarianism/leonida/commit/aa95d15fd7ee2bdfc0c2021c77e21d37226ad476) Harden check_compute_journal_overlay checks, encoding, main entry, and tests ### 📊 Changes **2 files changed** (+180 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `scripts/check_compute_journal_overlay.py` (+35 -12) ➕ `tests/test_check_compute_journal_overlay.py` (+145 -0) </details> ### 📄 Description Claimed in the coordination issue as: CHECK-COMPUTE-JOURNAL-OVERLAY-SAFETY-AND-TESTS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7189582869) ### What and why - Check `d.is_dir()` in `entries()` (`scripts/check_compute_journal_overlay.py`) before iterating `pipeline_cache.d`. - Replace bare tuple-unpacking on `new-B/pipeline_cache.d` and `cold/pipeline_cache.d` with explicit directory, single-entry, and `.is_file()` checks giving clear `RuntimeError` messages. - Pass `encoding="utf-8"` alongside `errors="replace"` in `subprocess.run(...)` so redirected stdout/stderr does not depend on the host ANSI code page. - Extract a testable `main(argv=None) -> int` validating executable existence/regular-file status and allowing both `d3d12_compute_journal_test.exe` and POSIX `d3d12_compute_journal_test`, catching runtime errors cleanly on `stderr` with exit status `1`/`2`. - Add mocked unit coverage in `tests/test_check_compute_journal_overlay.py`. ### Tested - Patched: `python -I tests/test_check_compute_journal_overlay.py -v` -> `Ran 3 tests in 0.755s` (`OK`). - Baseline check (`upstream/main` `a73a57e1` with `tests/test_check_compute_journal_overlay.py` copied into detached worktree): `Ran 3 tests in 0.027s` (`FAILED (errors=3)`). - Repo gates: `python -I tests/test_ci_registration.py` (`Ran 16 tests in 13.847s`, `OK`), `python -I tests/test_text_write_line_endings.py` (`Ran 3 tests in 17.336s`, `OK`), `python -I scripts/check_no_game_data.py` (exit 0), `python -I -m compileall -q` (exit 0), `git diff --check` (exit 0). GPUs tested: n/a (mocked subprocess harness and CLI validation tests) 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. --- <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#2256
No description provided.