runtime: check every field of an ERA attribute word #1751

Manually merged
github merged 1 commit from gh-pr/1751/head into gh-pr/1751/base 2026-11-26 23:31:03 +00:00
Owner

@⁠Asimmimx on GitHub · 2026-11-24 18:07 UTC · original
Asimmimx:runtime/era-heap-decode-fields → main · +52 −1 · 3 files · 1 commits · merged 2026-11-24 18:57 UTC

Refs #1149.

Change

src/era_heap.cpp decode() splits an attribute word with the public ERA layout: objectType:14, pageSize:2, allocatorId:8, alignment:5, memoryType:4 and reserved:31. era_heap_check read it only through the two recorded words (0x05e50000 and 0xa8004000). Both leave the object type and the reserved bits at 0.

I probed decode with 9 single-point mutants:

Mutant Existing 8 scenarios With decode_fields
object type masked to 12 bits survived killed
object type masked to 15 bits killed killed
page size from bit 15 killed killed
allocator masked to 7 bits killed killed
alignment from bit 23 killed killed
alignment masked to 4 bits killed killed
memory type masked to 3 bits killed killed
reserved taken from bit 32 survived killed
reserved taken from bit 34 killed killed

The new decode_fields scenario reads:

  • each field at its widest value alone (0x3fff, 3, 0xff, 0x1f, 0xf, 0x7fffffff);
  • the all-ones word;
  • one word with a distinct value in every field (0x2a5c, 2, 0xb7, 0x13, 9, 0x5a5a5a5).

A mismatch prints the decoded fields. era_heap_decode_fields_control expects a 13-bit object type and is registered with WILL_FAIL. The new row in the era_heap_* table of docs/experiments.md describes both.

The header and decode are not changed.

Results

Commit a992dbaa on origin/main. Windows 11 Pro 26300.9974, MSVC from Visual Studio, dev preset (Debug):

ctest --preset dev --no-tests=error -R '^era_heap_'
100% tests passed, 0 tests failed out of 10

The 10 tests are the eight existing scenarios, era_heap_decode_fields and the WILL_FAIL control, with no skips. Each mutant above was applied to src/era_heap.cpp alone, rebuilt and reverted; the probe script is not committed. docs_links_check.py passes.

AI-assisted (Claude Code).

**@⁠Asimmimx** on GitHub · 2026-11-24 18:07 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1751) `Asimmimx:runtime/era-heap-decode-fields` → `main` · +52 −1 · 3 files · 1 commits · merged 2026-11-24 18:57 UTC Refs #1149. ## Change `src/era_heap.cpp` `decode()` splits an attribute word with the public ERA layout: objectType:14, pageSize:2, allocatorId:8, alignment:5, memoryType:4 and reserved:31. `era_heap_check` read it only through the two recorded words (`0x05e50000` and `0xa8004000`). Both leave the object type and the reserved bits at 0. I probed `decode` with 9 single-point mutants: | Mutant | Existing 8 scenarios | With `decode_fields` | |---|---|---| | object type masked to 12 bits | **survived** | killed | | object type masked to 15 bits | killed | killed | | page size from bit 15 | killed | killed | | allocator masked to 7 bits | killed | killed | | alignment from bit 23 | killed | killed | | alignment masked to 4 bits | killed | killed | | memory type masked to 3 bits | killed | killed | | reserved taken from bit 32 | **survived** | killed | | reserved taken from bit 34 | killed | killed | The new `decode_fields` scenario reads: - each field at its widest value alone (`0x3fff`, 3, `0xff`, `0x1f`, `0xf`, `0x7fffffff`); - the all-ones word; - one word with a distinct value in every field (`0x2a5c`, 2, `0xb7`, `0x13`, 9, `0x5a5a5a5`). A mismatch prints the decoded fields. `era_heap_decode_fields_control` expects a 13-bit object type and is registered with `WILL_FAIL`. The new row in the `era_heap_*` table of `docs/experiments.md` describes both. The header and `decode` are not changed. ## Results Commit `a992dbaa` on `origin/main`. Windows 11 Pro 26300.9974, MSVC from Visual Studio, `dev` preset (Debug): ``` ctest --preset dev --no-tests=error -R '^era_heap_' 100% tests passed, 0 tests failed out of 10 ``` The 10 tests are the eight existing scenarios, `era_heap_decode_fields` and the `WILL_FAIL` control, with no skips. Each mutant above was applied to `src/era_heap.cpp` alone, rebuilt and reverted; the probe script is not committed. `docs_links_check.py` passes. AI-assisted (Claude Code).
era_heap_check reads decode() only through the two recorded words, which
leave the object type and the reserved bits at 0. A 12-bit object-type
mask and a reserved field taken from bit 32 instead of 33 therefore
decoded them unchanged and passed every scenario (2 of 9 single-point
mutants of decode survived).

