Launcher state folder: a durable run journal, an atomic final save, test seams out of release builds
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Start with clean/installer/src/wg_core/record.h and install.cpp for the run journal, clean/wgshared/include/wg_state.h for settings replacement, and record.cpp plus the build targets for test seams. The issue specifies crash recovery, object identity, an editor-save interleaving test, and a release-binary check; completing and verifying all three areas requires coordinated changes across the installer, shared state code, and tests.
由索引模型根據 Issue 內容生成。
描述
Background
PR #224 moved the settings that the launcher and the in-game menu save into the game's state folder
(wronggpu-setup\settings.ini, clean/wgshared/include/wg_state.h). It made WrongGPU's files there recognisable by their
bytes, their name and the install's id, and made a failed install, repair or update take back only what that run made (a
run journal). Three smaller points remain.
1. The run journal is in memory only
clean/installer/src/wg_core/record.h (RunJournal) and install.cpp write down each create before it happens, but only
in memory:
- A crash in the middle of an install loses the journal. A WrongGPU file the run created then has no record of being
WrongGPU's, so it is kept and listed as if it were the player's (safe, but untidy). - An entry is a path, not the created object. If another program makes or replaces that path between the create and a
rollback, the rollback deletes by path (a narrow interleaving). RollbackCreated's list of what it kept is logged, not shown to the player in the result.
Proposed:
- Write the journal to a file in the state folder, flushed before each create, and read it on the next run to finish or
undo an interrupted one. - Keep each created file's identity (volume serial and file index) or hold it open, and delete only that object.
- Return the kept list to the operation's result as a warning.
2. The settings save's last check is not atomic with the replace
wg_state.h UpdateSettings holds the file from the read to just before the move. It lets go, checks the file's
identity and last write once more (StillIdentity), then replaces it by path (MoveFileExW). An editor that saves in the
moment after the check and before the move can still lose its bytes. (A file made where none was is never replaced: that
move does not replace.)
Proposed: replace through a handle so that the check and the replace are one step. For example, rename the held file
aside through its own handle, move the new file in only where nothing is, and put the old one back if the move fails. Or
use ReplaceFileW with a backup name and compare the backup's identity afterwards. Add a test for an editor save between
the check and the move.
3. The C++ test seams are compiled into release builds
The environment-variable hooks (WRONGGPU_TEST_STOP_AT, WRONGGPU_TEST_FAIL_AT, WRONGGPU_TEST_CREATE_AT,
WRONGGPU_TEST_FAIL_AFTER_RESTORE) exist only in WRONGGPU_TESTING builds. The function-pointer seams they sit beside
are still in release builds:
wg_state.hTestFault()/Faulted();record.cppSetRestoreStepHook/RestoreStepandSetFaultHook/TestFault.
Nothing in a release build sets them, so they do nothing there, but they are code a release build does not need.
Proposed: compile them only into WRONGGPU_TESTING builds and the unit-test targets (an empty inline RestoreStep /
Faulted otherwise), with a release-build check that their names are not in the launcher.
Done when
- An interrupted install leaves a journal that the next run uses, and a rollback deletes only the objects it created
(unit tests: a crash after a create; a path replaced before the rollback). - A settings save cannot replace bytes an editor saved after WrongGPU's last check (unit test for that interleaving).
- Release builds carry none of the test seams (checked on the built launcher).
- 主要語言
- C++
- 星號
- 12
- 分支
- 2
- 平均合併
- 3 小時 10 分鐘
- 30 天內合併 PR
- 171
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
phantoslayer21/wronggpu 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 88/100
phantoslayer21/wronggpu#275 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
phantoslayer21/wronggpu#274 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 88/100
phantoslayer21/wronggpu#241 ·
維護者通常 1 天內回覆
-
bug build
難度 2/5 1-3 小時 新手友好度 74/100
phantoslayer21/wronggpu#234 ·
維護者通常 1 天內回覆
-
bug build
難度 2/5 1-3 小時 新手友好度 80/100
phantoslayer21/wronggpu#233 ·
維護者通常 1 天內回覆
查看 phantoslayer21/wronggpu 的全部 Issue
相似的 Issue
-
ai_p2
難度 2/5 1-3 小時 新手友好度 80/100
ClickHouse/ClickHouse#132519 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
juce-framework/JUCE#1810 ·
-
難度 1/5 1 小時以內 新手友好度 82/100
petercorke/robotics-toolbox-python#952 ·
維護者通常 1 天內回覆
-
NatronRenderer: a Python error in the script (-t / project script) doesn't change the exit status未關閉func:engine type:bug
難度 2/5 1-3 小時 新手友好度 72/100
NatronGitHub/Natron#1276 ·
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 77/100
維護者通常 1 天內回覆