tooling: add deterministic PE compatibility report #1036

Manually merged
github merged 2 commits from gh-pr/1036/head into gh-pr/1036/base 2026-11-26 22:36:43 +00:00
Owner

@⁠lambirou on GitHub · 2026-11-23 22:20 UTC · original
lambirou:tools/compat-report → main · +734 −0 · 5 files · 2 commits · merged 2026-11-23 23:07 UTC

Change

Add tools/compat_report.py, an offline AMD64 PE import-routing report with deterministic JSON
and Markdown, plus a synthetic PE test registered in the Linux Python job.

The labels are candidate module routes derived from the import module name: hle,
windows, stub or unsupported. Every row records route_kind: candidate,
resolution: not_checked and provider: null; a name or ordinal absent from an export table
still receives its module route and is not claimed to resolve. Stub rows expose stub: true,
provider: null, and the summary reports stub_providers: 0.

The report also records TLS, SEH and load-config directory presence. The 12-byte exception entry
count is limited to AMD64; ARM64 and x86 images are rejected with exit 2 and their machine name.
The image is never loaded or executed.

Verification

  • out\pe-env\Scripts\python.exe -B tests\compat_report_check.py
    • Observed: compat report synthetic checks passed, exit 0.
  • Positive fixture: 7 imports (5 normal, 2 delay). Routes hle=3, windows=2,
    stub=2, unsupported=0; by_ordinal=3; stub rows 2, stub providers 0.
  • Candidate controls: xmem.dll!#65535 still maps to hle with resolution: not_checked;
    a fabricated api-ms-win-fixture-l1-1-0.dll!FabricatedApi maps to windows from the
    prefix with resolution: not_checked.
  • Machine controls: ARM64 (0xAA64) and x86 (0x14C) images exit 2 with the machine name and write
    no report.
  • Negative control: unsupported: negative.exe -> mystery.dll!MissingExport, exit 1, with both
    outputs written for inspection.
  • Read errors: missing input and invalid PE return 2 without a traceback or a report.
  • out\pe-env\Scripts\python.exe -B tests\docs_links_check.py: Self-test passed.,
    Checked 13 Markdown files and 223 links., exit 0.
  • git diff --check origin/main...HEAD: clean.
  • Tests not run: CMake, CTest, native Windows tests and GPU tests. This is a Python-only change.

Evidence and follow-up

  • Branch tools/compat-report, head a982c11, based on 61e5a09. Two commits:
    68ec1db adds the report and synthetic fixture; a982c11 addresses the review by naming
    candidate routes, flagging the absent stub provider, limiting the SEH count to AMD64 and
    registering the check.
  • The policy is data, not inference: HLE entries come from src/xmem_shim.cpp and
    src/d3d12_xs_shim.cpp; stub entries are public GDK module names without a shim in this tree;
    Windows entries are explicit system DLLs plus the documented API-set prefixes.
  • Provenance: Reference ivall/xcl@38b05b7b6954cfa5bd21cec72f68823603ca2227, public
    README/issues, observed 2026-11-23 for the reporting categories. Public specification used:
    Microsoft PE/COFF and GDK module documentation. Independent implementation:
    tools/compat_report.py, tests/compat_report_check.py.
  • Tests: synthetic PE with named, ordinal and delay imports; API-set prefix control; stub
    provider control; ARM64 and x86 rejection; unknown-DLL negative control.
  • Follow-up: split the route table into the XCL-02 import-routing module; add TLS callback counts
    and load-config flags; reject an output path that equals the input or the other output.
  • The diff is larger than the 400-line guide because the test builds the PE32+ image and its
    import, TLS, exception and load-config directories from bytes. It remains one behavior.
  • No game files, dumps, shader bytes, title paths or secrets are included.

Checklist

  • One reviewable behavior: deterministic offline import-routing candidates.
  • Positive test, candidate controls and negative control.
  • README and the Linux Python job updated.
  • No game files, dumps, logs or secrets.
  • Provenance recorded.
  • AI-assisted (Codex).