The decode_fields scenario reads each field of the layout at its widest
value alone, an all-ones word and one word with a distinct value in every
field; it kills all nine mutants. decode_fields_control expects a 13-bit
object type and is registered with WILL_FAIL.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:31:01 +00:00
github manually merged commit a992dbaaf7 into gh-pr/1751/base 2026-11-26 23:31:03 +00:00
Author
Owner

@⁠ChazY11 on GitHub · 2026-11-24 19:06 UTC · original

Both "survived" mutants reproduce exactly as the PR body says

At a992dbaa, MSVC 14.44.35207, Windows 11 build 26300.9974. The two new tests register and pass:

cmake --preset dev
cmake --build --preset dev --target era_heap_check
ctest --preset dev -R '^era_heap_'
Test  #12: era_heap_decode_fields .......... Passed
Test  #13: era_heap_decode_fields_control .. Passed
100% tests passed, 0 tests failed out of 10

I then reproduced the two mutants the description lists as survived before this change, rebuilding era_heap_check.exe
each time (binary timestamp checked) and running the eight old scenarios and the new one separately:

mutant old 8 scenarios era_heap_decode_fields
attributes & 0x3fff → attributes & 0xfff green red
attributes >> 33 → attributes >> 32 green red

That is the claim in the description, confirmed independently: the old fixtures cannot see either change, and the new
scenario kills both. Reverted, all ten pass again.

The negative control is real

era_heap_decode_fields_control is registered with WILL_FAIL TRUE and expects a 13-bit object type; the widest object
type in the new scenario makes it fail. Worth keeping, because it is the one test that would still pass if the fixture
stopped producing wide words.

One small thing

The first ctest --preset dev -N I ran right after checking the branch out did not list either new test; a second
cmake --preset dev made them appear. That was my own sequence (configure ran against the pre-checkout CMakeLists.txt
in the same command), not a property of the change — but it cost me two minutes, so the reproduction in the body might
mention that the configure has to run after the checkout.

Verdict

Reviewed a992dbaa. The new scenario reads every field at its widest value and one word with a distinct value per field,
the two mutants that used to survive are dead, and the WILL_FAIL control is the right shape. No objections.

Notes

  • AI-assisted review.
**@⁠ChazY11** on GitHub · 2026-11-24 19:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1751#issuecomment-7141617731) ## Both "survived" mutants reproduce exactly as the PR body says At `a992dbaa`, MSVC 14.44.35207, Windows 11 build 26300.9974. The two new tests register and pass: ```powershell cmake --preset dev cmake --build --preset dev --target era_heap_check ctest --preset dev -R '^era_heap_' ``` ```text Test #12: era_heap_decode_fields .......... Passed Test #13: era_heap_decode_fields_control .. Passed 100% tests passed, 0 tests failed out of 10 ``` I then reproduced the two mutants the description lists as *survived before this change*, rebuilding `era_heap_check.exe` each time (binary timestamp checked) and running the eight old scenarios and the new one separately: | mutant | old 8 scenarios | `era_heap_decode_fields` | |---|---|---| | `attributes & 0x3fff` → `attributes & 0xfff` | **green** | **red** | | `attributes >> 33` → `attributes >> 32` | **green** | **red** | That is the claim in the description, confirmed independently: the old fixtures cannot see either change, and the new scenario kills both. Reverted, all ten pass again. ## The negative control is real `era_heap_decode_fields_control` is registered with `WILL_FAIL TRUE` and expects a 13-bit object type; the widest object type in the new scenario makes it fail. Worth keeping, because it is the one test that would still pass if the fixture stopped producing wide words. ## One small thing The first `ctest --preset dev -N` I ran right after checking the branch out did not list either new test; a second `cmake --preset dev` made them appear. That was my own sequence (configure ran against the pre-checkout `CMakeLists.txt` in the same command), not a property of the change — but it cost me two minutes, so the reproduction in the body might mention that the configure has to run after the checkout. ## Verdict Reviewed `a992dbaa`. The new scenario reads every field at its widest value and one word with a distinct value per field, the two mutants that used to survive are dead, and the `WILL_FAIL` control is the right shape. No objections. ## Notes - AI-assisted review.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 18:56 UTC · original · reviewed

