fix(saves): longshot_saves.py takes the save the game plays, a launcher profile's #3019
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3019
Loading…
Reference in a new issue
No description provided.
Delete branch "PedroRossi/Longshot:fix/save-tool-profiles"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
scripts/longshot_saves.py(moves saves between Longshot and the emulators) looks, with no--longshot, only wheresaves were before profiles (
$XDG_DATA_HOME/longshot/save/<id>,%APPDATA%\Longshot\save, ...). The launcher plays aprofile, from
<profile>/saves/save/<id>, and the old copy stays behind, frozen:exportsends old progress to theemulator, and
importwrites where the game never reads, then prints Done.The launcher's profiles are now looked in first (by default,
<data>/longshot/profileson Linux and%LOCALAPPDATA%\Longshot\data\profileson Windows; configured and nearby portable libraries are also found): the oneprofile with a save is used. If no profile has a save, an import goes into the only profile and an export stops, even if
an old save exists. With several profiles holding saves, or several profiles and none holding a save, the tool stops and
names them for
--longshot. With no profile the old folders are used as before.How to see it on main: play a profile until it saves, then run
longshot_saves.py export: it exports the old datafolder's save, or finds none.
Read first:
profile_saves,one_profileandlocateinscripts/longshot_saves.py.Testing
Tested: game-free: 4 new cases (export, import, a profile with no save yet, several profiles) fail on main and pass
here, with the rest of test_longshot_saves.py; ruff. By hand on this PC (Linux), the real tool on copies of a real save tagged so they
differ, in a data folder holding a launcher profile and the save from before profiles: main's export sent the old
save and its import wrote the old place; with this change the export sent the profile's save, the import went into
the profile, and with saves in two profiles the tool stopped and named both.
mise run test(--strict) on main @1938a302, and on main with this change merged (together with #3017, #3018, #3020, #3021, #3022, from the same audit): 775 passed, 145 failed, 10 skipped both ways, so none fails only with it. The 145 are named at the end.Still to test:
progress
Measurements
Nothing to measure: a folder lookup in a command-line tool.
Risks
With saves in several profiles, the tool now asks for
--longshotand lists them, where it took the old folder. A playeron the old layout (no profiles) sees no change. #3013 changes the same two files elsewhere; the two merge
with no conflict.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.The 145 checks of
mise run testthat fail on main @1938a302on this PC too, with or without this change97 need a tool this PC doesn't have on PATH (
--strictfails them):48 fail on main itself: test_blocks_at_start.py, test_bug_report.py, test_cloth_kernels.py, test_cloth_loops.py, test_cloth_sphere.py, test_cloth_step12.py, test_cloth_step8.py, test_cloth_step9.py, test_control_picture.py, test_crash_record.py, test_crt_options.py, test_dev_update.py, test_dlssg_pace.py, test_draw_stream_visibility.py, test_framegen_resources.py, test_fsr_uniform_ownership.py, test_game_boundary.py, test_guest_holes.py, test_image_reaper_threads.py, test_image_view_retry.py, test_input_background.py, test_keyboard_option.py, test_linux_pressure.py, test_loaded_modules_drop.py, test_log_levels.py, test_menu_keys.py, test_menu_save_atomic.py, test_mesh_first_types.py, test_oot_occ_raster.py, test_option_ids.py, test_perf_send.py, test_pipeline_tour.py, test_present_acquire_ahead.py, test_present_image_free.py, test_present_source_crop.py, test_program_cache_cleanup.py, test_program_cache_one_variant.py, test_readback_timeout_reuse.py, test_recording_admission.py, test_screensaver.py, test_switch_table.py, test_target_retention.py, test_tex_desc_memo.py, test_thinlto_tls.py, test_upscaler_round_trip.py, test_vram_compact.py, test_windows_display_startup.py, test_windows_on_linux.py
Found in an AI-assisted audit of the repository. The test, the fix, the runs and this description were made with Claude Code; I reviewed them.
Co-Authored-By: Claude Opus 5.5 [email protected]
🤖 Generated with Claude Code
Possibly related, for context:
WIP: fix(saves): longshot_saves.py takes the save the game plays, a launcher profile'sto fix(saves): longshot_saves.py takes the save the game plays, a launcher profile'sPedroRossi referenced this pull request2026-12-02 17:54:18 +00:00
@review
Recommendation: Request changes. The lookup fixes the default layout in the tested case, but can still export stale progress or report a successful import to a folder the game will not read. Configured launcher libraries and empty profiles need safe handling before merge.
The tool prefers launcher profile saves over legacy saves and asks the user to choose when several profiles have saves. This helps the default-layout case, but its fallback can select stale saves and its Windows override can write to the wrong folder.
Blocking (3): must change before merging.
scripts/longshot_saves.py:56: Profile discovery ignores the launcher's configured data folder and portable library. (more on the line) Do: Resolve launcher library locations using the launcher's settings and portable layout, or stop and require an explicit profile when the active library cannot be determined.scripts/longshot_saves.py:222: An empty profile falls back to a legacy save even when the builder will no longer carry that save into the profile. (more on the line) Do: When a profile exists, select or require a profile for imports instead of relying on a later legacy migration; do not export the legacy save as the played profile when migration will not occur.scripts/longshot_saves.py:1259: The advertised profile-saves override writes to the wrong location on Windows when that folder has no save directory yet. (more on the line) Do: Recognize an explicit profile saves directory as a data folder even before its save child exists, and add a Windows case for importing into it.@fixcan do L1, L2 and L3.Questions (1) (not confirmed from the code; they don't hold the recommendation)
tests/test_longshot_saves.py:304: Which concrete regression do you expect the missing Windows profile tests to catch?Checks: Still running: 10 checks.
More: does it help, other systems, switches, what was read
Does it help: Yes for the tested default Linux layout: the author reports that export and import used the profile save instead of the legacy copy, and that four game-free cases failed on main and passed here. Windows and Steam Deck runs remain outstanding.
Other systems: This changes a save-transfer tool, not game rendering or timing. Windows, portable launchers, configured data folders, empty profiles and legacy saves can change which data is copied; the reported Linux run covers only the default profile location.
Switches: No switches added, changed or removed.
Reviewed:
56d018bc21against1938a302fe: Read AGENTS.md, CONTRIBUTING.md, the PR template, relevant standards and profile documentation, the diff and commits, and the changed save-discovery and copy call paths. Skimmed the remainder of the large save script and test file; did not read either in full. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review).Checked and fine:
Testing: Read-only review; no code or tests were run. The author reports Linux manual and game-free checks; CI is still running.
Overlaps and merge order: The description reports #3013 changes the same files elsewhere and merges without conflict; no independent overlap search was available.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -51,0 +53,4 @@# The launcher's profiles (longshot-builder's play): Longshot plays one, its saves in <profile>/saves (save/<id> there,# as in a data folder). Looked in first: the data folders keep the saves from before profiles as they were, and a# profile's first start copies them in while its saves are empty (build-driver's carry_saves)PROFILE_FOLDERS = {"linux": "{data}/longshot/profiles", "windows": "{localappdata}/Longshot/data/profiles"}L1 (blocking): Profile discovery ignores the launcher's configured data folder and portable library.
When: When launcher-settings.json selects another dataFolder, or a portable launcher owns the profile, the game plays that library's profiles but this lookup sees only the default root. Export can copy the frozen legacy save, and import can report success after writing there instead of to the played profile.
Do: Resolve launcher library locations using the launcher's settings and portable layout, or stop and require an explicit profile when the active library cannot be determined.
@ -197,2 +219,4 @@"emulator's nand\\user\\save): start the game there once and save" % (override, TITLE))return override, foundif program is LONGSHOT:played = one_profile(profile_saves(), flag, "saves in")L2 (blocking): An empty profile falls back to a legacy save even when the builder will no longer carry that save into the profile.
When: Start a profile while no old save exists, then add a legacy save: prepare_profile has made saves/save and saves/save-work, so carry_saves treats the profile's saves directory as nonempty. This lookup finds no profile save and imports into or exports from the legacy folder, while the game continues using the empty profile.
Do: When a profile exists, select or require a profile for imports instead of relying on a later legacy migration; do not export the legacy save as the played profile when migration will not occur.
@ -1227,7 +1257,8 @@ def main(argv=None):p.add_argument("name", nargs="?", help="where from or to: %s" % ", ".join(e.name for e in OTHERS))p.add_argument("--from", dest="from_dir", metavar="DIR", help="import from this folder (a save, or one to search)")p.add_argument("--to", dest="to_dir", metavar="DIR", help="export to this folder (a save, or one to search)")L3 (blocking): The advertised profile-saves override writes to the wrong location on Windows when that folder has no save directory yet.
When: For an import with --longshot pointing to an existing empty /saves, locate fails and new_save_folder treats it as a game folder because it has no save child. It writes saves/user/save/, while the game reads saves/save/, and reports success.
Do: Recognize an explicit profile saves directory as a data folder even before its save child exists, and add a Windows case for importing into it.
@fix
56d018bc21ee6589660bRecommendation: Request changes. A portable library outside the script’s and current directory’s ancestors can still be missed, causing the tool to select an old installed save instead. The active-library selection needs a maintainer decision.
What
@fixchangedI changed this pull request: the new head is
ee6589660b. I rebased it ontomain(3e8105ebf8). I edited its description to match the change.Changed
Left for the author
Nothing was built or run: the checks run again on the new head.
The tool selects launcher profile saves before legacy saves, including configured and nearby portable libraries. It also handles empty profiles and Windows profile overrides, at the cost of more library-discovery logic.
Blocking (1): must change before merging.
scripts/longshot_saves.py:56: Portable libraries outside the script’s and current directory’s ancestors are still ignored. When: When the player uses a portable launcher elsewhere and runs the script from an unrelated directory, profile_root selects the installed library or legacy fallback; export can copy stale progress and import can write to a save the portable game does not use. Do: Require an explicit profile when the active library cannot be determined safely, or provide another reliable way to identify the portable library before falling back. (for the author:@fixcouldn't: profile_root only searches ancestors of the current directory and script for portable markers. A portable library elsewhere remains undetected, so the active library still needs a selection policy.)Should fix (1): not blocking, but worth doing before merging.
scripts/longshot_saves.py:168: A broken installed launcher settings file prevents use of an otherwise discoverable portable library. (more on the line) Do: Resolve the portable library independently of installed settings, while retaining an explicit ambiguity check when both libraries can be identified.@fixcan do L4.Checks: they run again on this head; a failure shows on the pull request.
Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes for the tested Linux profile case: the description reports that export and import used the profile save instead of the frozen legacy copy, and that the game-free cases failed on main and passed with the change. The latest fix was not run.
Other systems: Windows and portable libraries use different discovery paths; the description requests a Windows hand test. Steam Deck uses the Linux path. The game, renderer and save format are unchanged.
Switches: No switch added, changed or removed. The existing LONGSHOT_LAUNCHER_HOME is now read for library discovery.
Reviewed:
ee6589660bagainst3e8105ebf8: Read AGENTS.md, CONTRIBUTING.md, the pull request template, the relevant standards, the save-discovery code and the fix diff. Skimmed the test file and builder library-resolution code; output for the full changed files was truncated. The supplied base diff also contains unrelated merged changes, which were not reviewed in full. Tooling's AGENTS.md was unavailable.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run. The reported Linux hand test predates the latest fix; CI has not run on this head.
Overlaps and merge order: The description identifies #3013 as touching the same files without a conflict; no independent overlap check was available.
Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.
@ -127,0 +165,4 @@with open(settings, encoding="utf-8") as f:prefs = json.load(f)except FileNotFoundError:prefs = {}L4 (should fix): A broken installed launcher settings file prevents use of an otherwise discoverable portable library.
When: When the current directory is inside a marked portable library but the installed launcher's settings contain invalid JSON, profile_root raises before selecting the portable root, so import and export stop.
Do: Resolve the portable library independently of installed settings, while retaining an explicit ambiguity check when both libraries can be identified.
@fix
L4 only (resolve the broken-settings fallback), and rebase onto current main to clear the conflict. The blocking L1 (how to pick the active library when a portable launcher may be anywhere) is a policy decision I'm leaving to the maintainers, not for @fix.
ee6589660b0ec67765c6Rebased onto current main and worked the review:
locateno longer falls through to the folder from before profiles when a launcher profile exists but has no save yet — the launcher plays that profile, so export won't send the stale pre-profile save; import still targets the empty profile.new_save_folderkeeps a new save insave/<id>under an explicitsavesfolder, not theuser/save/<id>of a game folder.LONGSHOT_PROFILE_DIRis relative to the version folder, which the tool doesn't have — so I took the "name it explicitly" option you allowed: a single default profile is still auto-selected, several still require--longshot, and the pre-profile fallback now prints how to point--longshotat a launcher that keeps its data elsewhere, so the wrong library isn't used in silence.Three new game-free tests, each shown to fail without the change.
mise run testotherwise as on main.@review
Recommendation: Request changes. The tool still ignores portable libraries outside its default profile root, so it can copy stale saves or write to a location the game does not use. A discoverable nearby portable library is also no longer found when launcher settings are broken.
The change selects saves from default launcher profiles and avoids exporting a stale pre-profile save when a default profile is empty. Its remaining library-selection gaps can still send or overwrite the wrong progress.
Blocking (1): must change before merging.
scripts/longshot_saves.py:56: Portable libraries outside the script’s and current directory’s ancestors are still ignored. When: When the player uses a portable launcher elsewhere and runs the script from an unrelated directory, profile_root selects the installed library or legacy fallback; export can copy stale progress and import can write to a save the portable game does not use. Do: Require an explicit profile when the active library cannot be determined safely, or provide another reliable way to identify the portable library before falling back. (for the author:@fixcouldn't: profile_saves reads only the fixed default PROFILE_FOLDERS root. A portable library elsewhere remains undetected, and the fallback warning does not prevent selection of a stale default save or a write)Should fix (1): not blocking, but worth doing before merging.
scripts/longshot_saves.py:168: A broken installed launcher settings file prevents use of an otherwise discoverable portable library. When: When the current directory is inside a marked portable library but the installed launcher's settings contain invalid JSON, profile_root raises before selecting the portable root, so import and export stop. Do: Resolve the portable library independently of installed settings, while retaining an explicit ambiguity check when both libraries can be identified.@fixcan do L4.Since the last review (on
ee6589660b)Still open: L1 (Portable libraries outside the script’s and current directory’s ancestors are still ignore…); L4 (A broken installed launcher settings file prevents use of an otherwise discoverable portab…)
Checks: Still running: 10 checks.
Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes for default profiles: the author reports a Linux run using distinct real-save copies and game-free tests for export, import, empty profiles and ambiguity. Configured and portable library selection remains incomplete.
Other systems: The lookup affects imports and exports on Linux and Windows, including Steam Deck and portable launchers. The reported hand run covers Linux; Windows and Steam Deck runs are still listed as pending.
Switches: No switches added, changed or removed.
Reviewed:
0ec67765c6againstb77c2f4b3e: Read the repository rules, pull request template, diff, profile lookup and copy-selection code, and relevant save tests; skimmed the remainder of the changed files. docs/review-checklist.md and the adjacent Tooling AGENTS.md are absent.; nothing run (a code review).Checked and fine:
Testing: No commands that run project code or tests were executed. The author reports game-free tests and a Linux hand run; CI is still running.
Overlaps and merge order: The pull request identifies #3013 as touching the same files without a conflict.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.