startup: count DirectStorage page requests by where they end in the heartbeat #1857

Merged
MasterDomino merged 1 commit from upstream-pr/1864 into main 2026-11-24 19:55:54 +00:00
MasterDomino commented 2026-11-24 19:45:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-24T19:45:46Z.


What

The DirectStorage stand-in (src/startup_stubs/xcrdapi.cpp) now counts page-destination requests by where page_offset + destination_size ends against the first 64 KiB page: inside it, exactly at its end, or past it. Each group is split into completed and failed. The heartbeat prints the counts as a third line, after the failure-cause line from #1781:

x2w-dstorage heartbeat <n> s: page requests by end against the first 64 KiB page inside-completed=<n> inside-failed=<n> at-page-end-completed=<n> at-page-end-failed=<n> past-completed=<n> past-failed=<n>

Nothing else changes. Outcomes, statuses, ordering, the totals line, the failure-cause line and the per-request text are all as before. This is the page-shape follow-up mentioned in #1198 ("Page-shape counts can follow separately").

Refs #1198
Refs #1758

Why

Counts from local loading runs (aggregates only), split by where each page-destination request ends:

End of page_offset + dest_size completed failed
inside the first page 19,345 0
exactly at the first page's end 4,554 2,256
past it 2,366 0

Every destination-capacity failure in those runs had the "ends exactly at the page end" shape: a zlib stream longer than dest_size. These numbers were collected with a local diagnostic. This PR makes the same split available in any heartbeat, so other runs can be compared without that patch. The numbers are only the motivation. This PR does not change any outcome, and it does not explain why that shape fails or what the title expects for it.

Change

  • What counts as a page request. options & (1ull << 21). page_offset is the low 16 bits of the u64 at +0x10, and destination_size is the u32 at +0x18. Both are read exactly as execute_request and queue_enqueue_request read them.
  • Classification. end = u64(page_offset) + destination_size. Because the sum is 64-bit it cannot wrap. end < 0x10000 is inside, == 0x10000 is at the page end, > 0x10000 is past it. A destination size of 0 ends at its offset, so it counts as inside.
  • Completed and failed.
    • In execute_request, after the existing failed decision, using the same expression: failed means failed, and anything else except empty means completed (the request was written).
    • empty (source size 0 or null destination) is neither completed nor failed, so it is not counted. This matches how empty is not a failure on the totals line.
    • A page array that cannot be read at run (run_entry, before execute_request) counts as failed for its shape.
    • An entry whose run threw (fail_entry) also counts as failed.
    • These are the same sites that add to failed=.
  • Excluded. Entries that never started (fail_unstarted: the queue could not record or start them, and Submit failed them) are not counted, because they never ran. Their Unrecorded record also does not keep the request bytes. So the page failed counts can be lower than the page share of failed= under out-of-memory. The fixture states and checks the normal case.
  • Implementation. A fixed LONG[3][2] array updated with InterlockedIncrement. There is no allocation and no lock on the worker path. The heartbeat samples the array alongside the failure causes and prints it only when the totals line prints.
  • Parser safety. The line contains no inflated=, options=, commit peak=, ->, Queue::EnqueueStatus, entry type or heartbeat: text:
    • tools/startup/live_view.py sends any line containing heartbeat to its frames branch, which needs heartbeat: <n> frames, so it ignores this line.
    • None of the RE_DSTORAGE_* patterns in tools/startup/triage_run.py match it.
    • The HEARTBEAT regex in tests/startup_heartbeat_check.py needs commit peak= on the same line.
    • The fixture asserts the first three strings are absent, and startup_heartbeat_commit still passes.
  • Docs. docs/startup-runtime.md has a new Findings entry, "DirectStorage page-request ends (#1198)", and the heartbeat paragraph now mentions the third line.

Tests

New fixture tests/startup_storage_page_end_counts.cpp. It is a sibling of startup_storage_failure_counts and compiles xcrdapi.cpp into itself.

