Faster switches on big games, real game versions, opaque Free up space token, small fixes #112

Merged
ethan-hann merged 19 commits from integration-101 into main 2026-10-25 01:16:04 -05:00
Owner
  • Switches on big games (#104): after git writes the files, a switch or discard refreshes the index once. A file written at the same moment as the index cannot be trusted by its time, and every status SavePoint runs sets GIT_OPTIONAL_LOCKS=0, so nothing ever rewrote the index and each later preview, status, dirty check and checkout read such files in full again. On a 12 GB install with one 4 GB file, a Play that removes that file went from about 42 s to about 2 s. The refresh runs again after a verify retry. The last stretch says "Making sure every file is in place". D41.11 updated. Follow-up: #110.
  • Game versions (#103): the profile shows the game's own version, never an Unreal build id (++Game+release.1.4.7-CL-196638 now shows 1.4.7) or an engine version (Unity, Unreal fixed numbers, placeholders). Checked against 252 game programs; D54 records the rule.
  • Opaque Free up space token (#14): only the preview can issue one; it is sealed per process, so a hand-built or edited token is refused before anything is deleted. D46.5 updated.
  • Activity (#106): the footer says the job you have open stays listed beyond the five kept.
  • Tooltips (#107): an open tooltip closes when a dialog opens.
  • Linux apps menu (#101): Remove also takes away the empty icon folders Add created.

Each change was reviewed (Opus for #104); docs updated.

Closes #104
Closes #103
Closes #14
Closes #106
Closes #107
Closes #101

- **Switches on big games (#104):** after git writes the files, a switch or discard refreshes the index once. A file written at the same moment as the index cannot be trusted by its time, and every status SavePoint runs sets GIT_OPTIONAL_LOCKS=0, so nothing ever rewrote the index and each later preview, status, dirty check and checkout read such files in full again. On a 12 GB install with one 4 GB file, a Play that removes that file went from about 42 s to about 2 s. The refresh runs again after a verify retry. The last stretch says "Making sure every file is in place". D41.11 updated. Follow-up: #110. - **Game versions (#103):** the profile shows the game's own version, never an Unreal build id (`++Game+release.1.4.7-CL-196638` now shows 1.4.7) or an engine version (Unity, Unreal fixed numbers, placeholders). Checked against 252 game programs; D54 records the rule. - **Opaque Free up space token (#14):** only the preview can issue one; it is sealed per process, so a hand-built or edited token is refused before anything is deleted. D46.5 updated. - **Activity (#106):** the footer says the job you have open stays listed beyond the five kept. - **Tooltips (#107):** an open tooltip closes when a dialog opens. - **Linux apps menu (#101):** Remove also takes away the empty icon folders Add created. Each change was reviewed (Opus for #104); docs updated. Closes #104 Closes #103 Closes #14 Closes #106 Closes #107 Closes #101
A file git writes in a switch carries a time stamp in the same second as the
index, so git cannot trust the stamp and reads the whole file again on every
later comparison. Every read runs without git's optional locks, so nothing
ever rewrote the index and the cost repeated: the launch preview, the launch
status read, the switch's own dirty check, git checkout's own refresh (twice,
before it removes a file) and the verify pass each read the file again.
Measured on 12 GB (4 x 2.5 GB, 10 x 100 MB, 6000 small files) plus one 4 GB
file, switching between the two profiles: with the file written by the last
switch, the Go back preview took 8.0 s, the dirty check 7.8 s, git checkout
18.1 s to remove the file, and the verify pass 7.7 s after a write. A cold
disk or a slow VM multiplies that by every read.

A switch and a discard now run update-index --refresh once, after git has
written the files and before the verify pass. The same read happens once
instead of once per later comparison: removing the file now takes 1.2 s in
all, a status 0.2 s, and the write of the 4 GB file moves its 8 s read from
the verify pass to the refresh (14.0 s in all, as before).

The read-back no longer looks like a hang. The engine reports Finishing from
the end of the writes to the end of the switch, the launch job passes it to
the screen, and the progress dialog and the Activity row say "Making sure
every file is in place" with an indeterminate bar instead of standing at 100%
(or, in Activity, claiming snapshots are being stored). A report with nothing
in it now says the files are being checked.

Observed reds (assertion failures):
- IndexRefreshTests.A_switch_rewrites_the_index_after_git_wrote_the_files_and_before_it_verifies_them: expected the index to be refreshed after git wrote the files
- IndexRefreshTests.A_switch_that_only_removes_files_also_refreshes_the_index, A_switch_to_an_older_point_refreshes_the_index: Assert.Single() Failure, no matching items
- IndexRefreshTests.A_discard_rewrites_the_index_after_it_restored_the_files_and_before_it_verifies_them: expected the index to be refreshed after the files were restored
- SwitchWrapUpProgressTests.A_switch_says_it_is_wrapping_up_before_it_reads_the_files_back_and_clears_it_at_the_end: expected a report with Finishing set before the files are read back
- LaunchSwitchProgressTests.A_switch_tells_the_screen_when_it_is_reading_the_files_back_and_stops_telling_it_when_it_is_done: Assert.Contains() Failure, filter not matched
- SwitchProgressDialogViewModelTests.Once_every_file_is_written_the_dialog_names_the_check_that_follows_instead_of_standing_at_full: Assert.True() Failure (IsIndeterminate)
- SwitchProgressDialogViewModelTests.A_report_with_nothing_in_it_says_the_files_are_being_checked_and_stays_indeterminate: expected "Checking your files..." and got the general hint
- JobRowViewModelTests.A_switch_that_is_reading_its_files_back_says_so_and_not_that_snapshots_are_being_stored (Launch, Switch): expected "Making sure every file is in place..." and got "Making sure everything is stored safely..."

Mutation checks (tests that passed on their first run): the dialog
announcement test fails with the once-only guard removed; the wrap-up flag
test fails with Abandon removed; the refused-switch test fails with the
refresh moved ahead of the refusal.
The registry keeps five finished jobs per game, but the Activity screen deliberately keeps the job the reader has open until they pick another, so a game could show six. The footer now says so.

Red: ActivityScreenViewModelTests.The_footer_says_how_many_finished_jobs_are_kept failed (Assert.Equal strings differ at pos 80, actual ended after 'close it.').
A tooltip lives in the popup layer above the dialog scrim, so one opened by hover stayed visible over a dialog. The dialog host now closes every open tooltip when the dialog stack grows.

Red: DialogHostViewTests.A_tooltip_that_is_open_closes_when_a_dialog_opens failed with 'The tooltip stayed open behind the dialog.'
The detected version for Unreal games read like "++Game+release.1.4.7-CL-196638",
and Unity players and engine-stamped executables reported the engine's numbers.
Read from real version resources of installed games:

- An Unreal build id ("++" prefix or "-CL-<n>") now yields only a dotted game
  number inside it (1.4.7, 0.3.7, 1.11.0.0), or nothing.
- A Unity player ("Unity Version" key or a "2022.3.62f2 (hash)" product version)
  reports nothing.
- The fixed numeric version is used only when the file has no version string at
  all and is not an Epic Games or UnrealEngine executable; with strings present
  it is the engine's number (Grounded 4.27.2, Hogwarts Legacy 4.27.2).
- The 1.0 placeholder and strings with no digit are not versions.

Observed reds (assertion failures, before the change):
- An_unreal_build_id_that_carries_the_game_version_shows_just_that_version:
  Expected "1.4.7", Actual "++Game+release.1.4.7-CL-196638" (also 0.3.7, 1.11.0.0)
- An_unreal_build_id_gives_way_to_a_real_file_version_string: Expected "2.3.4",
  Actual "++UE4+Release-4.26-CL-0"
- An_unreal_build_id_without_a_game_version_...: Assert.Null failed, Actual
  "Subnautica2-CL-131439" and "Dev-CL-0"
- A_version_string_with_no_digit_is_no_version: Actual "^VersionString^"
- The_fixed_version_of_an_engine_vendors_executable_...: Actual "4.20.3"
Tests that passed on their first run (Unity, placeholder, rejected-string fixed
fallback, engine-named product) were mutation checked: disabling the Unity and
engine-name early return and the fixed-version guard failed 11 tests.
The run now accepts only a token a preview issued in this process. The
token is a sealed class with an internal constructor and an HMAC seal over
its records, keyed per process; a token built or edited by hand, or issued
elsewhere, makes the request fail before any job starts. Records still
carry the value the preview read, so a stale token is still refused by the
run's own compare. Core tests and the App fakes issue tokens through
InternalsVisibleTo, so the run's guards keep their coverage.

Observed reds (FreeUpSpaceForgedTokenTests, before the change):
- A_token_built_by_hand_from_a_previews_own_records_is_refused_and_nothing_is_deleted:
  Assert.False() Failure, Expected: False, Actual: True
- A_token_whose_record_value_was_edited_after_issue_is_refused:
  Assert.False() Failure, Expected: False, Actual: True
The_token_a_preview_issued_is_accepted passed first run; mutation check
(IsIssued forced false) made it fail, then restored.
The verify pass puts back a file that stayed behind (held by a scanner or a
launcher during the switch) with git checkout, which leaves that file as new
as the first writes were: git cannot trust its stamp and reads it in full on
every later comparison. The pass now runs the index refresh again after the
wait that follows a re-sync, before it looks again.

Comments now say "at the same moment as the index" instead of "the same
second", since git's racy check uses its own timestamp resolution.

Not done: reading the ignore-listed files once per switch instead of twice
(refresh, then the verify diff). git diff has no --pathspec-from-file, so
limiting the verify diff to the files the switch changed would mean paths on
the command line in batches, with several verify processes for a big switch;
that is not cheap and was left out.

Observed red (assertion failure):
- IndexRefreshTests.A_file_the_verify_pass_has_to_write_again_is_followed_by_another_refresh_before_the_next_look: Assert.Contains() Failure, filter not matched in collection
Adding wrote icons into hicolor/<size>/apps, creating those folders when
they were missing, and Remove left them behind empty. Add now records the
folders it created in the managed entry (X-SavePoint-Created-Folders,
relative to hicolor); an update carries the record forward. Remove deletes
each recorded folder deepest first, only when it is still empty, and only
names an add could have produced are read back, so an edited entry cannot
aim a delete elsewhere. A failed new add undoes its folders too.

Observed reds (assertion failures before the change):
- Removing_takes_away_the_size_folders_that_adding_made: Assert.False() got True
- Removing_keeps_folders_that_were_there_before_adding: Assert.False() got True
- Removing_keeps_a_folder_it_made_when_something_else_now_lives_in_it: Assert.False() got True
- An_update_keeps_the_record_of_the_folders_the_first_add_made: Assert.False() got True
- A_failed_new_add_takes_away_the_folders_it_made: Assert.False() got True
- Adding_writes_a_desktop_entry_with_exactly_these_fields: collections differ, new key missing
Mutation check: dropping the known-name filter made
Removing_never_deletes_a_folder_a_hand_edited_record_names fail.
Merge branch 'issue-101-icon-folders' into integration-101
Some checks failed
Gate / linux (pull_request) Failing after 11m12s
Gate / windows (pull_request) Has been cancelled
8d3dd430e9
Keep the Activity footer to one line
Some checks failed
Gate / linux (pull_request) Failing after 10m52s
Gate / windows (pull_request) Failing after 34m19s
15866b14a1
The longer footer wrapped and left the job list 93 px at 150% on a
small screen, which AppStateAuditTests refuses (activity-jobs and
activity-failed, Linux CI run 60). The job kept beyond the five
already says in its details that SavePoint no longer keeps it, and the
user guide explains the extra row.
Let the reclaim marker test accept a git that exited before it was stamped
All checks were successful
Gate / linux (pull_request) Successful in 12m11s
Gate / windows (pull_request) Successful in 26m22s
Wiki / publish (push) Successful in 45s
Gate / linux (push) Successful in 12m4s
Gate / windows (push) Successful in 26m15s
d7d5464a17
The test reads the marker before each git starts, so it sees the stamp of the git before. On Linux a git that has already exited when its start time is read is reaped at once and cannot be stamped, so it is not noted. That is safe, since nothing is left to wait for, but the test required a stamp at both reads and failed on the Linux gate (Assert.NotNull: Nullable<ProcessStamp> has no value, line 45).

The test now requires at least one of the two reads to name a git, and different gits when both do. Mutation check: with ReclaimStep's Started callback emptied, the test fails ("no git the reclaim started was noted").
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!112
No description provided.