tests: accept a heartbeat peak commit that rose between samples #2559

Merged
tedin7 merged 6 commits from upstream-pr/2567 into main 2026-11-25 23:15:32 +00:00
tedin7 commented 2026-11-25 21:16:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T21:16:02Z.


Part of #448

What this unblocks: startup_heartbeat_commit stops failing on Windows when the process peak commit rises between two heartbeat samples, and it runs in about 3 s instead of about 30 s.

Change:

  • tests/startup_heartbeat_check.py: after the extra allocation is freed, the check required the later sample's peak to be exactly equal to the earlier one. A peak can only stay or grow, and the heartbeat thread or the allocator can raise it between samples, so the exact match fails on a healthy run. It now requires >=; a peak that falls is still a failure, and the commit must still drop by at least 8 MiB. The rule lives in released_is_valid(), and a new controls() step (run first, also alone as startup_heartbeat_check.py controls) is the negative control: equal peak passes, a raised peak passes, a fallen peak fails, a commit that dropped under 8 MiB fails.
  • Speed: the old run was three 10 s heartbeat intervals (Sleep(10000) in src/startup_stubs/xcrdapi.cpp). The heartbeat thread now reads X2W_HEARTBEAT_INTERVAL_MS (a whole number from 1000 to 10000; anything else keeps 10000), and the test sets 1000. A test-only knob in the DLL is needed because the interval is a compiled-in sleep inside the stub that the test launches; the test cannot shorten it from outside. The log label stays whole seconds. The test also asserts the first sample is labelled under 10 s, so it fails if the override stops working.
  • Default product behavior is unchanged.
  • Dropped from an earlier head: shortening the polling sleeps in startup_storage_worker_start. Measured on Win2025 it gave no gain (37.5 s with the old 5 ms sleeps, 37.1 to 40.4 s with 1 ms), so it is not in this PR.

Verification (Win2025, exact head 1761adc4e50e4d758f9d2142a9eb9ed4a77317cd, three separate runs, dev + release each, so 6 passes of the test with the 1 s interval):

  • cmake --build --preset dev --target startup_stub_xcrdapi -- -j 2 -> ok (0.41 s)
  • ctest --preset dev -R 'startup_heartbeat' --parallel 2 --no-tests=error --output-on-failure -> 1/1 passed, startup_heartbeat_commit 3.14 s, 3.40 s, 3.52 s
  • cmake --build --preset release --target startup_stub_xcrdapi -- -j 2 -> ok (3.30 s)
  • ctest --preset release -R 'startup_heartbeat' --parallel 2 --no-tests=error --output-on-failure -> 1/1 passed, 3.16 s, 3.13 s, 3.10 s
  • The controls() step runs inside that ctest test, so the negative control passed on each run.
  • git diff --check -> clean

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6613913824 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2567). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T21:16:02Z. --- Part of #448 What this unblocks: `startup_heartbeat_commit` stops failing on Windows when the process peak commit rises between two heartbeat samples, and it runs in about 3 s instead of about 30 s. Change: - `tests/startup_heartbeat_check.py`: after the extra allocation is freed, the check required the later sample's peak to be exactly equal to the earlier one. A peak can only stay or grow, and the heartbeat thread or the allocator can raise it between samples, so the exact match fails on a healthy run. It now requires `>=`; a peak that falls is still a failure, and the commit must still drop by at least 8 MiB. The rule lives in `released_is_valid()`, and a new `controls()` step (run first, also alone as `startup_heartbeat_check.py controls`) is the negative control: equal peak passes, a raised peak passes, a fallen peak fails, a commit that dropped under 8 MiB fails. - Speed: the old run was three 10 s heartbeat intervals (`Sleep(10000)` in `src/startup_stubs/xcrdapi.cpp`). The heartbeat thread now reads `X2W_HEARTBEAT_INTERVAL_MS` (a whole number from 1000 to 10000; anything else keeps 10000), and the test sets 1000. A test-only knob in the DLL is needed because the interval is a compiled-in sleep inside the stub that the test launches; the test cannot shorten it from outside. The log label stays whole seconds. The test also asserts the first sample is labelled under 10 s, so it fails if the override stops working. - Default product behavior is unchanged. - Dropped from an earlier head: shortening the polling sleeps in `startup_storage_worker_start`. Measured on Win2025 it gave no gain (37.5 s with the old 5 ms sleeps, 37.1 to 40.4 s with 1 ms), so it is not in this PR. Verification (Win2025, exact head `1761adc4e50e4d758f9d2142a9eb9ed4a77317cd`, three separate runs, dev + release each, so 6 passes of the test with the 1 s interval): - `cmake --build --preset dev --target startup_stub_xcrdapi -- -j 2` -> ok (0.41 s) - `ctest --preset dev -R 'startup_heartbeat' --parallel 2 --no-tests=error --output-on-failure` -> 1/1 passed, `startup_heartbeat_commit` 3.14 s, 3.40 s, 3.52 s - `cmake --build --preset release --target startup_stub_xcrdapi -- -j 2` -> ok (3.30 s) - `ctest --preset release -R 'startup_heartbeat' --parallel 2 --no-tests=error --output-on-failure` -> 1/1 passed, 3.16 s, 3.13 s, 3.10 s - The `controls()` step runs inside that ctest test, so the negative control passed on each run. - `git diff --check` -> clean AI-assisted; commands listed were executed locally.
chatgpt-codex-connector[bot commented 2026-11-25 23:02:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-25T22:48:56Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T22:51:16.652587Z 1761adc Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7176819122 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2567#issuecomment-7176819122). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-25T22:48:56Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"1761adc4e50e4d758f9d2142a9eb9ed4a77317cd","has_any_findings":false,"has_unresolved_findings":false,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-25T22:51:16.652587Z">2026-11-25T22:51:16.652587Z</relative-time> | `1761adc` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
upstream-sync closed this pull request 2026-11-26 00:00:50 +00:00
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!2559
No description provided.