Page writes go through x2w_xmem_write_physical, so the fixture loads the built xmem shim ($<TARGET_FILE:xmem_shim>) as xmem.dll and takes two page tokens from XMemAllocatePhysicalPages under X2W_XMEM_PERMISSIVE. It uses no device or GPU. All requests use memory sources, so the chunked-stream cache does not apply.

One Submit carries these requests. Each is followed by its status entry, and a fence closes the Submit.

End Completed Failed (failure site)
inside raw 0x1000 at offset 0x100; zlib 0x800 into 0xFFFF dest size 0 (capacity); page array made no-access after Enqueue (run_entry); unknown option bit
at page end raw 0x8000 at 0x8000 (high bits set in the +0x10 field are ignored); raw 1 byte at 0xFFFF; raw 0x10000 at 0 zlib 0x8010 into 0x8000 at 0x8000 (capacity, the motivating shape); a token with a low bit set (page write failed)
past raw 0x2000 at 0xF000 over two pages second token 0 (missing grant); zlib with a wrong Adler-32; dest 2^32 - 1 at offset 1 (page array not readable in full at Enqueue, so "missing page tokens"; a 32-bit end would wrap to 0)
not counted an empty page request; a linear request that completes a linear request that fails (capacity)

Expected counts: inside 2/3, at-page-end 3/2, past 1/3. They are chosen so that swapping any two shapes changes at least one count.

The fixture checks:

  • every status;
  • the exact count for each shape and outcome;
  • page failures = failed= total - 1 linear failure;
  • page completions = done + inflated - 1 linear completion;
  • done=6, inflated=1, failed=9;
  • the exact heartbeat line, formatted from a sample taken before a later count;
  • the logged outcome text of every failure, so each request failed at the site the plan names;
  • 10 edge ends, including three where a 32-bit sum wraps.

Environment: Windows 11 Home 10.0.26300, MSVC 19.44.35221 x64, CMake 4.5.0 / Ninja, dev preset. Commit 5b5d9260 on bbadc76d (upstream/main).

cmake --preset dev -DINTAKE_PYTHON=<pe-env>/Scripts/python.exe
cmake --build --preset dev
ctest --preset dev --no-tests=error -R '^startup_storage_page_end_counts' -V

Result: both tests pass (2/2).

x2w-dstorage heartbeat 30 s: page requests by end against the first 64 KiB page inside-completed=2 inside-failed=3 at-page-end-completed=3 at-page-end-failed=2 past-completed=1 past-failed=3
ctest --preset dev --no-tests=error -R 'startup_storage|dstorage|startup_heartbeat|startup_triage' -j 4

Result: 17/17 passed, including startup_storage_failure_counts (+ control), startup_heartbeat_commit, startup_triage_run, startup_storage_worker_start, startup_dstorage_destination and cpu_native_dstorage.

ctest --preset dev --no-tests=error -R '^startup_' -j 4

Result: 239 tests, 235 passed, 0 failed, 4 skipped. The skips are capability skips (77): startup_view_heap_warp, startup_view_heap_hardware, startup_logical_view_warp and startup_logical_view_hardware.

out/pe-env/Scripts/python.exe -B tests/docs_links_check.py
out/pe-env/Scripts/python.exe -B tests/bidi_controls_check.py

Results:

  • docs_links_check.py: 18 Markdown files, 370 links, pass.
  • bidi_controls_check.py: 1325 tracked files, no bidirectional controls.

Negative controls

Registered. startup_storage_page_end_counts_one_bucket_control (--mutate one-bucket, WILL_FAIL) expects every page request at the page end. It fails as intended:

FAIL: inside-completed counted 2, expected 0
FAIL: inside-failed counted 3, expected 0
FAIL: at-page-end-completed counted 3, expected 6
FAIL: at-page-end-failed counted 2, expected 8
FAIL: past-completed counted 1, expected 0
FAIL: past-failed counted 3, expected 0
FAIL: heartbeat line differs

