0.9.3: switch to a profile or snapshot without starting the game #64

Merged
ethan-hann merged 17 commits from issue-30-switch-without-playing into main 2026-10-24 03:20:27 -05:00
Owner

Adds a way to load a profile's or snapshot's files into the game's folders without starting the game, for working on mods in a mod manager, copying a save, a manual backup, or starting the game another way.

The Games row menu starts with "Switch to this profile", and History's cards, timeline entries and save rows offer "Switch to this snapshot". Both run the launch's own preparation (ILaunchApi.SwitchAsync, a JobKind.Switch job) and stop before the start: the same preview, the same guards for new changes, a running game and held files, Activity details and a cancel that asks first. Afterwards the profile reads "Loaded now" and no after-play dialog follows. The game stays claimed for the whole job, with its own refusal message (error.gameService.switching); a stopped switch recovers like an interrupted launch; Try again and the recovery buttons stay a switch; a finished switch notifies. The errors that said to play a profile first now offer the switch. Help, the tour and the snapshot answer mention it.

Built test first (reds in the commit messages), reviewed, and reconciled with 0.9.2's per-operation error copy so a switch's held-file and disk-space errors read as a switch. D49 records the calls; architecture and the UI guide are updated. The Windows gate passed (9,556 tests, 0 failed, 28 listed skips).

Closes #30

Adds a way to load a profile's or snapshot's files into the game's folders without starting the game, for working on mods in a mod manager, copying a save, a manual backup, or starting the game another way. The Games row menu starts with "Switch to this profile", and History's cards, timeline entries and save rows offer "Switch to this snapshot". Both run the launch's own preparation (`ILaunchApi.SwitchAsync`, a `JobKind.Switch` job) and stop before the start: the same preview, the same guards for new changes, a running game and held files, Activity details and a cancel that asks first. Afterwards the profile reads "Loaded now" and no after-play dialog follows. The game stays claimed for the whole job, with its own refusal message (`error.gameService.switching`); a stopped switch recovers like an interrupted launch; Try again and the recovery buttons stay a switch; a finished switch notifies. The errors that said to play a profile first now offer the switch. Help, the tour and the snapshot answer mention it. Built test first (reds in the commit messages), reviewed, and reconciled with 0.9.2's per-operation error copy so a switch's held-file and disk-space errors read as a switch. D49 records the calls; architecture and the UI guide are updated. The Windows gate passed (9,556 tests, 0 failed, 28 listed skips). Closes #30
A player may want the files in the game's folders without playing. SwitchAsync runs the launch's own checks and switch (unsaved changes, held files, a running game, cancel) as a Switch job, opens no play session, records no launch time, and ends there. The game stays taken for the job's life so a launch or second switch cannot begin meanwhile.

Observed red: LaunchSwitchOnlyTests.A_switch_loads_both_folders_and_ends_without_starting_the_game_or_opening_a_session failed at Assert.True(started.Ok) with "A launch is already running for game 'play-1'." while SwitchAsync was a refusing stub.

Tests that passed first time got mutation checks: mapping Switch to the launch cancel message removed -> the cancel test fails; the open-game check removed -> the started-by-hand test fails; the claim release removed -> the load, retry, dirty and cancel tests fail.
BeginSwitchAsync runs the launch flow's own check, dialog and guards, then starts a Switch job instead of a launch and follows that job to its end: progress dialog worded for a switch, a success toast that says the game was not started, a card with Try again on failure or cancel, and an "Already in place" card when nothing needs loading. Try again keeps the kind of start, and the job pill leaves Switch jobs to the flow.

Observed reds (all before the flow existed): LaunchFlowSwitchTests.A_switch_starts_a_switch_job_and_not_a_launch... failed at Assert.Single() on the SwitchAsync calls (collection empty); A_profile_that_is_already_in_place... failed at Assert.IsType<ErrorCardViewModel> (Value is null); the dialog, progress, failure and cancel tests failed at Assert.NotEmpty on the shown dialogs; JobStatusViewModelTests.A_switch_job_never_shows_in_the_pill... failed at Assert.False(rig.Status.IsVisible).

