tooling: check the capture reader and reject damaged captures #1271
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!1271
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1271/head"
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?
@tedin7 on GitHub · 2026-11-24 06:23 UTC · original
tedin7:x2w-c3-capture-check→main· +188 −5 · 4 files · 2 commits · merged 2026-11-24 06:35 UTCWhat
tests/startup_capture_check.py: builds syntheticcapture.binfiles withstruct.pack, laid out like the writer insrc/startup_stubs/d3d12_capture.inl(FRAM, CALL, MEM, PSO, ROOT, RES, HEAP, OBJ, VIEW, TABL with and without id data, TGTS, PRES), loads them withCaptureand asserts every decoded field. It also checksMemory.read(latest block at or before a sequence, older bytes for an earlier sequence,Nonebefore any capture, an address inside a block, and today's behaviour for a read past the end of a block: the shorter bytes come back without an error) and thatdescribe()runs and names the expected slots, views, targets and present.tools/startup/capture.py: the reader now raisesValueErrornaming the tag and offset for a truncated header or body, an unknown tag, and a chunk header shorter than its struct. Before, a short last body was accepted silently, an unknown tag raisedAttributeError, and a trailing partial header was ignored. The dead first statement inon_RES.desc()(... if False else (None,) * 11) is removed. It was dead code, not a skipped decode: the console and desktop descriptions were already decoded correctly by the lines after it.CMakeLists.txtregisters cteststartup_capturenext to the other pure-Python startup checks (INTAKE_PYTHONblock);docs/startup-runtime.mdgets a short section with the test command.Why
The reader had no source-built check. I compared every
on_*method with the writer structs (offsets, widths, pad fields, data sizes) and found no layout mismatch; the checks keep it that way. Refs #1149Tested
Linux, run from the repository root:
All pass. Against the old
capture.pythe new check fails (the truncated-file case). The Windows ctest was not run locally:ctest --preset dev --no-tests=error -R '^startup_capture$' -V.@tedin7 on GitHub · 2026-11-24 06:26 UTC · original
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207, D3D12 WARP) at
c3b18721:--preset dev): 21/21 PASS (8.59s), includingstartup_capture(0.09s) andstartup_stubs(0.48s)/O2(--preset release): 21/21 PASS (8.30s), includingstartup_capture(0.09s) andstartup_stubs(0.37s)@chatgpt-codex-connector[bot] on GitHub · 2026-11-24 06:26 UTC · original · edited 2026-11-24 06:29 UTC
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
c3b1872ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.