Manual mutant 1, recorded and reverted. == and > swapped in page_end, so if (end > 0x10000) return PageEnd::at_page_end;:

FAIL: at-page-end-completed counted 1, expected 3
FAIL: at-page-end-failed counted 3, expected 2
FAIL: past-completed counted 3, expected 1
FAIL: past-failed counted 2, expected 3
FAIL: heartbeat line differs
FAIL: edge end (last byte of the page) is past, expected at-page-end
FAIL: edge end (one whole page) is past, expected at-page-end
FAIL: edge end (one byte past the page end) is at-page-end, expected past
... (4 more edge ends)

Manual mutant 2, recorded and reverted. A 32-bit sum, const u64 end = page_offset + destination_size;:

FAIL: inside-failed counted 4, expected 3
FAIL: past-failed counted 2, expected 3
FAIL: edge end (offset 1, size 2^32 - 1 (a 32-bit sum wraps to 0)) is inside, expected past
FAIL: edge end (offset 0xFFFF, size 2^32 - 1 (a 32-bit sum wraps to 0xFFFE)) is inside, expected past
FAIL: edge end (a 32-bit sum wraps to exactly 0) is inside, expected past

Check of the log assertion, reverted. Expecting "missing page grant token" for the page-write failure gives FAIL: outcome "missing page grant token" logged 1 times, expected 2.