Mutation checks: Try again always re-entering as a play fails the cancel test; a confirm label that is always "Switch" fails A_play_dialog_still_says_switch_and_play.
Activity names a switch job "Switching <game>'s files", and stopping one while it switches (or quitting then) asks first, with the stop warning telling the player to switch again rather than press Play.

Observed reds: JobRowViewModelTests.A_job_is_named_in_plain_words_with_its_game(kind: Switch) failed with Actual "Clearing SavePoint's data"; A_switch_that_is_stopping_says_the_folder_is_left_with_a_mix... failed with Actual "Stopping now."; ExitGuardTests.A_switch_without_playing_asks_first_in_the_same_words passed first time and failed when the Switch case was removed from the guard's question.
A profile row's menu gets "Switch to this profile", and History's cards, timeline entries and save rows get a switch button beside Go back; each begins the launch flow's switch instead of a launch and, like Go back, takes the player to Games when it gets going. The help page, the tour and the contextual snapshot answer mention the action, and the errors that told the player to play first now point to switching too.

Observed reds: GamesScreenActionsTests.Switch_asks_the_launch_flow_to_load_the_profiles_latest_points_without_playing failed at Assert.Single() (collection empty) while the action did nothing; HistoryScreenViewModelTests.Switch_to_this_snapshot_on_a_card_begins_a_switch_at_that_point_and_not_a_launch and ..._timeline_entry_and_a_save_row_switch_their_own_target failed because the switch buttons still launched; the copy tests (The_active_profile_is_refused_with_its_copy..., A_refusal_for_a_profile_that_is_not_loaded..., TourViewModelTests.Each_step_says_what_the_control_it_points_at_does) failed with "Strings differ" before the catalog changed.

Mutation checks: skipping the can-play guard in the row action fails Switch_does_nothing_while_the_game_has_a_session; not taking the player to Games for a switch fails A_switch_that_gets_going_takes_the_player_to_Games.
A journey test drives the real shell from a profile row's Switch through the dialog and the switch job to a toast with no session and no after-play prompt. The contract scenario now has the fake and the real backend refuse a switch while the game runs and for an unknown game in the same words. History's tab order lists each switch button right after its Go back.

Observed reds: TabOrderTests.History_cards_go_row_by_row... and The_history_list_goes_through_the_versions_then_the_saves... failed on the new buttons before their expected order was updated. The journey and contract additions passed first time; with the fake's open-game check removed the contract test failed (the stories differ), and with the flow left idle after the job starts the journey failed at AssertPlayIs.
A switch without playing can be the same long write a player walks away from, so it notifies like capture and the other long jobs, with its own sentences that say the game was not started.

Observed reds: NotificationPolicyTests (kind: Switch) failed at Assert.True on ShouldNotify for the focus, minimized and still-active cases and Exactly_the_five_long_kinds_are_notifiable failed on the list; NotificationTextTests.Each_kind_and_ending_has_its_sentence (kind: Switch) failed with the snapshot sentences.
error.launch.dirtyWorkingTree now reads the same for a play and a switch and names no button. Tests show that "Review the changes" and "Finish the switch" on a failed switch start another switch and not a launch.

Observed red: LaunchFlowSwitchTests.A_switch_that_finds_new_changes_says_so_without_sending_the_player_to_Play... failed at Assert.Equal on the body ("Press Play to choose whether..."). The Finish the switch test passed first time; with re-entry forced to a play, both new tests and the cancel test failed.
Save rows now show "Switch to this snapshot", the words inside their accessible name (WCAG 2.5.3), stacked under Go back so the row keeps room. The older-snapshot note for a switch adds a sentence that changes made there can be kept as a new profile the next time the player switches or plays.

