Launcher state folder: a durable run journal, an atomic final save, test seams out of release builds

Ouverte
#246 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
25/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
cpp
Domaine
backend, testing

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

area: launcher enhancement

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.h TestFault() / Faulted();
  • record.cpp SetRestoreStepHook / RestoreStep and SetFaultHook / 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).
Langage dominant
C++
Étoiles
12
Forks
2
Merge moyen
3 h 10 min
PR mergées (30 j)
171

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de phantoslayer21/wronggpu

Toutes les issues de phantoslayer21/wronggpu

Issues similaires

Plus d'issues C++

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.