fix(sandbox): Windows: a sandboxed test run finds a mod outside the mods folder #2747
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!2747
Loading…
Reference in a new issue
No description provided.
Delete branch "ChloeNow/Longshot:fix/sandbox-dev-mods-start"
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?
fix(sandbox): Windows: a sandboxed test run finds a mod outside the mods folder
Summary
On Windows, a sandboxed in-game test run (
dev.py game-tests <folder>,Longshot.exe mod test --game <folder>) of amod outside the mods folder found no mod: "no mod to test was found (a folder with mod.toml, or a folder of them)". That
covers any folder of one's own, and the repository's examples. Two causes, both fixed here:
build_core::sandbox_windows::gather). The builder plans theconfined game's grants from its command line and environment. It skipped the test mode's folder (
--mod-tests <folder>, elseHOS_MOD_TESTS): the old game-side sandbox planned after the test mode's start had setLONGSHOT_DEV_MODS, and the builder plans before. The folder is now read first among the development mods.host/hos_main.c). The confined game ran the test mode's start (game_start_args)before
hos_sandbox_startinstalls the file layer that reaches the builder. It could read neither the folder'smod.tomlnor its list, took it for an empty folder of mods, and setLONGSHOT_DEV_MODSempty. Inside the containerthe start now runs after the sandbox's start; outside it, and with the sandbox off, it runs first as before.
docs/dev/reference/sandbox.md: the file layer's section says so.mod run <folder>was not affected: only the test mode setsLONGSHOT_DEV_MODSitself. Neither is the fake game'smod test, which starts no game.On mod-api, to see it: Windows, sandboxed (the default):
dev.py game-testsof a mod in a folder outside the modsfolder. The game's log has no "allowed read ... (a development mod)" line, and ends "no mod to test was found".
Read first:
gather.rs(args_of, the development mods), then the Windows start inhost/hos_main.c.Testing
Tested: Windows 11, NVIDIA GeForce RTX 4060 Laptop GPU, driver 621.24.
build-coresandbox_windows::gather::test_mode_folder(new):plan_foron a game in a temporary folder, with thetest folder named by
HOS_MOD_TESTSand by--mod-tests. On mod-api it fails with "the test mode's folder byHOS_MOD_TESTS (...) read: roots [...]". Here it passes, with the rest of
sandbox_windows(28).tests/test_sandbox_test_mode_start.py(new): the Windows start ofhos_main.c'smain, cut from the source, withstand-ins that record the order. On mod-api it fails with "FAIL (inside the container): args_order > sandbox_order".
Here it passes; with the container's later call removed, it fails with "args_calls == 1".
dev.py game-testsof a probe mod intest-mods\nav-probe(outside the mods folder), sandboxed,headless, with the builder confining the game. The branch was merged locally with #2726 (which a sandboxed start
with a profile needs) and #2745 (the probe's call); that merge was not pushed. The log says "allowed read
...\test-mods\nav-probe (a development mod), served by the builder", the mod starts, and its test passes: 1 passed,
exit 0.
Still to test:
dev.py game-testsof a mod outside the mods folder (Linux's sandbox is unchanged here).The 118 checks that fail on Windows on mod-api (`
eaf4a48b9`) tootest_antilag.py,test_astc_decoder_gpu.py,test_async_safe_frees.py,test_audio_output_devices.py,test_audio_source_load.py,test_auto_handheld.py,test_bc_copy_layer_pitch.py,test_builder_channel.py,test_builtin_compute_unoptimized.py,test_capture_dimensions.py,test_capture_readback_visibility.py,test_capture_resources.py,test_coopmat_probe_failures.py,test_crash_record.py,test_desc_counts.py,test_dev_ab.py,test_dev_build.py,test_dev_migrate.py,test_dev_packs.py,test_dev_update.py,test_device_policy.py,test_draw_binds.py,test_draw_stream_visibility.py,test_drs.py,test_dummy_views.py,test_dump_readback.py,test_fallback_pipeline_state.py,test_float_add_subgroup.py,test_framegen_resources.py,test_framelog_sink.py,test_fsr3_release_frees.py,test_fsr3fi_hud_mask.py,test_fsr4_bind_dispatch.py,test_fsr4_tune.py,test_fsr_image_retirement.py,test_fsr_uniform_ownership.py,test_game_menu_mouse_buttons.py,test_gcn_mesh_shared_warp.py,test_image_view_retry.py,test_import_buffer_binding.py,test_import_log.py,test_import_reach.py,test_inline_write_order.py,test_input_background.py,test_input_movie.py,test_job_queue.py,test_lifter.py,test_linux_pressure.py,test_loaded_modules_drop.py,test_longshot_builder.py,test_longshot_ctl.py,test_lost_wait_said.py,test_low_vram_texture_mips.py,test_menu_hooks.py,test_mesh_fallback_strict_fmul.py,test_mesh_first_types.py,test_pads_after_menu.py,test_parity_gates.py,test_pass_barrier.py,test_pass_hazard.py,test_pcache_header_read.py,test_pipeline_key_values.py,test_pipeline_state_portable.py,test_pipeline_states.py,test_present_probe.py,test_present_queue_default.py,test_present_sites.py,test_present_source_crop.py,test_program_answer_domains.py,test_program_cache_cleanup.py,test_program_cache_one_variant.py,test_push_state.py,test_queue_priority.py,test_recorder_own_idle.py,test_recorder_parts.py,test_recorder_sync.py,test_recording_admission.py,test_replay_write_order.py,test_reshade_fx.py,test_run_all_mingw.py,test_same_draw.py,test_same_dyn.py,test_sampler_admission.py,test_seed_reader.py,test_shader_store.py,test_sparse_bind_failure.py,test_sparse_bind_ranges.py,test_split_ub_flush.py,test_staging_burst.py,test_taau_typed_dispatch.py,test_table_track.py,test_target_layouts.py,test_target_reuse_memory.py,test_temporal_present_bandwidth.py,test_texel_buffer_ownership.py,test_texture_init_barrier.py,test_texture_staging_publication.py,test_ub_snapshot_default.py,test_ub_update_batch.py,test_ui_record.py,test_ui_texture_upload.py,test_vcore_video_acquire.py,test_vendor_fixes.py,test_vertex_bind.py,test_vertex_bind_range.py,test_video_catchup.py,test_video_hold_early.py,test_video_input_limit.py,test_vk_occlusion_queries.py,test_vulkan_clear_mip.py,test_vulkan_copy_span.py,test_vulkan_copy_span_gpu_compile.py,test_wb_diff_observations_gpu.py,test_widen_alpha.py,test_windows_on_linux.py,test_windows_stop.py,test_wmma16_zero_c_kchain.py,test_xinput_thread.pyMeasurements
Nothing to measure: the start's order and one more read grant.
Risks
above the player's own is refused, as any grant is.
--mod-devand the test mode's results folder are set after the sandbox's start. Neitheris read before it.
Checklist
Ready for review
mod-api; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named): Windows, with #2726 and #2745 merged: 669 passed, 122 failed, 47 skipped. The same 118 fail on mod-api;test_invalidate_vcore,test_mesh_args_cleanupandtest_present_semaphorespass on rerun (flaky under the full run);test_sandbox_save_dir_earlyfailed only with #2726 and this merged, fixed in #2726 (952b4ec3c).main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
Tested in game: Windows 11, RTX 4060 Laptop, dev.py game-tests sandboxed of docs/modding/examples/debug-hitboxes from the repository on this head (with #2726 and #2742 merged locally): LONGSHOT_DEV_MODS reaches the confined game, the mod starts and its test file runs (its tests are the fake game's: FakeOnlyError). Before, a mod outside the mods folder: 'no mod to test was found'.
@review
Recommendation: Request changes. The change fixes the reported single-mod case, but a test folder containing multiple mods still appears empty inside the container because its parent folder is not granted to the broker.
The confined Windows process now starts test mode after installing the broker file layer. That lets a directly supplied development mod be found, but the same approach does not yet support a folder of mods outside the container’s existing grants.
Blocking (1): must change before merging.
host/hos_main.c:1083: The delayed start cannot enumerate a test folder containing mods when that folder itself is outside the container’s grants. (more on the line) Do: Grant the test folder enough access to enumerate it, or retain the outer process’s resolved mod list inside the container, and add a regression test for a folder of mods outside existing grants.@fixcan do L1.More: does it help, other systems, switches, what was read
Does it help: Yes for the reported single-mod case: the author reports that the development mod loaded and its test file ran on Windows 11 with an RTX 4060 Laptop GPU, with #2726 and #2742 merged locally. The folder-of-mods case remains broken.
Other systems: Linux retains its existing start order. Windows sandbox-off runs retain the early call. The changed Windows path also applies to an existing AppContainer and depends on its broker or native folder access; no separate run of that setup was reported.
Switches: None added, changed, or removed.
Reviewed:
96f2bce6ceagainst5c1cd9f5b1: Read AGENTS.md, CONTRIBUTING.md, the pull request template, relevant standards, the complete diff, commit messages, the new test, the changed startup region and its sandbox, broker, options and test-mode dependencies. Skimmed the sandbox reference and the rest of hos_main.c; no generated files or translations changed. docs/review-checklist.md and the sibling Tooling checkout were absent.; nothing run (a code review).Checked and fine:
Testing: No commands that build, run tests, or execute project code were run during review. The author reports a game-free order test and a Windows game run; Linux checks and the stated sibling changes remain outstanding.
Overlaps and merge order: The author reports that the sandboxed game run required locally merged #2726 and #2742; their merge order and current status are not available in the supplied review data.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -1077,6 +1080,10 @@ static int game_main(int argc, char **argv) {const int sandbox = hos_sandbox_start(argc, argv);if (sandbox < 0) return 1;if (sandbox > 0) return hos_sandbox_exit_code();if (hos_sandbox_in_container()) { /* (the test mode's start, its folder reached through the file layer now) */L1 (blocking): The delayed start cannot enumerate a test folder containing mods when that folder itself is outside the container’s grants.
When: For a folder such as C:\suite containing mod subfolders, the outer start sets LONGSHOT_DEV_MODS to the individual subfolders. The sandbox plan grants those subfolders, not C:\suite; the inner start then calls read_dir on C:\suite, the broker denies its list request, and the empty result overwrites LONGSHOT_DEV_MODS, so no mod is tested.
Do: Grant the test folder enough access to enumerate it, or retain the outer process’s resolved mod list inside the container, and add a regression test for a folder of mods outside existing grants.
Rebased onto the squashed mod-api (
eaf4a48b9) and adapted to the builder-confined start: the bug is still there (game_start_args still runs before hos_sandbox_start), and the fix keeps the test mode's start inside the container after it. The test's stand-ins follow the new start (started_by_builder, a game the builder did not confine ends the start): it fails on the new mod-api for the bug's reason and passes here. An in-game run on the new mod-api is next.96f2bce6cec0973f8945One more fix here for the builder design, test first: the builder plans the confined game's grants from its command line and environment, and skipped the test mode's folder (
--mod-tests <folder>/HOS_MOD_TESTS), so a test run of a mod outside the mods folder found "no mod to test". The builder's Windows plan now reads that folder first among the development mods (gather.rs; the test fails on mod-api, passes here). In game (Windows 11, sandboxed, with #2726 and #2745):test-mods av-probeserved by the builder ("allowed read ... (a development mod)"), found and run: 1 passed, exit 0.WIP: fix(sandbox): the test mode's start reads its folder in the container after the broker's file layer is into WIP: fix(sandbox): Windows: a sandboxed test run finds a mod outside the mods folderWIP: fix(sandbox): Windows: a sandboxed test run finds a mod outside the mods folderto fix(sandbox): Windows: a sandboxed test run finds a mod outside the mods folderView command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.