Observed reds: HistoryScreenViewTests.Every_history_button_has_its_visible_words_inside_its_accessible_name failed for 5 save-row buttons (Sub-string not found: "Switch only"); LaunchFlowSwitchTests.The_older_snapshot_note_for_a_switch_says_what_becomes_of_changes_made_there failed at Assert.Equal on the note.
A new contract story holds a switch at the install folder's first free-space question, then starts a launch and a second switch: both backends must refuse with error.launch.alreadyRunning, show no session, end the job as a Switch that succeeded, and accept a switch afterwards. The fake now takes the game from the start of a switch job until it ends, as the real backend does.

Observed red: BackendContractTests.The_real_backend_tells_the_same_first_run_story_as_the_fake failed with "fake: start while a switch job runs: unexpected success" against "real: ... error error.launch.alreadyRunning".
A switch holds the game, but the game is not running, so starting, switching again, discarding, deleting, editing folders, moving storage and clearing data now refuse with error.gameService.switching ("SavePoint is switching X's files right now...") when a switch holds it. A running game still gets the old messages.

Observed red: LaunchSwitchOnlyTests.A_switch_waiting_for_the_game_keeps_it_taken... failed with Expected "error.gameService.switching" Actual "error.launch.alreadyRunning"; the contract story's new discard step failed with "fake: unexpected success" against "real: error error.gameService.switching" until the fake held the game for a switch the same way.
A switch is cancelled at the engine's first free-space question: the folder is marked unfinished, the game is free, no session or game exists, a play to another target is refused with error.launch.switchInterrupted, and a second switch to the same target finishes it.

The test passed first time; with the claim no longer released after the job it failed (the game stayed taken), as did the other claim-release tests.
Observed red: LaunchEndToEndTests.Switching_to_a_profile_from_its_row... failed at Assert.True(Row(...).IsActive) once the journey checked the table after the job, because the fake never changed the row stats.
When a snapshot is refused because the profile is not loaded, or a delete is refused because the profile is loaded, the player now gets a confirmation instead of a toast: the first offers "Switch to this profile", the second "Switch to <another profile>" (the first other profile in the table, named on the button). Accepting begins the launch flow's switch; Not now leaves everything as it was. Other errors still toast.

Observed reds: GamesScreenActionsTests.A_refusal_for_a_profile_that_is_not_loaded_offers_to_switch_to_it, Declining_the_offer_to_switch_leaves_things_as_they_are and The_active_profile_is_refused_with_its_copy_and_offers_to_switch_to_another_profile failed at Assert.Single on the confirmations (empty; the error was a toast).
ErrorOperations.Of fell through to Unspecified for JobKind.Switch, so the
job status toast, the notification and the job details for a switch-only
job used the neutral held-file and disk-space words. It now maps Switch to
the Switch operation.

Reds observed first:
- ErrorOperationCopyTests.Each_kind_of_job_maps_to_its_operation(kind: Switch):
  Assert.Equal Expected: Switch, Actual: Unspecified
- ErrorOperationCopyTests.No_kind_of_job_falls_back_to_the_neutral_operation(kind: Switch):
  Assert.NotEqual Expected: Not Unspecified, Actual: Unspecified

The new notification and switch-card tests passed first run, so each got a
mutation check: dropping the Switch mapping failed
NotificationTextTests.A_switch_stopped_by_a_held_file_says_the_switch_stopped_and_will_pick_up
(Sub-string not found), and passing Unspecified from the switch failure card
failed LaunchFlowSwitchTests.A_switch_stopped_by_a_held_file_says_the_switch_stopped_partway_and_will_pick_up
(Expected "A file is in use, so the switch stopped partway", Actual "A file is in use")
and A_switch_that_ran_out_of_room_says_it_needed_the_room_to_switch.
Version 0.9.3
All checks were successful
Gate / linux (pull_request) Successful in 13m45s
Gate / linux (push) Successful in 12m35s
76d2b22bd7
Sign in to join this conversation.
No reviewers
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.

Dependencies

No dependencies set

Reference
ethan-hann/SavePoint!64
No description provided.