gate: memory.csv and a pile-up's numbers beside the summary (D3D12-GATE-MEMORY-SERIES) #2813

Merged
TheGeogeo merged 7 commits from upstream-pr/2813 into main 2026-12-02 10:31:08 +00:00
TheGeogeo commented 2026-12-01 00:45:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-12-01T00:45:52Z.


Claimed in the coordination issue as: D3D12-GATE-MEMORY-SERIES (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7296623990)

Depends on: #2812 (this branch holds its commits and will be rebased on main once it is merged)

What and why

Testers read a memory pile-up by its slope and by the reaper's queue. The peaks of #2810 show neither, so they kept a sampler of their own beside each run. This is the third of the three memory PRs for the gate.

  • tools/game_gate.py also reads the runtime's census line. The runtime writes it with each memory line, every 5 s, in builds with diagnostics. It carries the objects let go that wait for their submissions, and the objects handed to the reaper thread and not let go yet: the reaper's queue.
  • summary writes memory.csv beside summary.json, one row per memory line. Each row has: time, private bytes, those in physical memory, the PC's memory free and left to commit, the card's video memory budget and in use, the shared memory in use, and the two queues. A run without memory lines writes no file, and a folder summarized again without them loses an older one. Each row takes the video and census lines within 2 s of its memory line (empty cells when there are none). The file is LF only.
  • The summary's memory block gets:
    • the reaper queue at its longest, and when;
    • the most objects waiting for their submissions;
    • the least-squares slope of the private bytes from the world's start to the stop request, in MB a minute (null with fewer than 3 lines there). On a short run the slope is the loading's climb; on a long one, a pile-up's.
    • series, the file's name, or null when the file could not be written (for example open in another program): the summary is written all the same.
  • The census strings join the contract test (one key spans the part the parser reads, after #2826 lengthened that sentence). docs/game_gate.md describes the file, its header, how its columns are picked, the new fields, and that the summary's video memory peak counts every video memory line (the swap chain's and the budget changes' too), so it can come from a line with no CSV row.

Tested

On Windows 11 Pro 10.0, rebased on main 8422def75:

  • tests/test_game_gate.py: 35 tests OK. The new ones fail with #2812's parser. They cover:
    • a synthetic run whose private bytes grow 10 MB every 5 s in the world gives a slope of exactly 120 MB a minute;
    • the reaper queue's peak and its time;
    • summary writes 76 rows with the right columns and last values;
    • a build without memory lines gives no series and nulls, and writes no file;
    • since the review: an older memory.csv is removed when the log has no memory lines; the summary is written when memory.csv cannot be; the CSV has no CR; the 2 s window and empty cells; the slope stops at the stop request.
  • The docs tests, test_tool_stdout_encoding.py and scripts/check_no_game_data.py on the changed files are clean.
  • On a real run, I re-summarized a copy of a 124 s gate run (RTX 3080 10 GB, driver 32.0.16.2140, Series S profile). The result:
    • 37 rows, every column filled;
    • the reaper queue at most 1,018 (at 108 s), then 0;
    • the objects waiting for their submissions at most 6,991;
    • private bytes from 8,511 to 23,687 MB, a slope of 450 MB a minute in the world, which is the loading's climb on a run this short;
    • the PC had down to 477 MB left to commit.

GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 32.0.16.2140

AI-assisted: yes. Claude Code (Claude Fable 5.2 and Claude Opus 5.5); a separate Claude Opus 5.5 agent reviewed the diff before this push.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5576565839 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2813). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-12-01T00:45:52Z. --- Claimed in the coordination issue as: D3D12-GATE-MEMORY-SERIES (https://github.com/ProjectLeonida/mandy/issues/2570#issuecomment-7296623990) Depends on: #2812 (this branch holds its commits and will be rebased on `main` once it is merged) ### What and why Testers read a memory pile-up by its slope and by the reaper's queue. The peaks of #2810 show neither, so they kept a sampler of their own beside each run. This is the third of the three memory PRs for the gate. - `tools/game_gate.py` also reads the runtime's census line. The runtime writes it with each memory line, every 5 s, in builds with diagnostics. It carries the objects let go that wait for their submissions, and the objects handed to the reaper thread and not let go yet: the reaper's queue. - `summary` writes `memory.csv` beside `summary.json`, one row per memory line. Each row has: time, private bytes, those in physical memory, the PC's memory free and left to commit, the card's video memory budget and in use, the shared memory in use, and the two queues. A run without memory lines writes no file, and a folder summarized again without them loses an older one. Each row takes the video and census lines within 2 s of its memory line (empty cells when there are none). The file is LF only. - The summary's `memory` block gets: - the reaper queue at its longest, and when; - the most objects waiting for their submissions; - the least-squares slope of the private bytes from the world's start to the stop request, in MB a minute (null with fewer than 3 lines there). On a short run the slope is the loading's climb; on a long one, a pile-up's. - `series`, the file's name, or null when the file could not be written (for example open in another program): the summary is written all the same. - The census strings join the contract test (one key spans the part the parser reads, after #2826 lengthened that sentence). `docs/game_gate.md` describes the file, its header, how its columns are picked, the new fields, and that the summary's video memory peak counts every video memory line (the swap chain's and the budget changes' too), so it can come from a line with no CSV row. ### Tested On Windows 11 Pro 10.0, rebased on `main` 8422def75: - `tests/test_game_gate.py`: 35 tests OK. The new ones fail with #2812's parser. They cover: - a synthetic run whose private bytes grow 10 MB every 5 s in the world gives a slope of exactly 120 MB a minute; - the reaper queue's peak and its time; - `summary` writes 76 rows with the right columns and last values; - a build without memory lines gives no series and nulls, and writes no file; - since the review: an older `memory.csv` is removed when the log has no memory lines; the summary is written when `memory.csv` cannot be; the CSV has no CR; the 2 s window and empty cells; the slope stops at the stop request. - The docs tests, `test_tool_stdout_encoding.py` and `scripts/check_no_game_data.py` on the changed files are clean. - On a real run, I re-summarized a copy of a 124 s gate run (RTX 3080 10 GB, driver 32.0.16.2140, Series S profile). The result: - 37 rows, every column filled; - the reaper queue at most 1,018 (at 108 s), then 0; - the objects waiting for their submissions at most 6,991; - private bytes from 8,511 to 23,687 MB, a slope of 450 MB a minute in the world, which is the loading's climb on a run this short; - the PC had down to 477 MB left to commit. GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 32.0.16.2140 AI-assisted: yes. Claude Code (Claude Fable 5.2 and Claude Opus 5.5); a separate Claude Opus 5.5 agent reviewed the diff before this push. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change)
OreoFR commented 2026-12-01 00:51:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-12-01T00:51:23Z.


Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12, head c67a2b69f, main d920d850d. CPU only, no game. This branch contains #2812 5323dfa69 (and #2810), so red is #2812 + this PR's tests.

MEASURED

  • Red (#2812 5323dfa69 + only this PR's tests/test_game_gate.py): 2 failed, 25 passed. The failures are test_the_memory_series_and_a_pile_ups_slope (new) and test_a_build_without_memory_lines_gives_no_memory_peaks (extended here).
  • Green (main + this PR, merge-tree): 27 passed. No conflict.

READ IN CODE

  • The census phrase the new WAITS regex reads exists on main where SOURCES says: memory, what waits to be let go: {waiting} objects … (LEONIDA_BURY_LAG), {handed} retired objects, landed host lists and lists' fronts handed to the thread that lets them go at leonida-gpu/src/census.rs:343-344, logged from copystat.rs:757 (crate::census::log();).
  • memory.csv joins each memory line with the video and census lines within 2 s (near()). slope_per_min is an ordinary least-squares slope, None under 3 points or with no time spread.
  • Heads-up: enlighted's reaper branch (54dc3209f, not a PR yet) edits census.rs around that same line (it adds the LEONIDA_REAPER_LIMIT part). If that changes this sentence, your contract test will catch it, which is what it's there for; whichever lands second adjusts.

ASSUMED

  • Your RTX 3080 run (37 rows, reaper queue max 1,018 at 108 s) is not reproduced here.

AI-assisted: Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7296818029 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2813#issuecomment-7296818029). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-12-01T00:51:23Z. --- Verified by OreoFR on macOS 27.2.1, Apple M5, Python 3.12, head `c67a2b69f`, main `d920d850d`. CPU only, no game. This branch contains #2812 `5323dfa69` (and #2810), so red is #2812 + this PR's tests. **MEASURED** - Red (#2812 `5323dfa69` + only this PR's `tests/test_game_gate.py`): 2 failed, 25 passed. The failures are `test_the_memory_series_and_a_pile_ups_slope` (new) and `test_a_build_without_memory_lines_gives_no_memory_peaks` (extended here). - Green (main + this PR, merge-tree): 27 passed. No conflict. **READ IN CODE** - The census phrase the new `WAITS` regex reads exists on main where `SOURCES` says: `memory, what waits to be let go: {waiting} objects … (LEONIDA_BURY_LAG), {handed} retired objects, landed host lists and lists' fronts handed to the thread that lets them go` at `leonida-gpu/src/census.rs:343-344`, logged from `copystat.rs:757` (`crate::census::log();`). - `memory.csv` joins each memory line with the video and census lines within 2 s (`near()`). `slope_per_min` is an ordinary least-squares slope, `None` under 3 points or with no time spread. - Heads-up: enlighted's reaper branch (`54dc3209f`, not a PR yet) edits `census.rs` around that same line (it adds the `LEONIDA_REAPER_LIMIT` part). If that changes this sentence, your contract test will catch it, which is what it's there for; whichever lands second adjusts. **ASSUMED** - Your RTX 3080 run (37 rows, reaper queue max 1,018 at 108 s) is not reproduced here. AI-assisted: Claude Code
fiestorra commented 2026-12-01 01:21:24 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-01T01:21:24Z.


Verified on Windows with the control: the suite fails when tools/game_gate.py is put back to main.

Cherry-picked onto main d920d850d, Python 3.13.14, no GPU and no game data:

python -m pytest tests/test_game_gate.py -q with this pull request: 27 passed in 3.85 s with tools/game_gate.py from main: 5 failed, 22 passed

So the new cases are tied to the new code and not to fixtures the file already had. They add to the same suite that #2805, #2804 and #2810 touch, and all five together are consistent - I have now run every one of them.

It applies on main on its own and on top of #2812, so either order works; #2812 then #2813 needs no rebase.

What I could not test: the PowerShell side (scripts/game-gate.ps1, 28 lines changed here). That path drives a real run folder, and this machine has the game but not the gate harness the reports describe - the Python parser and its summary are what the tests cover, and they are green.

AI-assisted: yes - DeepSeek v4.1 (flash), applied and ran both arms on the machine above.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7297405135 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2813#issuecomment-7297405135). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-01T01:21:24Z. --- **Verified on Windows with the control: the suite fails when `tools/game_gate.py` is put back to `main`.** **Cherry-picked onto `main` `d920d850d`, Python 3.13.14, no GPU and no game data:** ` python -m pytest tests/test_game_gate.py -q with this pull request: 27 passed in 3.85 s with tools/game_gate.py from main: 5 failed, 22 passed ` **So the new cases are tied to the new code and not to fixtures the file already had.** **They add to the same suite that #2805, #2804 and #2810 touch, and all five together are consistent - I have now run every one of them.** **It applies on `main` on its own and on top of #2812**, so either order works; #2812 then #2813 needs no rebase. **What I could not test:** **the PowerShell side** (`scripts/game-gate.ps1`, 28 lines changed here). **That path drives a real run folder, and this machine has the game but not the gate harness the reports describe** - **the Python parser and its summary are what the tests cover, and they are green.** **AI-assisted:** yes - DeepSeek v4.1 (flash), applied and ran both arms on the machine above. Written with an AI assistant.
KelboLive commented 2026-12-01 04:37:04 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T04:37:04Z.

Review: COMMENTED


Tested on Windows / Python 3.12; python -I tests/test_game_gate.py is 27 tests, OK. A synthetic 8-sample run gives one row per memory line with the documented header (70.0,1000,500,15000,4000,8000,7000,500,0,0), LF only and no BOM, every column equal to the log's integer MB with no rescale, and the summary's private_max, reaper_queue_max / _at_s, waiting_objects_max, vram_in_use_max all equal the CSV maxima; the slope recomputes from the CSV (600.0 vs 600.0 on mine). A one-sample run gives one row and slope: null with no division, and a run without memory lines writes no memory.csv.

Two things before merge, both documentation-truth:

  1. docs/game_gate.md:105 still lists "A time series beside the summary (memory, census, reaping queue)" under ## Not in this version, which is exactly what this PR adds; :107 ("VRAM and RAM peaks") is stale from #2810. No test reads that list, so CI will not catch it.
  2. summary.memory.vram_in_use_max_mb counts every video line (tools/game_gate.py:457), including the swap-chain ones (host.rs:13100, :13485, :13607), while memory.csv samples only the video line nearest each memory row (:410). A verifier can see a peak in summary.json with no matching row — I reproduced it (CSV cell empty, summary 7777). Document the distinction or emit the peak's sample row.

Minor: write_series (:419-423) returns before unlinking an existing memory.csv, so re-summarizing a folder whose log lost its memory lines leaves series: null beside stale rows; and the test at tests/test_game_gate.py:322-328 only asserts the summary side of "no memory lines gives no series", never that no file is written (it calls summary(), not main()). Docs also omit reaper_queue_max_at_s / waiting_objects_max from the field table and never list the CSV header.

Merge picture: this branch already contains #2810 and #2812, and every order of the three merges cleanly on 86c30fcea with identical final trees and additive summary.json keys. Landing order I would use is #2810 -> #2812 -> #2813.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6125176242 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2813#pullrequestreview-6125176242). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-12-01T04:37:04Z. **Review:** COMMENTED --- Tested on Windows / Python 3.12; `python -I tests/test_game_gate.py` is 27 tests, OK. A synthetic 8-sample run gives one row per memory line with the documented header (`70.0,1000,500,15000,4000,8000,7000,500,0,0`), LF only and no BOM, every column equal to the log's integer MB with no rescale, and the summary's `private_max`, `reaper_queue_max` / `_at_s`, `waiting_objects_max`, `vram_in_use_max` all equal the CSV maxima; the slope recomputes from the CSV (600.0 vs 600.0 on mine). A one-sample run gives one row and `slope: null` with no division, and a run without memory lines writes no `memory.csv`. Two things before merge, both documentation-truth: 1. `docs/game_gate.md:105` still lists **"A time series beside the summary (memory, census, reaping queue)"** under `## Not in this version`, which is exactly what this PR adds; `:107` ("VRAM and RAM peaks") is stale from #2810. No test reads that list, so CI will not catch it. 2. `summary.memory.vram_in_use_max_mb` counts **every** video line (`tools/game_gate.py:457`), including the swap-chain ones (`host.rs:13100`, `:13485`, `:13607`), while `memory.csv` samples only the video line nearest each memory row (`:410`). A verifier can see a peak in `summary.json` with no matching row — I reproduced it (CSV cell empty, summary 7777). Document the distinction or emit the peak's sample row. Minor: `write_series` (`:419-423`) returns before unlinking an existing `memory.csv`, so re-summarizing a folder whose log lost its memory lines leaves `series: null` beside stale rows; and the test at `tests/test_game_gate.py:322-328` only asserts the summary side of "no memory lines gives no series", never that no file is written (it calls `summary()`, not `main()`). Docs also omit `reaper_queue_max_at_s` / `waiting_objects_max` from the field table and never list the CSV header. Merge picture: this branch already contains #2810 and #2812, and every order of the three merges cleanly on `86c30fcea` with identical final trees and additive `summary.json` keys. Landing order I would use is **#2810 -> #2812 -> #2813**.
TheGeogeo commented 2026-12-01 05:36:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-12-01T05:36:36Z.


Thanks @KelboLive. Confirmed: write_series (tools/game_gate.py:419-423) returns before touching an existing memory.csv, so a folder summarized again after its log lost its memory lines keeps stale rows beside series: null.

To keep this verified head unchanged, I will fix it in a follow-up pull request after the merge: remove the old file when there are no rows, with a test for that case.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7301949211 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2813#issuecomment-7301949211). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-12-01T05:36:36Z. --- Thanks @KelboLive. Confirmed: `write_series` (`tools/game_gate.py:419-423`) returns before touching an existing `memory.csv`, so a folder summarized again after its log lost its memory lines keeps stale rows beside `series: null`. To keep this verified head unchanged, I will fix it in a follow-up pull request after the merge: remove the old file when there are no rows, with a test for that case.
TheGeogeo commented 2026-12-02 03:44:43 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-12-02T03:44:43Z.


Rebased on main 8422def75, on top of #2812's new head (head 0e5ebd0c6). @KelboLive's points are fixed here rather than in a follow-up, since the merge has not happened:

  1. "Not in this version" no longer lists the time series or the VRAM and RAM peaks.
  2. The docs say the summary's video memory peak counts every video memory line, including those around the swap chain, its buffers made again and a budget change of 256 MB or more. So the peak can come from a line with no CSV row.
  3. write_series removes an older memory.csv when the log has no memory lines. Two tests go through main(); with the old early return they fail.
  4. The docs list the CSV header, how its video and census columns are picked (within 2 s, an empty cell otherwise), reaper_queue_max_at_s and waiting_objects_max.

Also from a second review:

  • summary.json is written even when memory.csv cannot be (for example, open in another program). In that case series is null and stderr says why.
  • The CSV is asserted LF only.
  • The 2 s window and its empty cells are tested.
  • The slope stops at the stop request.
  • The census contract is one key spanning the part the parser reads, after #2826 lengthened that sentence.

tests/test_game_gate.py: 35 OK.

AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5; a separate Claude Opus 5.5 agent reviewed the diff before this push).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7334195655 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2813#issuecomment-7334195655). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-12-02T03:44:43Z. --- Rebased on `main` 8422def75, on top of #2812's new head (head 0e5ebd0c6). @KelboLive's points are fixed here rather than in a follow-up, since the merge has not happened: 1. "Not in this version" no longer lists the time series or the VRAM and RAM peaks. 2. The docs say the summary's video memory peak counts every video memory line, including those around the swap chain, its buffers made again and a budget change of 256 MB or more. So the peak can come from a line with no CSV row. 3. `write_series` removes an older `memory.csv` when the log has no memory lines. Two tests go through `main()`; with the old early return they fail. 4. The docs list the CSV header, how its video and census columns are picked (within 2 s, an empty cell otherwise), `reaper_queue_max_at_s` and `waiting_objects_max`. Also from a second review: - `summary.json` is written even when `memory.csv` cannot be (for example, open in another program). In that case `series` is null and stderr says why. - The CSV is asserted LF only. - The 2 s window and its empty cells are tested. - The slope stops at the stop request. - The census contract is one key spanning the part the parser reads, after #2826 lengthened that sentence. `tests/test_game_gate.py`: 35 OK. AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5; a separate Claude Opus 5.5 agent reviewed the diff before this push).
imShangLi commented 2026-12-02 09:01:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by imShangLi on 2026-12-02T09:01:17Z.


VERIFY-2813 — Linux, Fedora 45, Python 3.15.2, no PowerShell 7 (no pwsh), no GPU device, no game files

Verdict: PASS. The change adds memory.csv beside summary.json (one row per runtime memory line, with the video and census lines joined within 2 s), the census-derived peaks (the reaper's queue at its longest, the most objects waiting for their submissions), the least-squares slope of the private bytes over the world up to the stop request, and a series field that names the file only when it was written. It fixes the two documentation-truth and the one minor point KelboLive raised (the stale "Not in this version" list, the peak-from-a-line-with-no-row distinction, and write_series leaving an old memory.csv), and it is honest about the one real asymmetry: the summary's video peak counts every video line while the CSV has only the one nearest each memory line, so the peak can come from a line with no row. The six tests that exercise the series/slope/census code fail on the #2812 head (the proper red for this PR's own contribution) with exactly the missing-field assertions and pass on the head; the repository's red/green verifier reports red→green with 0 regressions; and I reproduced the peak-with-no-CSV-row case with the real parser, confirming the docs' claim.

This is the third of the three gate memory PRs and is stacked on #2812 (Depends on: #2812; the branch holds #2812's four commits, so its diff against the merge base includes them). I reviewed this PR's own contribution — the three commits 7150b7fe..0e5ebd0c on top of #2812 — and verified that #2813's own tests fail on #2812's code. The GitHub diff +416/−23 (4 files) includes #2812's +211/−15; the contribution proper is 3 files, +207/−10: tools/game_gate.py (+90), tests/test_game_gate.py (+122), docs/game_gate.md (+5/−1). scripts/game-gate.ps1 is not touched by #2813.

head 0e5ebd0c697d ("gate: the summary even when memory.csv cannot be written, the slope up to the stop (review)"), branch d3d12-gate-memory-series; base origin/main = a917c54d6aff (fetched by the red/green verifier during this review), merge base 8422def759cda12c89f918438eeb8d53dd5972a6 (7 commits: #2812's 4 + this PR's 3). mergeable_state is clean; fiestorra and KelboLive confirm the merge order is #2812 then #2813 and that #2813 cherry-picks over #2812.

1. What it changes

  • The census line (tools/game_gate.py:57-59, :143, :176): a WAITS regex for the runtime's memory, what waits to be let go: {waiting} objects ... (LEONIDA_BURY_LAG), {handed} retired objects ... handed to the thread that lets them go line, parsed into run.waits as (t, waiting, reaper_queue).
  • memory.csv (tools/game_gate.py:60-61, :400-437): SERIES_COLUMNS is t_s,private_mb,in_memory_mb,pc_free_mb,pc_commit_left_mb,vram_budget_mb,vram_in_use_mb,shared_in_use_mb,waiting_objects,reaper_queue. memory_rows(run) makes one row per memory line; near(rows, t, 2.0) joins the video line and the census line nearest each memory line, within 2 s, empty cell otherwise. write_series(run, folder) writes memory.csv (LF only, csv.DictWriter(..., lineterminator="\n") on a newline="" file), removes an older memory.csv when the log has no memory lines, and on an OSError (e.g. the file is open elsewhere) prints memory.csv not written or removed: ... to stderr and returns None — the summary is written all the same.
  • The new memory fields (tools/game_gate.py:440-460, :586): reaper_queue_max/reaper_queue_max_at_s (the census line's second number at its longest), waiting_objects_max (the first number's most), private_mb_per_min_in_world (a least-squares slope, slope_per_min :388-397, over the memory lines world <= t <= end, None under 3 lines or with no time spread), and series (set to SERIES in memory_block, then overwritten in main() by the actual write_series result :586). The slope stops at the stop request because end is the stop (summary passes world, end to memory_block at :556).
  • The contract test keys (tools/game_gate.py:90-92): one key spanning the whole part WAITS reads (the , between its two numbers included), and crate::census::log(); in copystat.rs.
  • Docs (docs/game_gate.md): memory.csv in the run-folder table, the header, how the video/census columns are picked (within 2 s, empty cell otherwise), the new memory fields, that the summary's video peak counts every video line (so it can come from a line with no CSV row), and the two "Not in this version" entries removed.

2. The claims, checked one by one

  • "tools/game_gate.py also reads the runtime's census line" — the WAITS regex is anchored on the prefix and parses the two numbers; read_log matches text.startswith("memory, what waits to be let go") before the pipeline-wait check (:175). The line the parser reads exists in the runtime: d3d12/crates/leonida-gpu/src/census.rs:343-344 prints exactly memory, what waits to be let go: {waiting} objects let go that wait for the submissions that may use them (LEONIDA_BURY_LAG), {handed} retired objects, landed host lists and lists' fronts handed to the thread that lets them go ..., and it is logged beside the memory line from copystat.rs:762 (crate::census::log();), after log_video_memory("with the memory line") at :757. The contract test's two new keys match those two sites, and the test passes.
  • "It carries the objects let go that wait for their submissions, and the objects handed to the reaper thread and not let go yet: the reaper's queue" — the regex's first number is the {waiting} objects, the second the {handed} (retired) objects; memory_rows puts them in waiting_objects and reaper_queue (:414-415). The census source's wording (handed to the thread that lets them go and not let go yet) is the reaper's queue; the parser reads only up to lets them go, so the extra clause does not break it.
  • "summary writes memory.csv beside summary.json, one row per memory line" — main() calls write_series (:586) before writing summary.json. test_the_memory_series_and_a_pile_ups_slope runs game_gate.main on a synthetic folder and reads back 76 rows (one per memory line: range(10, 390, 5)), the header exactly SERIES_COLUMNS, last row private_mb == "20630", reaper_queue == "6300", vram_in_use_mb == "7000".
  • "A run without memory lines writes no file, and a folder summarized again without them loses an older one" — write_series returns early after os.remove(path) when there are no rows (:425-429); test_a_build_without_memory_lines_gives_no_memory_peaks (now extended to go through main()) asserts no memory.csv appears, and test_a_folder_summarized_again_without_memory_lines_keeps_no_old_series writes a stale memory.csv, re-summarizes a log with no memory lines, and asserts the file is gone and series is null. (KelboLive's point 3 is fixed here — write_series no longer returns before unlinking.)
  • "Each row takes the video and census lines within 2 s of its memory line (empty cells when there are none)" — near() (:400-403) picks the nearest and drops it when farther than 2.0 s; test_the_series_takes_the_lines_within_2_s_of_each_memory_line places a video line 2 s before a memory line (taken), a census line 2.5 s after (empty cells), and a memory line alone (all empty), and reads back exactly the expected cells.
  • "The file is LF only" — open(path, "w", encoding="utf-8", newline="") with lineterminator="\n"; test_the_memory_series_and_a_pile_ups_slope asserts b"\r" not in the file. tests/test_text_write_line_endings.py accepts newline="" (its docstring allows it "when the text carries its own line ends"), and it passes (3 OK).
  • "the reaper queue at its longest, and when; the most objects waiting for their submissions" — memory_block takes max((w[0], w[2]) for w in run.waits) for the queue (:450-451) and max(w[1] for w in run.waits) for the waiting objects (:452). test_the_memory_series_and_a_pile_ups_slope asserts (reaper_queue_max, reaper_queue_max_at_s) == (100·63, 385.0) and waiting_objects_max == 3.
  • "the least-squares slope of the private bytes from the world's start to the stop request, in MB a minute (null with fewer than 3 lines there)" — slope_per_min is ordinary least squares, None under 3 points or spread == 0 (:388-397); the window is world <= t <= end (:453-455). test_the_memory_series_and_a_pile_ups_slope (10 MB per 5 s = 2 MB/s = exactly 120.0 MB/min) and test_the_slope_counts_the_world_up_to_the_stop (120.0, with a jump after the stop request at 390 s that is excluded; and 2 in-world lines → None). The "no division" case from KelboLive (a one-sample run) is covered by the < 3 guard.
  • "series, the file's name, or null when the file could not be written ... the summary is written all the same" — main() sets out["memory"]["series"] = write_series(...) (:586); test_a_series_it_cannot_write_still_leaves_the_summary makes memory.csv a directory so the write raises, and asserts exit 0, verdict.result == "PASS", series is None, lines == 64, and memory.csv not written or removed on stderr.
  • "The census strings join the contract test (one key spans the part the parser reads, after #2826 lengthened that sentence)" — the key memory, what waits to be let go: {waiting} objects ... {handed} retired objects ... handed to the thread that lets them go is a single SOURCES entry (the , between the two numbers included), and test_the_runtime_still_writes_what_the_parser_reads (which strips Rust \-continued lines) matches it against census.rs:343-344; the key crate::census::log(); matches copystat.rs:762. Both pass.
  • "the summary's video memory peak counts every video memory line ... so it can come from a line with no CSV row" — memory_block's vram_in_use_max_mb/vram_over_budget_s use all of run.video (:462-466), and run.video holds every video memory as the system counts it, ... line because the VIDEO regex's [^:]* accepts any reason. The runtime writes such lines with the memory line (copystat.rs:757), right before and after the swap chain is made (host.rs:14210, :14259), right after the swap chain's buffers are made again for another size or format (:13875), and right after the system changes the card's budget — gated on a move of >= (256u64 << 20) = 256 MB (:14372, logged at :14381). memory.csv samples only the one nearest each memory line. I reproduced the consequence with the real parser: a swap-chain video line with 9999 MB in use at 90 s and a memory line at 100 s gives summary.memory.vram_in_use_max_mb == 9999 but the memory.csv row at 100 s has vram_in_use_mb == "7000" — the peak has no row. The docs say exactly this, so the claim is truthful.
  • "On a short run the slope is the loading's climb; on a long one, a pile-up's" — this is the intended reading of private_mb_per_min_in_world over the in-world window; it is a heuristic reading, and the description labels it as such. (The author's real-run slope of 450 MB/min over a 124 s run is consistent with a front-loaded climb — most of the 8,511→23,687 MB growth before the world, then a flatter in-world tail — which is what a least-squares slope over the world would show; but this is the author's measurement, not one I could repeat, see §6.)
  • "The description is current" — the Depends on: #2812 note, the three-of-three framing, and the "Not in this version" removals all match the code; KelboLive's two doc points (the stale time-series/peaks list and the peak-vs-row distinction) are addressed.

3. The new tests and what they do

Five tests are added and one extended. Against #2812's head (the precise red for this PR's own contribution — merge base + #2812 + #2813's test hunks) they fail with exactly the missing-field assertions; against the head they pass:

  • test_the_memory_series_and_a_pile_ups_slope (tests/test_game_gate.py:310-334) — the slope (120.0), the reaper peak and its time, the waiting max, series == "memory.csv", then through main() 76 CSV rows, the header, the last row's values, and LF only. On the #2812 head it fails as KeyError: 'private_mb_per_min_in_world'.
  • test_the_series_takes_the_lines_within_2_s_of_each_memory_line (:336-361) — the 2 s window and empty cells; fails on the #2812 head (no write_series).
  • test_the_slope_counts_the_world_up_to_the_stop (:363-379) — 120.0 with a post-stop jump excluded, and None with 2 in-world lines; fails on the #2812 head as KeyError: 'private_mb_per_min_in_world'.
  • test_a_series_it_cannot_write_still_leaves_the_summary (:381-394) — a directory at memory.csv makes the write fail; exit 0, series null, lines 64, the stderr message; fails on the #2812 head as KeyError: 'series'.
  • test_a_folder_summarized_again_without_memory_lines_keeps_no_old_series (:419-431) — the stale-file removal; fails on the #2812 head as KeyError: 'series'.
  • test_a_build_without_memory_lines_gives_no_memory_peaks (extended, :396-417) — now also asserts series/reaper_queue_max/private_mb_per_min_in_world are null and, through main(), that no file is written; fails on the #2812 head as KeyError: 'series'.

4. What the tests do here (measured)

The repository's own red/green verifier, python3 -I scripts/red_green.py 2813 --work-dir /home/shangli/oc-workspace/gta6/rg-2813:

side commit test file result regressions
red merge base 8422def7 + the PR's test hunks, on main a917c54d tests/test_game_gate.py 4 + 6 of the feature's tests failed (the six #2813 tests and, because the red side has neither PR's code, the #2812 memory tests too); 24 ok, 1 ignored —
green PR head 0e5ebd0c6 tests/test_game_gate.py all ok (the pwsh poll test is ignored here — no PowerShell) 0

The tool's verdict: "red then green" — 9 red→green, 24 pass on both, 0 regressions, 0 fail on both. Because the red side is the merge base (which lacks #2812's code too), the #2812 tests also appear red→green; the red side for this PR's own contribution is #2812's head, where I separately confirmed the six #2813 tests fail with the missing-field messages above and the other 29 pass (35 tests, 2 pwsh skips). On the head itself: python3 -I tests/test_game_gate.py → 35 tests, OK (2 skipped); python3 -I -m unittest discover -s tests -p "test_docs_*.py" → 57 tests, OK; tests/test_text_write_line_endings.py → 3 OK; tests/test_tool_stdout_encoding.py → 4 OK; python3 -I scripts/check_no_game_data.py <the changed files> → clean (exit 0); python3 -m compileall -q tools tests → clean.

5. Anything wrong

One observation worth stating, not a defect of the change:

  • summary() reports series: "memory.csv" before the file exists. memory_block sets out["series"] = SERIES whenever there are memory lines (tools/game_gate.py:457), but only main() writes the file (:586, which overwrites series with the real write_series result). A caller that uses summary() directly (as the tests do) gets series == "memory.csv" with no file on disk, and only main() reconciles it (to the name on success, to null on failure). The gate CLI always goes through main(), so summary.json on disk is always truthful; this is a mild API wart, not a user-facing bug, and test_the_memory_series_and_a_pile_ups_slope encodes it (it asserts m["series"] from summarize() before main() is called).

KelboLive's three points are all resolved: the "Not in this version" list no longer names the time series or the VRAM/RAM peaks (docs/game_gate.md); the peak-vs-row distinction is documented and I reproduced it; write_series removes an old memory.csv (and there are two tests through main()).

6. What I did not check

  • The author's real-run numbers (37 rows all filled, reaper queue 1,018 at 108 s then 0, waiting objects 6,991, private 8,511→23,687 MB, slope 450 MB/min, PC down to 477 MB left to commit) are from a re-summarized copy of a 124 s RTX 3080 run on Windows — I could not reproduce them (no Windows, no GPU, no game files, no run folder), and I only checked them for internal consistency (the 450 MB/min slope over a ~1-2 min in-world window with a front-loaded 15 GB climb is plausible, not self-contradictory).
  • No PowerShell, no Windows. The census.rs/copystat.rs/host.rs sites I quote are read from the source at the PR head; the runtime was not built or run, so the census line's live cadence (every 5 s, diagnostics builds only) and its exact numbers are the author's and OreoFR's observations, not mine.
  • The WAITS regex against the live census line. I matched it to census.rs:343-344 textually and to the synthetic line the test writes, but I did not see a real line from a real run, so I could not check a reworded or differently-punctuated live line; the contract test is what guards this.
  • The cost of memory_rows/write_series. near() is a linear scan per memory row (O(n·m) overall); the summary runs once at the end, so this is not a hot path, but I did not measure it on a multi-hour run with tens of thousands of lines.
  • The interaction with #2812's memory.csv and the memory_stop limits. The two PRs are separate; I verified #2813 applies on top of #2812 and that its own tests fail on #2812, but I did not build the merged tree (the author and fiestorra did — "every order of the three merges cleanly", #2812 then #2813).
  • The PR's coordination-issue thread (issue #2570) was not read beyond what the description links; I read the pull request, its description, and every comment/review on it via the GitHub API.
  • The #2826 reference ("after #2826 lengthened that sentence") — I did not read #2826; I verified the contract key against the current census.rs directly, which is the property that matters.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7340253260 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2813#issuecomment-7340253260). Originally posted by [imShangLi](https://github.com/imShangLi) on 2026-12-02T09:01:17Z. --- ## VERIFY-2813 — Linux, Fedora 45, Python 3.15.2, no PowerShell 7 (no pwsh), no GPU device, no game files **Verdict: PASS.** The change adds `memory.csv` beside `summary.json` (one row per runtime memory line, with the video and census lines joined within 2 s), the census-derived peaks (the reaper's queue at its longest, the most objects waiting for their submissions), the least-squares slope of the private bytes over the world up to the stop request, and a `series` field that names the file only when it was written. It fixes the two documentation-truth and the one minor point KelboLive raised (the stale "Not in this version" list, the peak-from-a-line-with-no-row distinction, and `write_series` leaving an old `memory.csv`), and it is honest about the one real asymmetry: the summary's video peak counts every video line while the CSV has only the one nearest each memory line, so the peak can come from a line with no row. The six tests that exercise the series/slope/census code fail on the #2812 head (the proper red for this PR's own contribution) with exactly the missing-field assertions and pass on the head; the repository's red/green verifier reports red→green with 0 regressions; and I reproduced the peak-with-no-CSV-row case with the real parser, confirming the docs' claim. This is the third of the three gate memory PRs and is **stacked on #2812** (`Depends on: #2812`; the branch holds #2812's four commits, so its diff against the merge base includes them). I reviewed **this PR's own contribution** — the three commits `7150b7fe`..`0e5ebd0c` on top of #2812 — and verified that #2813's own tests fail on #2812's code. The GitHub diff `+416/−23` (4 files) includes #2812's `+211/−15`; the contribution proper is 3 files, **+207/−10**: `tools/game_gate.py` (+90), `tests/test_game_gate.py` (+122), `docs/game_gate.md` (+5/−1). `scripts/game-gate.ps1` is not touched by #2813. head `0e5ebd0c697d` ("gate: the summary even when memory.csv cannot be written, the slope up to the stop (review)"), branch `d3d12-gate-memory-series`; base `origin/main` = `a917c54d6aff` (fetched by the red/green verifier during this review), merge base `8422def759cda12c89f918438eeb8d53dd5972a6` (7 commits: #2812's 4 + this PR's 3). `mergeable_state` is `clean`; `fiestorra` and `KelboLive` confirm the merge order is #2812 then #2813 and that #2813 cherry-picks over #2812. ### 1. What it changes - **The census line** (`tools/game_gate.py:57-59`, `:143`, `:176`): a `WAITS` regex for the runtime's `memory, what waits to be let go: {waiting} objects ... (LEONIDA_BURY_LAG), {handed} retired objects ... handed to the thread that lets them go` line, parsed into `run.waits` as `(t, waiting, reaper_queue)`. - **`memory.csv`** (`tools/game_gate.py:60-61`, `:400-437`): `SERIES_COLUMNS` is `t_s,private_mb,in_memory_mb,pc_free_mb,pc_commit_left_mb,vram_budget_mb,vram_in_use_mb,shared_in_use_mb,waiting_objects,reaper_queue`. `memory_rows(run)` makes one row per memory line; `near(rows, t, 2.0)` joins the video line and the census line nearest each memory line, within 2 s, empty cell otherwise. `write_series(run, folder)` writes `memory.csv` (LF only, `csv.DictWriter(..., lineterminator="\n")` on a `newline=""` file), **removes** an older `memory.csv` when the log has no memory lines, and on an `OSError` (e.g. the file is open elsewhere) prints `memory.csv not written or removed: ...` to stderr and returns `None` — the summary is written all the same. - **The new `memory` fields** (`tools/game_gate.py:440-460`, `:586`): `reaper_queue_max`/`reaper_queue_max_at_s` (the census line's second number at its longest), `waiting_objects_max` (the first number's most), `private_mb_per_min_in_world` (a least-squares slope, `slope_per_min` `:388-397`, over the memory lines `world <= t <= end`, `None` under 3 lines or with no time spread), and `series` (set to `SERIES` in `memory_block`, then overwritten in `main()` by the actual `write_series` result `:586`). The slope stops at the stop request because `end` is the stop (`summary` passes `world, end` to `memory_block` at `:556`). - **The contract test keys** (`tools/game_gate.py:90-92`): one key spanning the whole part `WAITS` reads (the `, ` between its two numbers included), and `crate::census::log();` in `copystat.rs`. - **Docs** (`docs/game_gate.md`): `memory.csv` in the run-folder table, the header, how the video/census columns are picked (within 2 s, empty cell otherwise), the new `memory` fields, that the summary's video peak counts every video line (so it can come from a line with no CSV row), and the two "Not in this version" entries removed. ### 2. The claims, checked one by one - **"`tools/game_gate.py` also reads the runtime's census line"** — the `WAITS` regex is anchored on the prefix and parses the two numbers; `read_log` matches `text.startswith("memory, what waits to be let go")` before the pipeline-wait check (`:175`). The line the parser reads exists in the runtime: `d3d12/crates/leonida-gpu/src/census.rs:343-344` prints exactly `memory, what waits to be let go: {waiting} objects let go that wait for the submissions that may use them (LEONIDA_BURY_LAG), {handed} retired objects, landed host lists and lists' fronts handed to the thread that lets them go ...`, and it is logged beside the memory line from `copystat.rs:762` (`crate::census::log();`), after `log_video_memory("with the memory line")` at `:757`. The contract test's two new keys match those two sites, and the test passes. - **"It carries the objects let go that wait for their submissions, and the objects handed to the reaper thread and not let go yet: the reaper's queue"** — the regex's first number is the `{waiting}` objects, the second the `{handed}` (retired) objects; `memory_rows` puts them in `waiting_objects` and `reaper_queue` (`:414-415`). The census source's wording (`handed to the thread that lets them go and not let go yet`) is the reaper's queue; the parser reads only up to `lets them go`, so the extra clause does not break it. - **"`summary` writes `memory.csv` beside `summary.json`, one row per memory line"** — `main()` calls `write_series` (`:586`) before writing `summary.json`. `test_the_memory_series_and_a_pile_ups_slope` runs `game_gate.main` on a synthetic folder and reads back 76 rows (one per memory line: `range(10, 390, 5)`), the header exactly `SERIES_COLUMNS`, last row `private_mb == "20630"`, `reaper_queue == "6300"`, `vram_in_use_mb == "7000"`. - **"A run without memory lines writes no file, and a folder summarized again without them loses an older one"** — `write_series` returns early after `os.remove(path)` when there are no rows (`:425-429`); `test_a_build_without_memory_lines_gives_no_memory_peaks` (now extended to go through `main()`) asserts no `memory.csv` appears, and `test_a_folder_summarized_again_without_memory_lines_keeps_no_old_series` writes a stale `memory.csv`, re-summarizes a log with no memory lines, and asserts the file is gone and `series` is null. (KelboLive's point 3 is fixed here — `write_series` no longer returns before unlinking.) - **"Each row takes the video and census lines within 2 s of its memory line (empty cells when there are none)"** — `near()` (`:400-403`) picks the nearest and drops it when farther than 2.0 s; `test_the_series_takes_the_lines_within_2_s_of_each_memory_line` places a video line 2 s before a memory line (taken), a census line 2.5 s after (empty cells), and a memory line alone (all empty), and reads back exactly the expected cells. - **"The file is LF only"** — `open(path, "w", encoding="utf-8", newline="")` with `lineterminator="\n"`; `test_the_memory_series_and_a_pile_ups_slope` asserts `b"\r" not in` the file. `tests/test_text_write_line_endings.py` accepts `newline=""` (its docstring allows it "when the text carries its own line ends"), and it passes (3 OK). - **"the reaper queue at its longest, and when; the most objects waiting for their submissions"** — `memory_block` takes `max((w[0], w[2]) for w in run.waits)` for the queue (`:450-451`) and `max(w[1] for w in run.waits)` for the waiting objects (`:452`). `test_the_memory_series_and_a_pile_ups_slope` asserts `(reaper_queue_max, reaper_queue_max_at_s) == (100·63, 385.0)` and `waiting_objects_max == 3`. - **"the least-squares slope of the private bytes from the world's start to the stop request, in MB a minute (null with fewer than 3 lines there)"** — `slope_per_min` is ordinary least squares, `None` under 3 points or `spread == 0` (`:388-397`); the window is `world <= t <= end` (`:453-455`). `test_the_memory_series_and_a_pile_ups_slope` (10 MB per 5 s = 2 MB/s = **exactly 120.0** MB/min) and `test_the_slope_counts_the_world_up_to_the_stop` (120.0, with a jump after the stop request at 390 s that is excluded; and 2 in-world lines → `None`). The "no division" case from KelboLive (a one-sample run) is covered by the `< 3` guard. - **"`series`, the file's name, or null when the file could not be written ... the summary is written all the same"** — `main()` sets `out["memory"]["series"] = write_series(...)` (`:586`); `test_a_series_it_cannot_write_still_leaves_the_summary` makes `memory.csv` a directory so the write raises, and asserts exit 0, `verdict.result == "PASS"`, `series is None`, `lines == 64`, and `memory.csv not written or removed` on stderr. - **"The census strings join the contract test (one key spans the part the parser reads, after #2826 lengthened that sentence)"** — the key `memory, what waits to be let go: {waiting} objects ... {handed} retired objects ... handed to the thread that lets them go` is a single `SOURCES` entry (the `, ` between the two numbers included), and `test_the_runtime_still_writes_what_the_parser_reads` (which strips Rust `\`-continued lines) matches it against `census.rs:343-344`; the key `crate::census::log();` matches `copystat.rs:762`. Both pass. - **"the summary's video memory peak counts every video memory line ... so it can come from a line with no CSV row"** — `memory_block`'s `vram_in_use_max_mb`/`vram_over_budget_s` use all of `run.video` (`:462-466`), and `run.video` holds every `video memory as the system counts it, ...` line because the `VIDEO` regex's `[^:]*` accepts any reason. The runtime writes such lines with the memory line (`copystat.rs:757`), right before and after the swap chain is made (`host.rs:14210`, `:14259`), right after the swap chain's buffers are made again for another size or format (`:13875`), and right after the system changes the card's budget — gated on a move of `>= (256u64 << 20)` = 256 MB (`:14372`, logged at `:14381`). `memory.csv` samples only the one nearest each memory line. **I reproduced the consequence with the real parser**: a swap-chain video line with 9999 MB in use at 90 s and a memory line at 100 s gives `summary.memory.vram_in_use_max_mb == 9999` but the `memory.csv` row at 100 s has `vram_in_use_mb == "7000"` — the peak has no row. The docs say exactly this, so the claim is truthful. - **"On a short run the slope is the loading's climb; on a long one, a pile-up's"** — this is the intended reading of `private_mb_per_min_in_world` over the in-world window; it is a heuristic reading, and the description labels it as such. (The author's real-run slope of 450 MB/min over a 124 s run is consistent with a front-loaded climb — most of the 8,511→23,687 MB growth before the world, then a flatter in-world tail — which is what a least-squares slope over the world would show; but this is the author's measurement, not one I could repeat, see §6.) - **"The description is current"** — the `Depends on: #2812` note, the three-of-three framing, and the "Not in this version" removals all match the code; KelboLive's two doc points (the stale time-series/peaks list and the peak-vs-row distinction) are addressed. ### 3. The new tests and what they do Five tests are added and one extended. Against **#2812's head** (the precise red for this PR's own contribution — merge base + #2812 + #2813's test hunks) they fail with exactly the missing-field assertions; against the head they pass: - `test_the_memory_series_and_a_pile_ups_slope` (`tests/test_game_gate.py:310-334`) — the slope (120.0), the reaper peak and its time, the waiting max, `series == "memory.csv"`, then through `main()` 76 CSV rows, the header, the last row's values, and LF only. On the #2812 head it fails as `KeyError: 'private_mb_per_min_in_world'`. - `test_the_series_takes_the_lines_within_2_s_of_each_memory_line` (`:336-361`) — the 2 s window and empty cells; fails on the #2812 head (no `write_series`). - `test_the_slope_counts_the_world_up_to_the_stop` (`:363-379`) — 120.0 with a post-stop jump excluded, and `None` with 2 in-world lines; fails on the #2812 head as `KeyError: 'private_mb_per_min_in_world'`. - `test_a_series_it_cannot_write_still_leaves_the_summary` (`:381-394`) — a directory at `memory.csv` makes the write fail; exit 0, `series` null, `lines` 64, the stderr message; fails on the #2812 head as `KeyError: 'series'`. - `test_a_folder_summarized_again_without_memory_lines_keeps_no_old_series` (`:419-431`) — the stale-file removal; fails on the #2812 head as `KeyError: 'series'`. - `test_a_build_without_memory_lines_gives_no_memory_peaks` (extended, `:396-417`) — now also asserts `series`/`reaper_queue_max`/`private_mb_per_min_in_world` are null and, through `main()`, that no file is written; fails on the #2812 head as `KeyError: 'series'`. ### 4. What the tests do here (measured) The repository's own red/green verifier, `python3 -I scripts/red_green.py 2813 --work-dir /home/shangli/oc-workspace/gta6/rg-2813`: | side | commit | test file | result | regressions | |---|---|---|---|---| | red | merge base `8422def7` + the PR's test hunks, on `main` `a917c54d` | `tests/test_game_gate.py` | 4 + 6 of the feature's tests failed (the six #2813 tests and, because the red side has neither PR's code, the #2812 memory tests too); 24 ok, 1 ignored | — | | green | PR head `0e5ebd0c6` | `tests/test_game_gate.py` | all ok (the pwsh poll test is `ignored` here — no PowerShell) | **0** | The tool's verdict: **"red then green"** — 9 red→green, 24 pass on both, 0 regressions, 0 fail on both. Because the red side is the merge base (which lacks #2812's code too), the #2812 tests also appear red→green; the red side for this PR's own contribution is #2812's head, where I separately confirmed the six #2813 tests fail with the missing-field messages above and the other 29 pass (35 tests, 2 pwsh skips). On the head itself: `python3 -I tests/test_game_gate.py` → **35 tests, OK (2 skipped)**; `python3 -I -m unittest discover -s tests -p "test_docs_*.py"` → **57 tests, OK**; `tests/test_text_write_line_endings.py` → 3 OK; `tests/test_tool_stdout_encoding.py` → 4 OK; `python3 -I scripts/check_no_game_data.py <the changed files>` → clean (exit 0); `python3 -m compileall -q tools tests` → clean. ### 5. Anything wrong One observation worth stating, not a defect of the change: - **`summary()` reports `series: "memory.csv"` before the file exists.** `memory_block` sets `out["series"] = SERIES` whenever there are memory lines (`tools/game_gate.py:457`), but only `main()` writes the file (`:586`, which overwrites `series` with the real `write_series` result). A caller that uses `summary()` directly (as the tests do) gets `series == "memory.csv"` with no file on disk, and only `main()` reconciles it (to the name on success, to `null` on failure). The gate CLI always goes through `main()`, so `summary.json` on disk is always truthful; this is a mild API wart, not a user-facing bug, and `test_the_memory_series_and_a_pile_ups_slope` encodes it (it asserts `m["series"]` from `summarize()` before `main()` is called). KelboLive's three points are all resolved: the "Not in this version" list no longer names the time series or the VRAM/RAM peaks (`docs/game_gate.md`); the peak-vs-row distinction is documented and I reproduced it; `write_series` removes an old `memory.csv` (and there are two tests through `main()`). ### 6. What I did not check - **The author's real-run numbers** (37 rows all filled, reaper queue 1,018 at 108 s then 0, waiting objects 6,991, private 8,511→23,687 MB, slope 450 MB/min, PC down to 477 MB left to commit) are from a re-summarized copy of a 124 s RTX 3080 run on Windows — I could not reproduce them (no Windows, no GPU, no game files, no run folder), and I only checked them for internal consistency (the 450 MB/min slope over a ~1-2 min in-world window with a front-loaded 15 GB climb is plausible, not self-contradictory). - **No PowerShell, no Windows.** The `census.rs`/`copystat.rs`/`host.rs` sites I quote are read from the source at the PR head; the runtime was not built or run, so the census line's live cadence (every 5 s, diagnostics builds only) and its exact numbers are the author's and `OreoFR`'s observations, not mine. - **The `WAITS` regex against the live census line.** I matched it to `census.rs:343-344` textually and to the synthetic line the test writes, but I did not see a real line from a real run, so I could not check a reworded or differently-punctuated live line; the contract test is what guards this. - **The cost of `memory_rows`/`write_series`.** `near()` is a linear scan per memory row (O(n·m) overall); the summary runs once at the end, so this is not a hot path, but I did not measure it on a multi-hour run with tens of thousands of lines. - **The interaction with #2812's `memory.csv` and the `memory_stop` limits.** The two PRs are separate; I verified #2813 applies on top of #2812 and that its own tests fail on #2812, but I did not build the merged tree (the author and `fiestorra` did — "every order of the three merges cleanly", #2812 then #2813). - **The PR's coordination-issue thread** (issue #2570) was not read beyond what the description links; I read the pull request, its description, and every comment/review on it via the GitHub API. - **The `#2826` reference** ("after #2826 lengthened that sentence") — I did not read #2826; I verified the contract key against the current `census.rs` directly, which is the property that matters.
enlight3d commented 2026-12-02 10:13:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T10:13:02Z.


RUN (independent run on Windows, #2813 head 0e5ebd0c6, stacked on #2812: main a917c54d6, then #2812 head 01203fb3b, then this head, each merged locally with git merge --no-ff, no conflicts. #2812 was merged while this ran: main 80910637f is a917c54d6 plus #2812, this head merges cleanly onto it, and the four files it changes come out identical to the stacked merge tested here. CI on the head: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass.)

The game was not started for this run: tests and reading only. No cargo (Python and docs on top of #2812).

Commands, unittest files run with python -I as the CI's standalone loop runs them. PowerShell 7 is present, so the script tests ran (none skipped):

  • python -I tests/test_game_gate.py -v: main + #2812, 30 OK; main + #2812 + #2813, 35 OK.
  • Red against #2812 (main + #2812 with this pull request's tests/test_game_gate.py): 35 run, 6 errors: the 5 new tests and test_a_build_without_memory_lines_gives_no_memory_peaks, which this head extends. Each fails for the missing feature (KeyError series or private_mb_per_min_in_world, no SERIES_COLUMNS, no rows). The other 29 pass.
  • Red against main alone (main's tool with this test file): 35 run, 3 failures and 7 errors: those 6 and #2812's 4.
  • Related suite through scripts/run_standalone_tests.py -j 4 (the 13 tests/test_docs_*.py, test_i18n_index.py, test_design_contract_rows.py, test_ci_registration.py, test_tool_stdout_encoding.py, test_game_gate.py, test_d3d12_ab_compare.py, test_red_green.py): main 20 files, 0 failed; the stacked merge 20 files, 0 failed. The contract test, which now also looks for the census line's words in the runtime's sources, passes on today's main.

Mutations of the stacked merge, each run with tests/test_game_gate.py (35 tests), the file restored after each:

  • near() window 2 s to 5 s: killed (test_the_series_takes_the_lines_within_2_s_of_each_memory_line).
  • the slope no longer stops at the stop request: killed (test_the_slope_counts_the_world_up_to_the_stop).
  • memory.csv written with CRLF: killed (test_the_memory_series_and_a_pile_ups_slope).
  • an older memory.csv kept when the log has no memory lines (os.remove dropped): killed (test_a_folder_summarized_again_without_memory_lines_keeps_no_old_series).
  • the reaper queue's peak taken from the waiting-objects column: killed (test_the_memory_series_and_a_pile_ups_slope).
  • scripts/red_green.py --mutate from #2817, with main + #2812 as --base (--no-fetch --no-cargo): red then green, 6 tests; 29 pass on both; 10 hunks of tools/game_gate.py undone one at a time: 9 caught, 1 not caught. The one not caught is the hunk at line 90, the two new SOURCES keys: without them the contract test still passes, with fewer keys, so nothing ties WAITS to an entry of the contract. The same kind of hunk was reported not caught on #2810. Minor.

Not covered here: the game (no run, so no real census line: the rows were checked on the tests' synthetic logs only), a long run where the slope shows a pile-up rather than the loading's climb, Linux and macOS.

Verdict: PASS, on main + #2812 + #2813, which is today's main 80910637f + this head.

Machine: Windows 11 Pro 26300, i9-13900K, 64 GB, RTX 3090 24 GB, NVIDIA 621.40, Python 3.13.12 (the CI uses 3.12), PowerShell 7.6.10.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7342138653 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2813#issuecomment-7342138653). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-12-02T10:13:02Z. --- RUN (independent run on Windows, #2813 head 0e5ebd0c6, stacked on #2812: `main` a917c54d6, then #2812 head 01203fb3b, then this head, each merged locally with `git merge --no-ff`, no conflicts. #2812 was merged while this ran: `main` 80910637f is a917c54d6 plus #2812, this head merges cleanly onto it, and the four files it changes come out identical to the stacked merge tested here. CI on the head: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass.) The game was not started for this run: tests and reading only. No cargo (Python and docs on top of #2812). Commands, unittest files run with `python -I` as the CI's standalone loop runs them. PowerShell 7 is present, so the script tests ran (none skipped): - `python -I tests/test_game_gate.py -v`: main + #2812, 30 OK; main + #2812 + #2813, 35 OK. - Red against #2812 (main + #2812 with this pull request's `tests/test_game_gate.py`): 35 run, 6 errors: the 5 new tests and `test_a_build_without_memory_lines_gives_no_memory_peaks`, which this head extends. Each fails for the missing feature (KeyError `series` or `private_mb_per_min_in_world`, no `SERIES_COLUMNS`, no rows). The other 29 pass. - Red against `main` alone (`main`'s tool with this test file): 35 run, 3 failures and 7 errors: those 6 and #2812's 4. - Related suite through `scripts/run_standalone_tests.py -j 4` (the 13 `tests/test_docs_*.py`, `test_i18n_index.py`, `test_design_contract_rows.py`, `test_ci_registration.py`, `test_tool_stdout_encoding.py`, `test_game_gate.py`, `test_d3d12_ab_compare.py`, `test_red_green.py`): main 20 files, 0 failed; the stacked merge 20 files, 0 failed. The contract test, which now also looks for the census line's words in the runtime's sources, passes on today's `main`. Mutations of the stacked merge, each run with `tests/test_game_gate.py` (35 tests), the file restored after each: - `near()` window 2 s to 5 s: killed (`test_the_series_takes_the_lines_within_2_s_of_each_memory_line`). - the slope no longer stops at the stop request: killed (`test_the_slope_counts_the_world_up_to_the_stop`). - `memory.csv` written with CRLF: killed (`test_the_memory_series_and_a_pile_ups_slope`). - an older `memory.csv` kept when the log has no memory lines (`os.remove` dropped): killed (`test_a_folder_summarized_again_without_memory_lines_keeps_no_old_series`). - the reaper queue's peak taken from the waiting-objects column: killed (`test_the_memory_series_and_a_pile_ups_slope`). - `scripts/red_green.py --mutate` from #2817, with main + #2812 as `--base` (`--no-fetch --no-cargo`): red then green, 6 tests; 29 pass on both; 10 hunks of `tools/game_gate.py` undone one at a time: 9 caught, 1 not caught. The one not caught is the hunk at line 90, the two new `SOURCES` keys: without them the contract test still passes, with fewer keys, so nothing ties `WAITS` to an entry of the contract. The same kind of hunk was reported not caught on #2810. Minor. Not covered here: the game (no run, so no real census line: the rows were checked on the tests' synthetic logs only), a long run where the slope shows a pile-up rather than the loading's climb, Linux and macOS. Verdict: PASS, on `main` + #2812 + #2813, which is today's `main` 80910637f + this head. Machine: Windows 11 Pro 26300, i9-13900K, 64 GB, RTX 3090 24 GB, NVIDIA 621.40, Python 3.13.12 (the CI uses 3.12), PowerShell 7.6.10.
MoonEyes commented 2026-12-02 10:17:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T10:17:18Z.


Merging. Head 0e5ebd0c6 merges cleanly with main 80910637f and does not force a rebase of #2566. Independent check on head 0e5ebd0c6: enlight3d's red/green on main + #2812 (red 6/35, green 35/35, 5/5 mutations killed, comment 7342138653); #2812 merged as 80910637f; CI 5/5 green; mergeable, no open review or question. Merged by MoonEyes.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7342244813 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2813#issuecomment-7342244813). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T10:17:18Z. --- Merging. Head `0e5ebd0c6` merges cleanly with `main` `80910637f` and does not force a rebase of #2566. Independent check on head 0e5ebd0c6: enlight3d's red/green on main + #2812 (red 6/35, green 35/35, 5/5 mutations killed, comment 7342138653); #2812 merged as 80910637f; CI 5/5 green; mergeable, no open review or question. Merged by MoonEyes. AI-assisted (Claude Code).
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
ProjectLeonida/mandy!2813
No description provided.