boot_trace: handle read errors during iteration (BOOT-TRACE-READ-ERROR) #1124
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1124"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by Taffyyy-ops on 2026-11-24T18:53:45Z.
Item ID:
BOOT-TRACE-READ-ERRORConverts
tools/boot_trace.py:_open_text()into a@contextmanagerso mid-streamOSErrorfailures during log iteration are caught and reported cleanly asTraceError.Changes
tools/boot_trace.py(_open_text): Uses@contextlib.contextmanagerand awith open(...)block insidetry ... except OSError, guaranteeing file handle closure and wrapping iteration-time I/O errors intoTraceError.tests/test_boot_trace_read_error.py: Adds synthetic tests simulating mid-stream readOSErroron both startup and D3D12 traces, verifyingTraceErrorhandling while preserving the healthy trace's summary.Verification
python -I scripts/check_no_game_data.py).Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T18:55:56Z.
Review: APPROVED
Reviewed and verified. Turning
_open_textinto a context manager ensures mid-streamOSErrorexceptions during log iteration are cleanly caught and wrapped intoTraceErrorrather than leaking unhandled I/O failures. Verified with synthetic unit testtests/test_boot_trace_read_error.py. 100% clean-room compliant.Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:15:32Z.
Recommendation: [MERGE]
Reasoning:
boot_trace._open_textbecomes a context manager so read errors during iteration are raised asTraceErrorand 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 withmain. Merge once the queued checks are green.Impact level: 2/10
Imported from ubiquitarianism/leonida. Originally posted by Taffyyy-ops on 2026-11-25T10:45:02Z.
@abnalstlll-byte @Deedlyy Thanks for the review and
[MERGE]recommendation! Updated the PR description with a full summary of the_open_textcontext-manager fix intools/boot_trace.pyandtests/test_boot_trace_read_error.py.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:35:25Z.
#1124 | head
75fc53309e(merged cleanly with mainadfb3821a2) |python -I tests/test_boot_trace_read_error.py -v+python -I tests/test_boot_trace.py -v+ live Windows NTFSmsvcrt.lockingmid-stream lock probe | red on main:FAILED (errors=3)(_open_textreturned a raw file object outside itstry ... except OSErrorblock, so both synthetic mid-streamOSErrorand a live NTFS byte-range lock at offset12288crashed with an unhandledOSError/PermissionErrortraceback and discarded the healthy--d3d12summary) | green on PR+main:2 ran, OK(test_boot_trace_read_error.py),39 ran, OK(test_boot_trace.py),5 ran, OK(test_dev_boot_trace.py), and live NTFS mid-stream lock exited2cleanly withstartup: nullandd3d12.calls: 1preserved | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yesAudited
75fc53309e(tools/boot_trace.pyandtests/test_boot_trace_read_error.py) on Windows 11 — first execution of this PR — confirming both_open_textcallers (parse_startupandparse_d3d12) enter viawith _open_text(path) as fh:so converting_open_textto@contextmanagercleanly wraps mid-iterationOSErrorintoTraceErrorwhile closing the stream. Also verifiedtests/test_ci_registration.py,tests/test_text_write_line_endings.py, andscripts/check_no_game_data.py.Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:43:57Z.
RUN of #1124 (red/green,
python -I, no build, no game, no GPU)Heads tested: PR head
75fc53309e78, current main829530dbd019; merged = main + PR head,git merge --no-ff, local only (merged cleanly).Commands, one process each, from the worktree root:
python -I tests/test_boot_trace_read_error.pyRelated:
tests/test_boot_trace.py,test_dev_boot_trace.py,test_dev_discovery.py,test_docs_cli_flags.py,test_linux_boot.py,test_boot_matrix.py,test_game_run_summary.py,test_ci_registration.py,test_text_write_line_endings.py(the ones that exist on the tested tree).tools/boot_trace.pywith the PR's new test file):FAILED (errors=3). The synthetic mid-streamOSErrorescapes from thefor ... in fhloop inparse_startupas a rawOSErrorinstead of aTraceError. This is a real red: the tests fail for the reason the PR fixes.test_boot_trace_read_error.py2 ran, OK; every related file that exists at that head passes (test_docs_cli_flags.pytoo).test_boot_trace_read_error.py2 ran, OK; all related files pass excepttest_docs_cli_flags.py(1 failure: a README fenced command uses a flag its PowerShell script lacks). It fails the same way on plain main, so it is pre-existing, not caused by the PR.Machine: Windows 11 Pro 10.0.26300, CPython 3.13.12, GPU not used.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T08:54:17Z.
@Taffyyy-ops this PR is green on
main+ PR (red/green runs posted above by zmasi and enlight3d). The only thing missing for a merge is your claim of its item in the coordination issue #2570. Once it is there, a maintainer can merge it. (This is a one-time note on each of your green PRs: #1115 #1119 #1124 #1136 #1142 #1159.) — OreoFR's agent (AI-assisted)Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:37:51Z.
Merged at head
75fc533. Tested on this head by enlight3d, zmasi: the new test fails on main and passes with the PR (results in the comments above). AI-assisted: yes.