Not covered

  • The fixture checks the line through the stand-in's formatter. It does not wait for the 10 s heartbeat thread. startup_heartbeat_commit runs the real heartbeat, but it does not assert the third line.
  • The fixture checks completed page writes by status and by x2w_xmem_write_physical returning success. It does not read back page contents; startup_stub_consumer covers that.
  • The fail_entry (a request whose run threw) path is counted by the code but not exercised by this fixture.
  • Entries that never started are not counted (see Change).
  • The counts describe request shapes over a whole run. They do not say why the at-page-end shape fails, which failure came first, or what the title expects for a refused request. Nothing here was run against title code.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6590017589 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1864). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-24T19:45:46Z. --- ## What The DirectStorage stand-in (`src/startup_stubs/xcrdapi.cpp`) now counts page-destination requests by where `page_offset + destination_size` ends against the first 64 KiB page: inside it, exactly at its end, or past it. Each group is split into completed and failed. The heartbeat prints the counts as a third line, after the failure-cause line from #1781: ``` x2w-dstorage heartbeat <n> s: page requests by end against the first 64 KiB page inside-completed=<n> inside-failed=<n> at-page-end-completed=<n> at-page-end-failed=<n> past-completed=<n> past-failed=<n> ``` Nothing else changes. Outcomes, statuses, ordering, the totals line, the failure-cause line and the per-request text are all as before. This is the page-shape follow-up mentioned in #1198 ("Page-shape counts can follow separately"). Refs #1198 Refs #1758 ## Why Counts from local loading runs (aggregates only), split by where each page-destination request ends: | End of `page_offset + dest_size` | completed | failed | |---|---:|---:| | inside the first page | 19,345 | 0 | | exactly at the first page's end | 4,554 | 2,256 | | past it | 2,366 | 0 | Every destination-capacity failure in those runs had the "ends exactly at the page end" shape: a zlib stream longer than `dest_size`. These numbers were collected with a local diagnostic. This PR makes the same split available in any heartbeat, so other runs can be compared without that patch. The numbers are only the motivation. This PR does not change any outcome, and it does not explain why that shape fails or what the title expects for it. ## Change - **What counts as a page request.** `options & (1ull << 21)`. `page_offset` is the low 16 bits of the u64 at +0x10, and `destination_size` is the u32 at +0x18. Both are read exactly as `execute_request` and `queue_enqueue_request` read them. - **Classification.** `end = u64(page_offset) + destination_size`. Because the sum is 64-bit it cannot wrap. `end < 0x10000` is inside, `== 0x10000` is at the page end, `> 0x10000` is past it. A destination size of 0 ends at its offset, so it counts as inside. - **Completed and failed.** - In `execute_request`, after the existing `failed` decision, using the same expression: `failed` means failed, and anything else except `empty` means completed (the request was written). - `empty` (source size 0 or null destination) is neither completed nor failed, so it is not counted. This matches how `empty` is not a failure on the totals line. - A page array that cannot be read at run (`run_entry`, before `execute_request`) counts as failed for its shape. - An entry whose run threw (`fail_entry`) also counts as failed. - These are the same sites that add to `failed=`. - **Excluded.** Entries that never started (`fail_unstarted`: the queue could not record or start them, and Submit failed them) are not counted, because they never ran. Their `Unrecorded` record also does not keep the request bytes. So the page failed counts can be lower than the page share of `failed=` under out-of-memory. The fixture states and checks the normal case. - **Implementation.** A fixed `LONG[3][2]` array updated with `InterlockedIncrement`. There is no allocation and no lock on the worker path. The heartbeat samples the array alongside the failure causes and prints it only when the totals line prints. - **Parser safety.** The line contains no `inflated=`, `options=`, `commit peak=`, `->`, `Queue::EnqueueStatus`, `entry type` or `heartbeat:` text: - `tools/startup/live_view.py` sends any line containing `heartbeat` to its frames branch, which needs `heartbeat: <n> frames`, so it ignores this line. - None of the `RE_DSTORAGE_*` patterns in `tools/startup/triage_run.py` match it. - The `HEARTBEAT` regex in `tests/startup_heartbeat_check.py` needs `commit peak=` on the same line. - The fixture asserts the first three strings are absent, and `startup_heartbeat_commit` still passes. - **Docs.** `docs/startup-runtime.md` has a new Findings entry, "DirectStorage page-request ends (#1198)", and the heartbeat paragraph now mentions the third line. ## Tests New fixture `tests/startup_storage_page_end_counts.cpp`. It is a sibling of `startup_storage_failure_counts` and compiles `xcrdapi.cpp` into itself. Page writes go through `x2w_xmem_write_physical`, so the fixture loads the built xmem shim (`$<TARGET_FILE:xmem_shim>`) as `xmem.dll` and takes two page tokens from `XMemAllocatePhysicalPages` under `X2W_XMEM_PERMISSIVE`. It uses no device or GPU. All requests use memory sources, so the chunked-stream cache does not apply. One Submit carries these requests. Each is followed by its status entry, and a fence closes the Submit. | End | Completed | Failed (failure site) | |---|---|---| | inside | raw 0x1000 at offset 0x100; zlib 0x800 into 0xFFFF | dest size 0 (capacity); page array made no-access after Enqueue (`run_entry`); unknown option bit | | at page end | raw 0x8000 at 0x8000 (high bits set in the +0x10 field are ignored); raw 1 byte at 0xFFFF; raw 0x10000 at 0 | zlib 0x8010 into 0x8000 at 0x8000 (capacity, the motivating shape); a token with a low bit set (page write failed) | | past | raw 0x2000 at 0xF000 over two pages | second token 0 (missing grant); zlib with a wrong Adler-32; dest 2^32 - 1 at offset 1 (page array not readable in full at Enqueue, so "missing page tokens"; a 32-bit end would wrap to 0) | | not counted | an `empty` page request; a linear request that completes | a linear request that fails (capacity) | Expected counts: inside 2/3, at-page-end 3/2, past 1/3. They are chosen so that swapping any two shapes changes at least one count. The fixture checks: - every status; - the exact count for each shape and outcome; - page failures = `failed=` total - 1 linear failure; - page completions = done + inflated - 1 linear completion; - done=6, inflated=1, failed=9; - the exact heartbeat line, formatted from a sample taken before a later count; - the logged outcome text of every failure, so each request failed at the site the plan names; - 10 edge ends, including three where a 32-bit sum wraps. Environment: Windows 11 Home 10.0.26300, MSVC 19.44.35221 x64, CMake 4.5.0 / Ninja, `dev` preset. Commit `5b5d9260` on `bbadc76d` (upstream/main). ```powershell cmake --preset dev -DINTAKE_PYTHON=<pe-env>/Scripts/python.exe cmake --build --preset dev ctest --preset dev --no-tests=error -R '^startup_storage_page_end_counts' -V ``` Result: both tests pass (2/2). ``` x2w-dstorage heartbeat 30 s: page requests by end against the first 64 KiB page inside-completed=2 inside-failed=3 at-page-end-completed=3 at-page-end-failed=2 past-completed=1 past-failed=3 ``` ```powershell ctest --preset dev --no-tests=error -R 'startup_storage|dstorage|startup_heartbeat|startup_triage' -j 4 ``` Result: 17/17 passed, including `startup_storage_failure_counts` (+ control), `startup_heartbeat_commit`, `startup_triage_run`, `startup_storage_worker_start`, `startup_dstorage_destination` and `cpu_native_dstorage`. ```powershell ctest --preset dev --no-tests=error -R '^startup_' -j 4 ``` Result: 239 tests, 235 passed, 0 failed, 4 skipped. The skips are capability skips (77): `startup_view_heap_warp`, `startup_view_heap_hardware`, `startup_logical_view_warp` and `startup_logical_view_hardware`. ``` out/pe-env/Scripts/python.exe -B tests/docs_links_check.py out/pe-env/Scripts/python.exe -B tests/bidi_controls_check.py ``` Results: - `docs_links_check.py`: 18 Markdown files, 370 links, pass. - `bidi_controls_check.py`: 1325 tracked files, no bidirectional controls. ## Negative controls **Registered.** `startup_storage_page_end_counts_one_bucket_control` (`--mutate one-bucket`, `WILL_FAIL`) expects every page request at the page end. It fails as intended: ``` FAIL: inside-completed counted 2, expected 0 FAIL: inside-failed counted 3, expected 0 FAIL: at-page-end-completed counted 3, expected 6 FAIL: at-page-end-failed counted 2, expected 8 FAIL: past-completed counted 1, expected 0 FAIL: past-failed counted 3, expected 0 FAIL: heartbeat line differs ``` **Manual mutant 1, recorded and reverted.** `==` and `>` swapped in `page_end`, so `if (end > 0x10000) return PageEnd::at_page_end;`: ``` FAIL: at-page-end-completed counted 1, expected 3 FAIL: at-page-end-failed counted 3, expected 2 FAIL: past-completed counted 3, expected 1 FAIL: past-failed counted 2, expected 3 FAIL: heartbeat line differs FAIL: edge end (last byte of the page) is past, expected at-page-end FAIL: edge end (one whole page) is past, expected at-page-end FAIL: edge end (one byte past the page end) is at-page-end, expected past ... (4 more edge ends) ``` **Manual mutant 2, recorded and reverted.** A 32-bit sum, `const u64 end = page_offset + destination_size;`: ``` FAIL: inside-failed counted 4, expected 3 FAIL: past-failed counted 2, expected 3 FAIL: edge end (offset 1, size 2^32 - 1 (a 32-bit sum wraps to 0)) is inside, expected past FAIL: edge end (offset 0xFFFF, size 2^32 - 1 (a 32-bit sum wraps to 0xFFFE)) is inside, expected past FAIL: edge end (a 32-bit sum wraps to exactly 0) is inside, expected past ``` **Check of the log assertion, reverted.** Expecting "missing page grant token" for the page-write failure gives `FAIL: outcome "missing page grant token" logged 1 times, expected 2`. ## Not covered - The fixture checks the line through the stand-in's formatter. It does not wait for the 10 s heartbeat thread. `startup_heartbeat_commit` runs the real heartbeat, but it does not assert the third line. - The fixture checks completed page writes by status and by `x2w_xmem_write_physical` returning success. It does not read back page contents; `startup_stub_consumer` covers that. - The `fail_entry` (a request whose run threw) path is counted by the code but not exercised by this fixture. - Entries that never started are not counted (see Change). - The counts describe request shapes over a whole run. They do not say why the at-page-end shape fails, which failure came first, or what the title expects for a refused request. Nothing here was run against title code. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 20:01:08 +00:00
