Use the benchmark card written by each mission run #383

Open
HandshakeHackin wants to merge 2 commits from upstream-pr/383 into v21
HandshakeHackin commented 2026-11-30 20:32:43 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by HandshakeHackin on 2026-11-30T20:32:43Z.


On v26.11.23, finish mission A and start B, then interrupt B before it saves a card. Returning to Missions takes the newest card from the past 20 minutes and credits A’s figures to B. In the synthetic replay, A and B both showed 26.9 FPS although B never finished.

The launcher now uses the card filename printed by the benchmark process after the files are written. An interrupted B or a play-only mission contributes no benchmark result. When B finishes, its own card wins even if a different PNG in the folder has a newer timestamp.

The replay and mission suite passed on Windows PowerShell 5.1 and PowerShell 7. The existing launcher logging suite also passed on 5.1. Windows verification

<!-- greyfinch-sync:PastiiJay/klbf-lab:issue:5573247306 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/383). Originally posted by [HandshakeHackin](https://github.com/HandshakeHackin) on 2026-11-30T20:32:43Z. --- On v26.11.23, finish mission A and start B, then interrupt B before it saves a card. Returning to Missions takes the newest card from the past 20 minutes and credits A’s figures to B. In the synthetic replay, A and B both showed 26.9 FPS although B never finished. The launcher now uses the card filename printed by the benchmark process after the files are written. An interrupted B or a play-only mission contributes no benchmark result. When B finishes, its own card wins even if a different PNG in the folder has a newer timestamp. The replay and mission suite passed on Windows PowerShell 5.1 and PowerShell 7. The existing launcher logging suite also passed on 5.1. [Windows verification](https://github.com/HandshakeHackin/klbf-lab/actions/runs/46506851363)
HandshakeHackin commented 2026-11-30 20:56:08 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by HandshakeHackin on 2026-11-30T20:56:08Z.


Retested on release v26.11.24 (92aa6f4) with this change, #378, #381 and the depth-state correction from #27. The mission tests and report tests passed on Windows PowerShell 5.1 and PowerShell 7. The same job passed workspace Clippy and the Rust suite (1,311 passed, 48 ignored). The unmodified upstream PR check still fails at the depth-bounds draw test. Windows integration job

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7291676570 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/383#issuecomment-7291676570). Originally posted by [HandshakeHackin](https://github.com/HandshakeHackin) on 2026-11-30T20:56:08Z. --- Retested on release v26.11.24 (`92aa6f4`) with this change, #378, #381 and the depth-state correction from #27. The mission tests and report tests passed on Windows PowerShell 5.1 and PowerShell 7. The same job passed workspace Clippy and the Rust suite (1,311 passed, 48 ignored). The unmodified upstream PR check still fails at the depth-bounds draw test. [Windows integration job](https://github.com/HandshakeHackin/klbf-lab/actions/runs/46509540986/job/142168808649)
HandshakeHackin commented 2026-12-01 13:13:14 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by HandshakeHackin on 2026-12-01T13:13:14Z.


Updated this PR for v26.12.1 at f8b3e9df. Manual missions, Run all (A/B/A), and Test lab now read the card identified by the child process that ran the benchmark. An interrupted child that writes no card can no longer pick up a concurrent run’s result.

I reproduced the issue by giving each child its own card and placing a newer, unrelated card in the same directory. With synthetic inputs of 10, 20 and 10, the unmodified launcher reported 70, 70 and 70. The updated launcher reported 10, 20 and 10. When B was interrupted or wrote a PARTIAL card, Run all stopped at B and kept only A.

The reproduction script passed 16/16 cases on this commit and 2/16 on unmodified v26.12.1. The matrix covers the default and a redirected benchmark directory. All 124 checks in tests/missions.ps1 also passed. I ran these on Linux with PowerShell 7.4.19, using the real launcher and a synthetic child in place of the game.

To repeat against either checkout with Python 3 and pwsh on Linux, run python3 verify_mission_cards.py /path/to/checkout --matrix.

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7312283468 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/383#issuecomment-7312283468). Originally posted by [HandshakeHackin](https://github.com/HandshakeHackin) on 2026-12-01T13:13:14Z. --- Updated this PR for v26.12.1 at `f8b3e9df`. Manual missions, Run all (A/B/A), and Test lab now read the card identified by the child process that ran the benchmark. An interrupted child that writes no card can no longer pick up a concurrent run’s result. I reproduced the issue by giving each child its own card and placing a newer, unrelated card in the same directory. With synthetic inputs of 10, 20 and 10, the unmodified launcher reported 70, 70 and 70. The updated launcher reported 10, 20 and 10. When B was interrupted or wrote a PARTIAL card, Run all stopped at B and kept only A. The [reproduction script](https://github.com/HandshakeHackin/klbf-lab/blob/d3b61b23fc508010425351d89c498129cf918c3b/tests/verify_mission_cards.py) passed **16/16** cases on this commit and **2/16** on unmodified v26.12.1. The matrix covers the default and a redirected benchmark directory. All **124** checks in `tests/missions.ps1` also passed. I ran these on Linux with PowerShell 7.4.19, using the real launcher and a synthetic child in place of the game. To repeat against either checkout with Python 3 and `pwsh` on Linux, run `python3 verify_mission_cards.py /path/to/checkout --matrix`.
PastiiJay commented 2026-12-01 13:19:07 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-12-01T13:19:07Z.


thank you, this is excellent work: a reproduction showing 70/70/70 instead of 10/20/10 makes the problem impossible to miss, and 16/16 plus the 124 mission checks on your branch is very convincing. passing it to the team now so they can review it.

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7312432584 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/383#issuecomment-7312432584). Originally posted by [PastiiJay](https://github.com/PastiiJay) on 2026-12-01T13:19:07Z. --- thank you, this is excellent work: a reproduction showing 70/70/70 instead of 10/20/10 makes the problem impossible to miss, and 16/16 plus the 124 mission checks on your branch is very convincing. passing it to the team now so they can review it.
PastiiJay commented 2026-12-01 13:19:38 +00:00 (Migrated from github.com)

Imported from PastiiJay/klbf-lab. Originally posted by PastiiJay on 2026-12-01T13:19:38Z.


a bit of context from the team: since v26.12.1 a card older than the start of the run is already refused, so the "interrupted B takes A's numbers" case no longer happens. your PR also covers a newer unrelated card landing in the folder during the run: rarer, but your approach (reading the card the bench itself wrote) is the right one. the team is reviewing it. thanks again for the depth of this work!

<!-- greyfinch-sync:PastiiJay/klbf-lab:comment:7312445053 --> Imported from [PastiiJay/klbf-lab](https://github.com/PastiiJay/klbf-lab/pull/383#issuecomment-7312445053). Originally posted by [PastiiJay](https://github.com/PastiiJay) on 2026-12-01T13:19:38Z. --- a bit of context from the team: since v26.12.1 a card older than the start of the run is already refused, so the "interrupted B takes A's numbers" case no longer happens. your PR also covers a newer unrelated card landing in the folder during the run: rarer, but your approach (reading the card the bench itself wrote) is the right one. the team is reviewing it. thanks again for the depth of this work!
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/383:upstream-pr/383'
git switch 'upstream-pr/383'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'v21'
git merge --no-ff 'upstream-pr/383'
git switch 'upstream-pr/383'
git rebase 'v21'
git switch 'v21'
git merge --ff-only 'upstream-pr/383'
git switch 'upstream-pr/383'
git rebase 'v21'
git switch 'v21'
git merge --no-ff 'upstream-pr/383'
git switch 'v21'
git merge --squash 'upstream-pr/383'
git switch 'v21'
git merge --ff-only 'upstream-pr/383'
git switch 'v21'
git merge 'upstream-pr/383'
git push origin 'v21'
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
PastiiJay/klbf-lab!383
No description provided.