fix(builder): profile.json is edited under the edit lock, read again after the picker #3021

Merged
HumanBean merged 2 commits from PedroRossi/Longshot:fix/profile-for-edit-lock into main 2026-12-05 18:55:53 +00:00
Contributor

Summary

profile_for (longshot-builder/src/play.rs) reads the profile, may open the game-file picker (which can stay open
for minutes), then writes the whole profile back, without the edit lock that launcher-profile's edit.rs says every
editor takes (the launcher's channel.rs does). A licence the launcher records while the picker is open is written
over, and DLSS is left out of the build; a mod added meanwhile likewise.

After the picker, profile_for now takes launcher_profile::edit_lock(dir), reads the profile again under it, makes
its change and writes.

How to see it on main: start a play that opens the picker, accept the DLSS licence in the launcher meanwhile, then pick
the game: the licence is gone from profile.json.

Read first: profile_for.

Testing

Tested: game-free: the new test (its picker changes the profile while open) fails on main and passes here;
longshot-builder's tests (LONGSHOT_NO_CLANG=1: the site-hooks test wants clang), clippy -D warnings, rustfmt. As pr create asks for a builder change: Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01: the game built by a builder from main @ 1938a302 with #3018, #3020 and #3021 merged, through the PC's job queue, played from the Market entrance repository save, then the control bridge's quit; exit 0. The profile code this changes runs in the launcher's play and build, not in the game. mise run test (--strict) on main @ 1938a302, and on main with this change merged (together with #3017, #3018, #3019, #3020, #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:

  • Linux or Windows, by hand with the launcher: as in "how to see it", expecting the licence kept

Measurements

Nothing to measure: one lock and one read of a small file, after the picker.

Risks

profile_for now waits for the edit lock when another editor holds it, up to the lock's wait, and fails with the
lock's error past it. A revert undoes it.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
The 145 checks of mise run test that fail on main @ 1938a302 on this PC too, with or without this change

97 need a tool this PC doesn't have on PATH (--strict fails them):

  • clang (63): test_audio_output_devices.py, test_box_light_reuse.py, test_camera_centering.py, test_camera_speed.py, test_drive_target.py, test_dynres_sites.py, test_exclusive_marks.py, test_fixed_scale_sites.py, test_floor_carry_step.py, test_frame_rate_cap_step.py, test_frame_whole.py, test_free_view_anchor.py, test_fullscreen_monitor_platform.py, test_high_fps_fixes.py, test_horse_jump_step.py, test_hos_ab.py, test_hud_layout.py, test_jump_takeoff_step.py, test_linux_audio_output.py, test_loop_step.py, test_menu_hooks.py, test_microphone_test_gain.py, test_monitor_friendly_names.py, test_mouse_native.py, test_movement_speed.py, test_movie_frame_count.py, test_nvn_null_pool.py, test_nvn_tex_builder_guard.py, test_ocarina_wait.py, test_ocb_hold.py, test_oot_barrier.py, test_oot_camera_clearance.py, test_oot_cloth.py, test_oot_cloth_60.py, test_oot_cloth_time.py, test_oot_damage.py, test_oot_fov.py, test_oot_heap_retry.py, test_oot_jitter.py, test_oot_shadow.py, test_oot_shadow_fit.py, test_oot_transition_autosave.py, test_oot_voice_option.py, test_oot_wide_bubble.py, test_oot_wide_save_picture.py, test_player_update_sites.py, test_sampler_stack_walk.py, test_saved_turn_rate.py, test_scarecrow_timing.py, test_scene_format.py, test_sdl_monitor_names.py, test_shadow_slot.py, test_song_note_cue.py, test_sound_held_frames.py, test_sprint.py, test_svc_core_mask.py, test_tex_compact.py, test_text_speed.py, test_title_card_sites.py, test_water_substeps.py, test_web_floor_steps.py, test_wide_sites.py, test_wide_ui.py
  • spirv-val (20): f2i_immediate, global_load_16, native_suatom, test_coop_spirv.py, test_default_point_size.py, test_depth_sample_types.py, test_draw_parameters.py, test_fsr4_tune.py, test_guest_page_fast32.py, test_image_arrays.py, test_mesh_fallback_layout.py, test_mesh_unreachable_outputs.py, test_mma_software.py, test_native_float_atomic_add.py, test_nonuniform_image_arrays.py, test_spirv_struct_identity.py, test_texture_phi_dominance.py, test_unsigned_image_types.py, test_vendor_translation.py, test_wmma16_spirv_val.py
  • clang++ (7): test_dead_targets_sweep.py, test_lower_depbar.py, test_lower_lds_after_sts.py, test_lower_register_markers.py, test_native_suatom.py, test_program_answer_domains.py, test_target_pool_cap.py
  • glslang (5): test_framegen_hdr.py, test_fsr3fi_hud_layer.py, test_fsr3fi_hudless_colour.py, test_host_shaders.py, test_temporal_present_bandwidth.py
  • glslang, spirv-val (1): test_fsr3_shaders.py
  • llvm-mc (1): test_lifter.py

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

## Summary `profile_for` (`longshot-builder/src/play.rs`) reads the profile, may open the game-file picker (which can stay open for minutes), then writes the whole profile back, without the edit lock that launcher-profile's `edit.rs` says every editor takes (the launcher's `channel.rs` does). A licence the launcher records while the picker is open is written over, and DLSS is left out of the build; a mod added meanwhile likewise. After the picker, `profile_for` now takes `launcher_profile::edit_lock(dir)`, reads the profile again under it, makes its change and writes. How to see it on main: start a play that opens the picker, accept the DLSS licence in the launcher meanwhile, then pick the game: the licence is gone from `profile.json`. Read first: `profile_for`. ## Testing **Tested:** game-free: the new test (its picker changes the profile while open) fails on main and passes here; longshot-builder's tests (LONGSHOT_NO_CLANG=1: the site-hooks test wants clang), clippy -D warnings, rustfmt. As `pr create` asks for a builder change: Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01: the game built by a builder from main @ 1938a302 with #3018, #3020 and #3021 merged, through the PC's job queue, played from the Market entrance repository save, then the control bridge's quit; exit 0. The profile code this changes runs in the launcher's play and build, not in the game. `mise run test` (`--strict`) on main @ 1938a302, and on main with this change merged (together with #3017, #3018, #3019, #3020, #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:** - Linux or Windows, by hand with the launcher: as in "how to see it", expecting the licence kept ## Measurements Nothing to measure: one lock and one read of a small file, after the picker. ## Risks `profile_for` now waits for the edit lock when another editor holds it, up to the lock's wait, and fails with the lock's error past it. A revert undoes it. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. <details><summary>The 145 checks of <code>mise run test</code> that fail on main @ 1938a302 on this PC too, with or without this change</summary> 97 need a tool this PC doesn't have on PATH (`--strict` fails them): - clang (63): test_audio_output_devices.py, test_box_light_reuse.py, test_camera_centering.py, test_camera_speed.py, test_drive_target.py, test_dynres_sites.py, test_exclusive_marks.py, test_fixed_scale_sites.py, test_floor_carry_step.py, test_frame_rate_cap_step.py, test_frame_whole.py, test_free_view_anchor.py, test_fullscreen_monitor_platform.py, test_high_fps_fixes.py, test_horse_jump_step.py, test_hos_ab.py, test_hud_layout.py, test_jump_takeoff_step.py, test_linux_audio_output.py, test_loop_step.py, test_menu_hooks.py, test_microphone_test_gain.py, test_monitor_friendly_names.py, test_mouse_native.py, test_movement_speed.py, test_movie_frame_count.py, test_nvn_null_pool.py, test_nvn_tex_builder_guard.py, test_ocarina_wait.py, test_ocb_hold.py, test_oot_barrier.py, test_oot_camera_clearance.py, test_oot_cloth.py, test_oot_cloth_60.py, test_oot_cloth_time.py, test_oot_damage.py, test_oot_fov.py, test_oot_heap_retry.py, test_oot_jitter.py, test_oot_shadow.py, test_oot_shadow_fit.py, test_oot_transition_autosave.py, test_oot_voice_option.py, test_oot_wide_bubble.py, test_oot_wide_save_picture.py, test_player_update_sites.py, test_sampler_stack_walk.py, test_saved_turn_rate.py, test_scarecrow_timing.py, test_scene_format.py, test_sdl_monitor_names.py, test_shadow_slot.py, test_song_note_cue.py, test_sound_held_frames.py, test_sprint.py, test_svc_core_mask.py, test_tex_compact.py, test_text_speed.py, test_title_card_sites.py, test_water_substeps.py, test_web_floor_steps.py, test_wide_sites.py, test_wide_ui.py - spirv-val (20): f2i_immediate, global_load_16, native_suatom, test_coop_spirv.py, test_default_point_size.py, test_depth_sample_types.py, test_draw_parameters.py, test_fsr4_tune.py, test_guest_page_fast32.py, test_image_arrays.py, test_mesh_fallback_layout.py, test_mesh_unreachable_outputs.py, test_mma_software.py, test_native_float_atomic_add.py, test_nonuniform_image_arrays.py, test_spirv_struct_identity.py, test_texture_phi_dominance.py, test_unsigned_image_types.py, test_vendor_translation.py, test_wmma16_spirv_val.py - clang++ (7): test_dead_targets_sweep.py, test_lower_depbar.py, test_lower_lds_after_sts.py, test_lower_register_markers.py, test_native_suatom.py, test_program_answer_domains.py, test_target_pool_cap.py - glslang (5): test_framegen_hdr.py, test_fsr3fi_hud_layer.py, test_fsr3fi_hudless_colour.py, test_host_shaders.py, test_temporal_present_bandwidth.py - glslang, spirv-val (1): test_fsr3_shaders.py - llvm-mc (1): test_lifter.py 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 </details> --- 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](https://claude.com/claude-code)
profile_for reads profile.json, may open the file picker (which can stay open for minutes), then writes the whole
profile back, without the edit lock every editor of profile.json takes (launcher-profile's edit.rs; the launcher's
channel.rs does): a licence the launcher records meanwhile is written over, and DLSS left out of the build. The test's
picker makes such a change; fails on main. launcher-profile is a dev-dependency for it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(builder): profile.json is edited under the edit lock, read again after the picker
Some checks failed
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
e508b3aaef
After the picker, profile_for takes launcher_profile::edit_lock and reads the profile again under it, so what the
launcher or a mod tool wrote meanwhile is kept, then makes its change and writes. launcher-profile moves to the
dependencies.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01: the game built by a builder from main @ 1938a302 with this change merged (and my two other builder pull requests from the same audit), through the PC's job queue, played from the Market entrance repository save, then the control bridge's quit; exit 0. The profile code this changes runs in the launcher's play and build, not in the game.

Tested in game: Debian 13, GeForce GTX 1660 SUPER, NVIDIA 550.163.01: the game built by a builder from main @ 1938a302 with this change merged (and my two other builder pull requests from the same audit), through the PC's job queue, played from the Market entrance repository save, then the control bridge's quit; exit 0. The profile code this changes runs in the launcher's play and build, not in the game.
PedroRossi changed title from WIP: fix(builder): profile.json is edited under the edit lock, read again after the picker to fix(builder): profile.json is edited under the edit lock, read again after the picker 2026-12-02 17:54:27 +00:00
Owner
@review
BeanBot requested changes 2026-12-02 21:37:20 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. The reread preserves edits completed while the picker is open, but the lock it relies on can admit two editors at once and still lose a profile update.

The builder rereads the profile after the picker and applies its settings under the shared edit lock, preserving intervening changes in the tested sequence. The added lock and reread are small, but the lock's acquisition race leaves the underlying lost-update bug possible.

Blocking (1): must change before merging.

  1. L1 builder/crates/longshot-builder/src/play.rs:304: The edit lock used here does not reliably exclude a concurrent editor: its new lock file is visible before its holder text is written, and another taker treats that empty file as stale. (more on the line) Do: Make lock publication and stale recovery mutually safe for concurrent takers, and add a deterministic test covering acquisition while the first lock is being published.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L2: The launcher workflow described in the pull request is still awaiting a manual run. When: The unit test supplies its own picker and profile edit; it does not exercise accepting the licence through the launcher while its real picker is open. Do: Run the stated launcher scenario on Linux or Windows and confirm the accepted licence remains and is used by the build.

@fix can do L1.

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes for an edit completed while the picker is open: the new game-free test exercises that sequence and the author reports it fails on the base and passes here. Simultaneous lock acquisition remains unsafe.

Other systems: The same profile path is used by play and build on Windows and Linux, and by launcher and mod editors using launcher-profile's edit lock. The game's rendering and runtime are unchanged. The reported game run does not exercise the launcher licence-acceptance scenario.

Switches: None.

Reviewed: e508b3aaef against 1938a302fe: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, both commits, the complete diff, Cargo.toml, play.rs and the edit-lock implementation; traced profile reads and writes and the build and play callers. Skimmed Cargo.lock and the reported runs. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance.
  • The new test checks the persisted licence and returned profile, and the author reports it fails on the base.
  • No game-derived files, generated source, API version changes or switch changes appear in the diff.

Testing: Read-only review; no commands from the project, builds or tests were run. CI was still running in the supplied status.

Overlaps and merge order: Unknown; network access is closed and no overlapping pull request was supplied.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The reread preserves edits completed while the picker is open, but the lock it relies on can admit two editors at once and still lose a profile update. The builder rereads the profile after the picker and applies its settings under the shared edit lock, preserving intervening changes in the tested sequence. The added lock and reread are small, but the lock's acquisition race leaves the underlying lost-update bug possible. **Blocking (1)**: must change before merging. 1. **L1** `builder/crates/longshot-builder/src/play.rs:304`: The edit lock used here does not reliably exclude a concurrent editor: its new lock file is visible before its holder text is written, and another taker treats that empty file as stale. (more on the line) **Do:** Make lock publication and stale recovery mutually safe for concurrent takers, and add a deterministic test covering acquisition while the first lock is being published. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L2**: The launcher workflow described in the pull request is still awaiting a manual run. *When:* The unit test supplies its own picker and profile edit; it does not exercise accepting the licence through the launcher while its real picker is open. **Do:** Run the stated launcher scenario on Linux or Windows and confirm the accepted licence remains and is used by the build. `@fix` can do L1. **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for an edit completed while the picker is open: the new game-free test exercises that sequence and the author reports it fails on the base and passes here. Simultaneous lock acquisition remains unsafe. **Other systems:** The same profile path is used by play and build on Windows and Linux, and by launcher and mod editors using launcher-profile's edit lock. The game's rendering and runtime are unchanged. The reported game run does not exercise the launcher licence-acceptance scenario. **Switches:** None. **Reviewed:** e508b3aaef57 against 1938a302feb0: Read AGENTS.md, CONTRIBUTING.md, the pull request template, standards, both commits, the complete diff, Cargo.toml, play.rs and the edit-lock implementation; traced profile reads and writes and the build and play callers. Skimmed Cargo.lock and the reported runs. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance. - The new test checks the persisted licence and returned profile, and the author reports it fails on the base. - No game-derived files, generated source, API version changes or switch changes appear in the diff. **Testing:** Read-only review; no commands from the project, builds or tests were run. CI was still running in the supplied status. **Overlaps and merge order:** Unknown; network access is closed and no overlapping pull request was supplied. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -301,1 +301,4 @@
};
// (the edit lock for the change, taken after the picker, which can stay open for minutes: the profile is read again
// under it, so what the launcher or a mod tool wrote meanwhile is kept; launcher-profile's edit.rs)
let _lock = launcher_profile::edit_lock(dir).map_err(|e| (FAILED, e.to_string()))?;
Member

L1 (blocking): The edit lock used here does not reliably exclude a concurrent editor: its new lock file is visible before its holder text is written, and another taker treats that empty file as stale.

When: If the builder creates the lock file and is paused before writing its PID, a launcher or mod editor can read the empty file, rename it as stale, and acquire a replacement. Both then read and write the profile under guards they believe are exclusive, so the later write can discard the other's licence or mod change.

Do: Make lock publication and stale recovery mutually safe for concurrent takers, and add a deterministic test covering acquisition while the first lock is being published.

**L1** (blocking): The edit lock used here does not reliably exclude a concurrent editor: its new lock file is visible before its holder text is written, and another taker treats that empty file as stale. *When:* If the builder creates the lock file and is paused before writing its PID, a launcher or mod editor can read the empty file, rename it as stale, and acquire a replacement. Both then read and write the profile under guards they believe are exclusive, so the later write can discard the other's licence or mod change. **Do:** Make lock publication and stale recovery mutually safe for concurrent takers, and add a deterministic test covering acquisition while the first lock is being published.
PedroRossi force-pushed fix/profile-for-edit-lock from e508b3aaef
Some checks failed
PR description / Title and description (pull_request_target) Successful in 7s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to a295342302
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-04 19:22:27 +00:00
Compare
Author
Contributor

Rebased onto current main (which rewrote play.rs, though profile_for still read-before-picker and wrote without the lock). The fix is the same — take launcher_profile::edit_lock after the picker and re-read the profile under it — and it now rests on #3020, where that lock became a real OS advisory lock (one holder at a time), so the concurrency concern in the review is handled there. The test (a_change_made_while_the_picker_is_open_is_kept) is verified to fail on main and pass here.

Rebased onto current main (which rewrote play.rs, though profile_for still read-before-picker and wrote without the lock). The fix is the same — take launcher_profile::edit_lock after the picker and re-read the profile under it — and it now rests on #3020, where that lock became a real OS advisory lock (one holder at a time), so the concurrency concern in the review is handled there. The test (a_change_made_while_the_picker_is_open_is_kept) is verified to fail on main and pass here.
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The profile is re-read after the picker, but the edit lock still allows two concurrent editors to enter. A licence or mod change can therefore still be overwritten.

The change re-reads the profile under the edit lock after the picker and includes a test for a licence accepted while it is open. Its protection against simultaneous writes depends on a lock that still has a race.

Blocking (1): must change before merging.

  1. L1 builder/crates/longshot-builder/src/play.rs:304: The edit lock used here does not reliably exclude a concurrent editor: its new lock file is visible before its holder text is written, and another taker treats that empty file as stale. When: If the builder creates the lock file and is paused before writing its PID, a launcher or mod editor can read the empty file, rename it as stale, and acquire a replacement. Both then read and write the profile under guards they believe are exclusive, so the later write can discard the other's licence or mod change. Do: Make lock publication and stale recovery mutually safe for concurrent takers, and add a deterministic test covering acquisition while the first lock is being published.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L2: The launcher workflow described in the pull request is still awaiting a manual run. When: The unit test supplies its own picker and profile edit; it does not exercise accepting the licence through the launcher while its real picker is open. Do: Run the stated launcher scenario on Linux or Windows and confirm the accepted licence remains and is used by the build.

@fix can do L1.

Since the last review (on e508b3aaef)
Still open: L1 (The edit lock used here does not reliably exclude a concurrent editor: its new lock file i…); L2 (The launcher workflow described in the pull request is still awaiting a manual run.)

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Unproven: the author reports that the game-free picker test fails on main and passes with this change, but the lock race remains and the manual launcher workflow has not been run.

Other systems: The same edit lock coordinates launcher and mod-tool profile edits on Linux and Windows; its empty-file race applies on both. The game itself does not run the changed profile code.

Switches: None.

Reviewed: a295342302 against b77c2f4b3e: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the diff, play.rs and launcher-profile/src/edit.rs. Reviewed the supplied comments, CI status and test claims; the adjacent Tooling rules and docs/review-checklist.md were unavailable.; nothing run (a code review).

Checked and fine:

  • The profile is read again after the picker and held under the guard through the write.
  • The new test checks both the returned and persisted licence after a picker-time edit.
  • No new dependency is needed at this base.

Testing: The author reports a game-free test failing on main and passing here, builder tests, clippy and rustfmt. The manual launcher interaction remains outstanding; CI is still running. No commands that execute project code were run during review.

Overlaps and merge order: The author identifies #3020 as the intended lock fix, but that implementation is absent at this head; it must be incorporated before this change can rely on it.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The profile is re-read after the picker, but the edit lock still allows two concurrent editors to enter. A licence or mod change can therefore still be overwritten. The change re-reads the profile under the edit lock after the picker and includes a test for a licence accepted while it is open. Its protection against simultaneous writes depends on a lock that still has a race. **Blocking (1)**: must change before merging. 1. **L1** `builder/crates/longshot-builder/src/play.rs:304`: The edit lock used here does not reliably exclude a concurrent editor: its new lock file is visible before its holder text is written, and another taker treats that empty file as stale. *When:* If the builder creates the lock file and is paused before writing its PID, a launcher or mod editor can read the empty file, rename it as stale, and acquire a replacement. Both then read and write the profile under guards they believe are exclusive, so the later write can discard the other's licence or mod change. **Do:** Make lock publication and stale recovery mutually safe for concurrent takers, and add a deterministic test covering acquisition while the first lock is being published. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L2**: The launcher workflow described in the pull request is still awaiting a manual run. *When:* The unit test supplies its own picker and profile edit; it does not exercise accepting the licence through the launcher while its real picker is open. **Do:** Run the stated launcher scenario on Linux or Windows and confirm the accepted licence remains and is used by the build. `@fix` can do L1. **Since the last review** (on e508b3aaef57) Still open: L1 (The edit lock used here does not reliably exclude a concurrent editor: its new lock file i…); L2 (The launcher workflow described in the pull request is still awaiting a manual run.) **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the author reports that the game-free picker test fails on main and passes with this change, but the lock race remains and the manual launcher workflow has not been run. **Other systems:** The same edit lock coordinates launcher and mod-tool profile edits on Linux and Windows; its empty-file race applies on both. The game itself does not run the changed profile code. **Switches:** None. **Reviewed:** a295342302d7 against b77c2f4b3e41: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, the diff, play.rs and launcher-profile/src/edit.rs. Reviewed the supplied comments, CI status and test claims; the adjacent Tooling rules and docs/review-checklist.md were unavailable.; nothing run (a code review). **Checked and fine:** - The profile is read again after the picker and held under the guard through the write. - The new test checks both the returned and persisted licence after a picker-time edit. - No new dependency is needed at this base. **Testing:** The author reports a game-free test failing on main and passing here, builder tests, clippy and rustfmt. The manual launcher interaction remains outstanding; CI is still running. No commands that execute project code were run during review. **Overlaps and merge order:** The author identifies #3020 as the intended lock fix, but that implementation is absent at this head; it must be incorporated before this change can rely on it. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
Owner
@fix
BeanBot force-pushed fix/profile-for-edit-lock from a295342302
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 7f78fd41a5
Some checks are pending
PR description / Title and description (pull_request_target) Successful in 6s
CI / What the change needs (pull_request) Successful in 8s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Waiting to run
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Waiting to run
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Waiting to run
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Waiting to run
CI / Website build and checks (pull_request) Waiting to run
CI / Third-party parts and guide screenshots (pull_request) Successful in 13s
2026-12-05 18:45:18 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left (a run of the change itself). The profile update now re-reads under the edit lock, and the reported game-free test covers the lost-licence case. The end-to-end launcher interaction is still awaiting a manual run. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is 7f78fd41a5. I rebased it onto main (14f452f810). I edited its description to match the change.

Changed

  • Profile edit lock publication: The updated base already uses an OS advisory lock, avoiding stale-file recovery. Added a deterministic test for a taker paused after opening the empty lock file in builder/crates/launcher-profile/src/edit.rs:118, and updated the build-driver tests to check that the lock is released rather than removed. Tests were not run, as requested.

Nothing was built or run: the checks run again on the new head.

The builder preserves profile changes made while the game-file picker is open. It adds a short lock wait and a second profile read; the follow-up adds lock tests without changing the fix.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L2: The launcher workflow described in the pull request is still awaiting a manual run. When: The unit test supplies its own picker and profile edit; it does not exercise accepting the licence through the launcher while its real picker is open. Do: Run the stated launcher scenario on Linux or Windows and confirm the accepted licence remains and is used by the build.

Checks: they run again on this head; a failure shows on the pull request.

More: does it help, other systems, switches, what was read

Does it help: Unproven end to end: the author reports that the game-free test fails on main and passes with the fix, but the launcher workflow has not yet been run by hand.

Other systems: The profile path is used by launcher play and build on Windows and Linux. The lock uses the operating system's advisory lock; the reported in-game run does not exercise the launcher interaction.

Switches: None.

Reviewed: 7f78fd41a5 against 14f452f810: Read AGENTS.md, CONTRIBUTING.md, the pull request template, launcher-profile/src/edit.rs, the profile_for implementation, the changed test contexts, and the fix diff. The stated base-to-head diff spans 896 files; it was only skimmed and was not read in full. docs/review-checklist.md was absent.; nothing run (a code review).

Checked and fine:

  • The lock is acquired after the picker and held through the second profile read and write.
  • The follow-up checks that the advisory lock is released without requiring its file to be removed.
  • The follow-up does not remove or bypass the profile fix.

Testing: The author reports the targeted game-free test, builder tests, clippy and rustfmt passed. CI has not run on this head; no commands that execute project code were run for this review.

Overlaps and merge order: The change rests on the advisory-lock change #3020, which is present in the head.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left (a run of the change itself). The profile update now re-reads under the edit lock, and the reported game-free test covers the lost-licence case. The end-to-end launcher interaction is still awaiting a manual run. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is 7f78fd41a557. I rebased it onto `main` (14f452f810a3). I edited its description to match the change. **Changed** - **Profile edit lock publication**: The updated base already uses an OS advisory lock, avoiding stale-file recovery. Added a deterministic test for a taker paused after opening the empty lock file in builder/crates/launcher-profile/src/edit.rs:118, and updated the build-driver tests to check that the lock is released rather than removed. Tests were not run, as requested. Nothing was built or run: the checks run again on the new head. The builder preserves profile changes made while the game-file picker is open. It adds a short lock wait and a second profile read; the follow-up adds lock tests without changing the fix. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L2**: The launcher workflow described in the pull request is still awaiting a manual run. *When:* The unit test supplies its own picker and profile edit; it does not exercise accepting the licence through the launcher while its real picker is open. **Do:** Run the stated launcher scenario on Linux or Windows and confirm the accepted licence remains and is used by the build. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven end to end: the author reports that the game-free test fails on main and passes with the fix, but the launcher workflow has not yet been run by hand. **Other systems:** The profile path is used by launcher play and build on Windows and Linux. The lock uses the operating system's advisory lock; the reported in-game run does not exercise the launcher interaction. **Switches:** None. **Reviewed:** 7f78fd41a557 against 14f452f810a3: Read AGENTS.md, CONTRIBUTING.md, the pull request template, launcher-profile/src/edit.rs, the profile_for implementation, the changed test contexts, and the fix diff. The stated base-to-head diff spans 896 files; it was only skimmed and was not read in full. docs/review-checklist.md was absent.; nothing run (a code review). **Checked and fine:** - The lock is acquired after the picker and held through the second profile read and write. - The follow-up checks that the advisory lock is released without requiring its file to be removed. - The follow-up does not remove or bypass the profile fix. **Testing:** The author reports the targeted game-free test, builder tests, clippy and rustfmt passed. CI has not run on this head; no commands that execute project code were run for this review. **Overlaps and merge order:** The change rests on the advisory-lock change #3020, which is present in the head. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch fix/profile-for-edit-lock 2026-12-05 18:55:54 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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
MagicBeanDev/Longshot!3021
No description provided.