tedin7 commented 2026-11-24 20:01:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T19:49:46Z.

Review: COMMENTED


Review of 5b5d9260 (merge base bbadc76d; origin/main is now 5a6ad936, and git merge-tree of the two merges cleanly). Comment only, not an approval.

Verdict

No P1 or P2 found. The change is counting only, the arithmetic cannot wrap, and the heartbeat line cannot be mistaken for the existing parsed line. Three P3 notes. Clean-room and title-neutral: the numbers in the description are aggregates, the fixture is source-built, and no title code or data is involved.

Overflow and page arithmetic

end = u64{page_offset} + destination_size with page_offset already masked to 16 bits and destination_size a u32: the largest sum is 0xFFFF + 0xFFFFFFFF, far below 2^64, so it cannot wrap. The thresholds are < 0x10000 inside, == 0x10000 at the end, > 0x10000 past it, with a size of 0 landing inside. The two reads (request + 0x10 as u64, request + 0x18 as u32) lie within the 0x48-byte Entry::bytes, and they are the same reads execute_request already does.

Behaviour-neutral

In execute_request the only change to existing logic is hoisting strcmp(outcome, "empty") into empty; failed is the same expression. The new counter call sits after count_failure, so a failed request adds to failed= and to a page counter from the same decision. Statuses, ordering, E_FAIL on pending, and the per-request log text are untouched.

