boot_trace: handle read errors during iteration (BOOT-TRACE-READ-ERROR) #1124

Open
github-bot wants to merge 1 commit from github-bot/gh-1124 into main AGit
Owner

@⁠Taffyyy-ops on GitHub · 2026-11-24 18:53 UTC · original
Taffyyy-ops:fix/boot-trace-read-error → main · +55 −1 · 2 files · 1 commits · open

Item ID: BOOT-TRACE-READ-ERROR

Converts tools/boot_trace.py:_open_text() into a @contextmanager so mid-stream OSError failures during log iteration are caught and reported cleanly as TraceError.

Changes

  • tools/boot_trace.py (_open_text): Uses @contextlib.contextmanager and a with open(...) block inside try ... except OSError, guaranteeing file handle closure and wrapping iteration-time I/O errors into TraceError.
  • tests/test_boot_trace_read_error.py: Adds synthetic tests simulating mid-stream read OSError on both startup and D3D12 traces, verifying TraceError handling while preserving the healthy trace's summary.

Verification

  • AI-assisted; synthetic tests only, no game data (python -I scripts/check_no_game_data.py).
**@⁠Taffyyy-ops** on GitHub · 2026-11-24 18:53 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1124) `Taffyyy-ops:fix/boot-trace-read-error` → `main` · +55 −1 · 2 files · 1 commits · open Item ID: `BOOT-TRACE-READ-ERROR` Converts `tools/boot_trace.py:_open_text()` into a `@contextmanager` so mid-stream `OSError` failures during log iteration are caught and reported cleanly as `TraceError`. ### Changes - **`tools/boot_trace.py` (`_open_text`):** Uses `@contextlib.contextmanager` and a `with open(...)` block inside `try ... except OSError`, guaranteeing file handle closure and wrapping iteration-time I/O errors into `TraceError`. - **`tests/test_boot_trace_read_error.py`:** Adds synthetic tests simulating mid-stream read `OSError` on both startup and D3D12 traces, verifying `TraceError` handling while preserving the healthy trace's summary. ### Verification - AI-assisted; synthetic tests only, no game data (`python -I scripts/check_no_game_data.py`).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:39:22 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 18:55 UTC · original · approved these changes

Reviewed and verified. Turning _open_text into a context manager ensures mid-stream OSError exceptions during log iteration are cleanly caught and wrapped into TraceError rather than leaking unhandled I/O failures. Verified with synthetic unit test tests/test_boot_trace_read_error.py. 100% clean-room compliant.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 18:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1124#pullrequestreview-6045424339) · **approved these changes** Reviewed and verified. Turning `_open_text` into a context manager ensures mid-stream `OSError` exceptions during log iteration are cleanly caught and wrapped into `TraceError` rather than leaking unhandled I/O failures. Verified with synthetic unit test `tests/test_boot_trace_read_error.py`. 100% clean-room compliant.
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:15 UTC · original

Recommendation: [MERGE]

Reasoning: boot_trace._open_text becomes a context manager so read errors during iteration are raised as TraceError and the file is always closed. Small tool fix with a synthetic test. Edits the same file as #1115 (different hunk); minimal PR description. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 2/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:15 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1124#issuecomment-7143263106) **Recommendation:** [MERGE] **Reasoning:** `boot_trace._open_text` becomes a context manager so read errors during iteration are raised as `TraceError` and the file is always closed. Small tool fix with a synthetic test. Edits the same file as #1115 (different hunk); minimal PR description. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 2/10
Author
Owner

@⁠Taffyyy-ops on GitHub · 2026-11-25 10:45 UTC · original

@⁠abnalstlll-byte @⁠Deedlyy Thanks for the review and [MERGE] recommendation! Updated the PR description with a full summary of the _open_text context-manager fix in tools/boot_trace.py and tests/test_boot_trace_read_error.py.

**@⁠Taffyyy-ops** on GitHub · 2026-11-25 10:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1124#issuecomment-7160121477) @⁠abnalstlll-byte @⁠Deedlyy Thanks for the review and `[MERGE]` recommendation! Updated the PR description with a full summary of the `_open_text` context-manager fix in `tools/boot_trace.py` and `tests/test_boot_trace_read_error.py`.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1124/head:github-bot/gh-1124'
git switch 'github-bot/gh-1124'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1124'
git switch 'github-bot/gh-1124'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1124'
git switch 'github-bot/gh-1124'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1124'
git switch 'main'
git merge --squash 'github-bot/gh-1124'
git switch 'main'
git merge --ff-only 'github-bot/gh-1124'
git switch 'main'
git merge 'github-bot/gh-1124'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.