Reviewed at commit a992dbaaf79d7414e97f572dc441852e5f4cc239 (CMakeLists.txt, docs/experiments.md, tests/era_heap_check.cpp).

Code Review

  • tests/era_heap_check.cpp adds decode_field_checks(bool narrow_object_type) exercising every bit field of era_heap::decode() (objectType:14, pageSize:2, allocatorId:8, alignment:5, memoryType:4, reserved:31) individually at max width, all-ones, and with distinct mixed values, plus the WILL_FAIL negative control (narrow_object_type=true masking want.object_type &= 0x1fff).
  • CMakeLists.txt touches only era_heap_check test registration (era_heap_decode_fields and era_heap_decode_fields_control with WILL_FAIL TRUE).
  • docs/experiments.md documents the new scenario and negative control cleanly.
  • Clean-room verified; 0 P1 / 0 P2 findings.

Verification

  • Linux:
    • git diff --check origin/main...HEAD: pass
    • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: pass (Checked 17 Markdown files and 365 links.)
    • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: pass (Checked 1298 tracked source, script and build/CI files: no bidirectional controls.)
  • Win2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev, cmake --build --preset dev --target era_heap_check, ctest --preset dev -R '^era_heap_' --parallel 6 --no-tests=error --output-on-failure): 10/10 passed (0.14s, including era_heap_decode_fields 0.01s and era_heap_decode_fields_control 0.01s)
    • Release /O2 (--preset release, cmake --build --preset release --target era_heap_check, ctest --preset release -R '^era_heap_' --parallel 6 --no-tests=error --output-on-failure): 10/10 passed (0.14s, including era_heap_decode_fields 0.02s and era_heap_decode_fields_control 0.01s)
  • Local mutation check on Win2025 (reverted after verification):
    • Narrowing object_type mask (0x3fff -> 0xfff) and shifting reserved (>> 33 -> >> 32) in src/era_heap.cpp: era_heap_decode_fields failed (0/1 passed, reporting FAIL: decode object type, memory type, reserved, all ones, and mixed).

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-24 18:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1751#pullrequestreview-6045430229) · **reviewed** Reviewed at commit `a992dbaaf79d7414e97f572dc441852e5f4cc239` (`CMakeLists.txt`, `docs/experiments.md`, `tests/era_heap_check.cpp`). ### Code Review - `tests/era_heap_check.cpp` adds `decode_field_checks(bool narrow_object_type)` exercising every bit field of `era_heap::decode()` (`objectType:14`, `pageSize:2`, `allocatorId:8`, `alignment:5`, `memoryType:4`, `reserved:31`) individually at max width, all-ones, and with distinct mixed values, plus the `WILL_FAIL` negative control (`narrow_object_type=true` masking `want.object_type &= 0x1fff`). - `CMakeLists.txt` touches only `era_heap_check` test registration (`era_heap_decode_fields` and `era_heap_decode_fields_control` with `WILL_FAIL TRUE`). - `docs/experiments.md` documents the new scenario and negative control cleanly. - Clean-room verified; 0 P1 / 0 P2 findings. ### Verification - **Linux**: - `git diff --check origin/main...HEAD`: pass - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py`: pass (`Checked 17 Markdown files and 365 links.`) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py`: pass (`Checked 1298 tracked source, script and build/CI files: no bidirectional controls.`) - **Win2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - Debug (`--preset dev`, `cmake --build --preset dev --target era_heap_check`, `ctest --preset dev -R '^era_heap_' --parallel 6 --no-tests=error --output-on-failure`): **10/10 passed** (`0.14s`, including `era_heap_decode_fields` `0.01s` and `era_heap_decode_fields_control` `0.01s`) - Release `/O2` (`--preset release`, `cmake --build --preset release --target era_heap_check`, `ctest --preset release -R '^era_heap_' --parallel 6 --no-tests=error --output-on-failure`): **10/10 passed** (`0.14s`, including `era_heap_decode_fields` `0.02s` and `era_heap_decode_fields_control` `0.01s`) - **Local mutation check on Win2025** (reverted after verification): - Narrowing `object_type` mask (`0x3fff` -> `0xfff`) and shifting `reserved` (`>> 33` -> `>> 32`) in `src/era_heap.cpp`: `era_heap_decode_fields` failed (`0/1 passed`, reporting `FAIL: decode object type`, `memory type`, `reserved`, `all ones`, and `mixed`). AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.