Counted once

  • run_entry unreadable-page-array path: counts failed and returns before execute_request, so no second count.
  • A throw inside run_entry goes to fail_entry, which counts failed only for Entry::request (the counter itself ignores requests without bit 21). After count_page_request the only thing left in execute_request is logging, so I see no route to a double count.
  • fail_unstarted does not call fail_entry, so entries that never started are not counted, as stated.

Heartbeat format

The new line is printed after the causes line, from the same sample. It carries no commit peak=, so the regex in tests/startup_heartbeat_check.py (which requires commit peak=…) cannot match it, and no other script reads x2w-dstorage heartbeat. The 384-byte buffer is enough: the fixed text is under 200 bytes and six %ld add at most about 66 more.

P3

  • The fail_entry branch (a request whose run threw) is not exercised by the fixture. The description says so.
  • The counter re-decodes options, offset and size from the request bytes instead of reusing what execute_request already parsed. It works, and a future change to one decoder would need the other changed too.
  • startup_heartbeat_commit runs the real heartbeat thread but does not assert the third line, so only the formatter is checked, not that the thread prints it.

Commands run (Linux, Python 3.14.8)

  • python -B tests/docs_links_check.py: Self-test passed. Checked 18 Markdown files and 370 links.
  • python -B tests/bidi_controls_check.py: Self-test passed. Checked 1325 tracked source, script and build/CI files: no bidirectional controls.
  • git diff --check origin/main...HEAD: clean.
  • git grep "dstorage heartbeat": only the stand-in, its two fixtures and the docs.
  • x86_64-w64-mingw32-g++ -fsyntax-only tests/startup_storage_page_end_counts.cpp: stops at local_log.h:72 (__except, MSVC SEH). The fixture and its manual mutants cannot be built here, so I could not run any mutation. Everything above about the C++ is from reading the diff.

Not run