**@⁠lambirou** on GitHub · 2026-11-23 22:20 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1036) `lambirou:tools/compat-report` → `main` · +734 −0 · 5 files · 2 commits · merged 2026-11-23 23:07 UTC ## Change Add `tools/compat_report.py`, an offline AMD64 PE import-routing report with deterministic JSON and Markdown, plus a synthetic PE test registered in the Linux Python job. The labels are **candidate module routes** derived from the import module name: `hle`, `windows`, `stub` or `unsupported`. Every row records `route_kind: candidate`, `resolution: not_checked` and `provider: null`; a name or ordinal absent from an export table still receives its module route and is not claimed to resolve. Stub rows expose `stub: true`, `provider: null`, and the summary reports `stub_providers: 0`. The report also records TLS, SEH and load-config directory presence. The 12-byte exception entry count is limited to AMD64; ARM64 and x86 images are rejected with exit 2 and their machine name. The image is never loaded or executed. ## Verification - `out\pe-env\Scripts\python.exe -B tests\compat_report_check.py` - Observed: `compat report synthetic checks passed`, exit 0. - Positive fixture: 7 imports (5 normal, 2 delay). Routes `hle=3`, `windows=2`, `stub=2`, `unsupported=0`; `by_ordinal=3`; stub rows 2, stub providers 0. - Candidate controls: `xmem.dll!#65535` still maps to `hle` with `resolution: not_checked`; a fabricated `api-ms-win-fixture-l1-1-0.dll!FabricatedApi` maps to `windows` from the prefix with `resolution: not_checked`. - Machine controls: ARM64 (0xAA64) and x86 (0x14C) images exit 2 with the machine name and write no report. - Negative control: `unsupported: negative.exe -> mystery.dll!MissingExport`, exit 1, with both outputs written for inspection. - Read errors: missing input and invalid PE return 2 without a traceback or a report. - `out\pe-env\Scripts\python.exe -B tests\docs_links_check.py`: `Self-test passed.`, `Checked 13 Markdown files and 223 links.`, exit 0. - `git diff --check origin/main...HEAD`: clean. - Tests not run: CMake, CTest, native Windows tests and GPU tests. This is a Python-only change. ## Evidence and follow-up - Branch `tools/compat-report`, head `a982c11`, based on `61e5a09`. Two commits: `68ec1db` adds the report and synthetic fixture; `a982c11` addresses the review by naming candidate routes, flagging the absent stub provider, limiting the SEH count to AMD64 and registering the check. - The policy is data, not inference: HLE entries come from `src/xmem_shim.cpp` and `src/d3d12_xs_shim.cpp`; stub entries are public GDK module names without a shim in this tree; Windows entries are explicit system DLLs plus the documented API-set prefixes. - Provenance: Reference `ivall/xcl@38b05b7b6954cfa5bd21cec72f68823603ca2227`, public README/issues, observed 2026-11-23 for the reporting categories. Public specification used: Microsoft PE/COFF and GDK module documentation. Independent implementation: `tools/compat_report.py`, `tests/compat_report_check.py`. - Tests: synthetic PE with named, ordinal and delay imports; API-set prefix control; stub provider control; ARM64 and x86 rejection; unknown-DLL negative control. - Follow-up: split the route table into the XCL-02 import-routing module; add TLS callback counts and load-config flags; reject an output path that equals the input or the other output. - The diff is larger than the 400-line guide because the test builds the PE32+ image and its import, TLS, exception and load-config directories from bytes. It remains one behavior. - No game files, dumps, shader bytes, title paths or secrets are included. ## Checklist - [x] One reviewable behavior: deterministic offline import-routing candidates. - [x] Positive test, candidate controls and negative control. - [x] README and the Linux Python job updated. - [x] No game files, dumps, logs or secrets. - [x] Provenance recorded. - [x] AI-assisted (Codex).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:36:42 +00:00
github manually merged commit a982c1125b into gh-pr/1036/base 2026-11-26 22:36:43 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-23 22:35 UTC · original

Please make the policy labels describe candidate module routes. For example, a name or ordinal absent from the checked-in xmem export table still receives hle, and a fabricated api-ms-win-… name receives windows from its prefix. Neither classification establishes that the import resolves. The stub rows currently have no provider; flag that explicitly in the JSON and summary. Also scope the 12-byte exception-directory count to AMD64: ARM64 and x86 images must be rejected or reported without that count. Add these synthetic controls and register the offline check in the existing Linux Python job.

**@⁠R0Y00** on GitHub · 2026-11-23 22:35 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1036#issuecomment-7115945174) Please make the policy labels describe candidate module routes. For example, a name or ordinal absent from the checked-in xmem export table still receives `hle`, and a fabricated `api-ms-win-…` name receives `windows` from its prefix. Neither classification establishes that the import resolves. The `stub` rows currently have no provider; flag that explicitly in the JSON and summary. Also scope the 12-byte exception-directory count to AMD64: ARM64 and x86 images must be rejected or reported without that count. Add these synthetic controls and register the offline check in the existing Linux Python job.
Author
Owner

@⁠lambirou on GitHub · 2026-11-23 22:52 UTC · original

Addressed in a982c11. Route labels are now explicit candidates: every row carries route_kind=candidate, resolution=not_checked and provider=null. An absent xmem ordinal (#65535) and a fabricated api-ms-win name still receive their module route without claiming resolution. Stub rows report stub=true and the summary reports stub_providers=0. ARM64 and x86 images are rejected with exit 2 and their machine name before the 12-byte SEH count, with synthetic controls. The check is registered in the Linux Python job and the AGENTS list. compat_report_check passes; docs_links_check passes with 13 files and 223 links.

**@⁠lambirou** on GitHub · 2026-11-23 22:52 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1036#issuecomment-7116285254) Addressed in a982c11. Route labels are now explicit candidates: every row carries route_kind=candidate, resolution=not_checked and provider=null. An absent xmem ordinal (#65535) and a fabricated api-ms-win name still receive their module route without claiming resolution. Stub rows report stub=true and the summary reports stub_providers=0. ARM64 and x86 images are rejected with exit 2 and their machine name before the 12-byte SEH count, with synthetic controls. The check is registered in the Linux Python job and the AGENTS list. compat_report_check passes; docs_links_check passes with 13 files and 223 links.
This discussion has been locked. Commenting is limited to contributors.
No description provided.