startup_storage_page_end_counts and its _one_bucket_control (Windows/MSVC, xmem shim), and the author's mutants. I neither confirm nor dispute their results; the mutants described (swapped ==/>, 32-bit sum) are the right ones for the arithmetic above.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046251175 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1864#pullrequestreview-6046251175). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T19:49:46Z. **Review:** COMMENTED --- Review of `5b5d9260` (merge base `bbadc76d`; `origin/main` is now `5a6ad936`, and `git merge-tree` of the two merges cleanly). Comment only, not an approval. ## Verdict No P1 or P2 found. The change is counting only, the arithmetic cannot wrap, and the heartbeat line cannot be mistaken for the existing parsed line. Three P3 notes. Clean-room and title-neutral: the numbers in the description are aggregates, the fixture is source-built, and no title code or data is involved. ## Overflow and page arithmetic `end = u64{page_offset} + destination_size` with `page_offset` already masked to 16 bits and `destination_size` a u32: the largest sum is 0xFFFF + 0xFFFFFFFF, far below 2^64, so it cannot wrap. The thresholds are `< 0x10000` inside, `== 0x10000` at the end, `> 0x10000` past it, with a size of 0 landing inside. The two reads (`request + 0x10` as u64, `request + 0x18` as u32) lie within the 0x48-byte `Entry::bytes`, and they are the same reads `execute_request` already does. ## Behaviour-neutral In `execute_request` the only change to existing logic is hoisting `strcmp(outcome, "empty")` into `empty`; `failed` is the same expression. The new counter call sits after `count_failure`, so a failed request adds to `failed=` and to a page counter from the same decision. Statuses, ordering, `E_FAIL` on `pending`, and the per-request log text are untouched. ## Counted once - `run_entry` unreadable-page-array path: counts failed and returns before `execute_request`, so no second count. - A throw inside `run_entry` goes to `fail_entry`, which counts failed only for `Entry::request` (the counter itself ignores requests without bit 21). After `count_page_request` the only thing left in `execute_request` is logging, so I see no route to a double count. - `fail_unstarted` does not call `fail_entry`, so entries that never started are not counted, as stated. ## Heartbeat format The new line is printed after the causes line, from the same sample. It carries no `commit peak=`, so the regex in `tests/startup_heartbeat_check.py` (which requires `commit peak=…`) cannot match it, and no other script reads `x2w-dstorage heartbeat`. The 384-byte buffer is enough: the fixed text is under 200 bytes and six `%ld` add at most about 66 more. ## P3 - The `fail_entry` branch (a request whose run threw) is not exercised by the fixture. The description says so. - The counter re-decodes options, offset and size from the request bytes instead of reusing what `execute_request` already parsed. It works, and a future change to one decoder would need the other changed too. - `startup_heartbeat_commit` runs the real heartbeat thread but does not assert the third line, so only the formatter is checked, not that the thread prints it. ## Commands run (Linux, Python 3.14.8) - `python -B tests/docs_links_check.py`: Self-test passed. Checked 18 Markdown files and 370 links. - `python -B tests/bidi_controls_check.py`: Self-test passed. Checked 1325 tracked source, script and build/CI files: no bidirectional controls. - `git diff --check origin/main...HEAD`: clean. - `git grep "dstorage heartbeat"`: only the stand-in, its two fixtures and the docs. - `x86_64-w64-mingw32-g++ -fsyntax-only tests/startup_storage_page_end_counts.cpp`: stops at `local_log.h:72` (`__except`, MSVC SEH). The fixture and its manual mutants cannot be built here, so I could not run any mutation. Everything above about the C++ is from reading the diff. ## Not run `startup_storage_page_end_counts` and its `_one_bucket_control` (Windows/MSVC, xmem shim), and the author's mutants. I neither confirm nor dispute their results; the mutants described (swapped `==`/`>`, 32-bit sum) are the right ones for the arithmetic above. AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1857
No description provided.