Repository navigation
feat(autodetect): discover non-Steam RimWorld installations (GOG, Heroic) - #2448
LionelColaso merged 9 commits into
Conversation
…oic) Extend PathAutodetectService with a shared discovery pipeline: Steam VDF parsing (unchanged) -> launcher metadata (Heroic GOG installed.json) -> bounded, content-validated search over platform-standard roots -> legacy hardcoded fallback. - macOS: detect RimWorld.app bundles in /Applications and ~/Applications (GOG Galaxy / offline installer defaults) - Linux: search ~/GOG Games/<title>/game (GOG offline installer, minigalaxy) and ~/Games (Heroic, Lutris); read Heroic GOG installed.json to cover custom install locations - Accept RimWorldLinux64 alongside the legacy RimWorldLinux binary in executable validation and the settings error message Candidates must carry RimWorld content markers (a parsable Version.txt or a known game executable), so folder names are irrelevant and look-alike folders are rejected. Searches are shallow (<= 2 levels), skip symlinks and hidden entries, and are entry-capped; launcher metadata is parsed with the stdlib JSON parser from fixed user-owned config locations. Detection stays read-only and only pre-fills the settings dialog.
check_if_essential_paths_are_set() now runs the platform path autodetection before prompting the user, filling ONLY empty instance fields with paths that actually exist (game, config, local mods; workshop only when it exists), then saving. The "Essential path(s)" dialog is shown only when silent autodetection cannot complete the set. Refreshes with prompt=False (e.g. after "Clear All Locations") do not trigger autodetection, so deliberate path clearing is respected, and existing values are never overwritten. Also move the main_content/patch_dialogue test fixtures to tests/views/conftest.py and add coverage for the silent flow. Verified on a real GOG (macOS) install: on a fresh profile the app auto-fills /Applications/RimWorld.app, the RimWorld Config folder and the bundle-root Mods folder, and the metadata scan lists all six Ludeon mods (Core + Anomaly, Biotech, Ideology, Odyssey, Royalty).
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
Address CI feedback on RimSort#2448: - Discover non-Steam RimWorld installs on Windows: read the GOG Galaxy registry key (HKLM\SOFTWARE\WOW6432Node\GOG.com\Games, per-game "executable" value) for custom install drives, then Heroic's GOG installed.json (now resolved per-platform), then a bounded, content-validated search over C:/GOG Games, ~/GOG Games and ~/Games. Candidates must carry a parsable Version.txt or RimWorldWin64.exe. - Skip test_rejects_non_executable_linux_binary on Windows: os.access(X_OK) does not reflect the executable bit there. - Extract _has_parsable_version_file() and deduplicate test setup to satisfy the 0% jscpd threshold enforced by super-linter. - Merge the two RimWorldLinux* acceptance tests into a parametrized case; cover the registry lookup with a read-only fake winreg (runs on every platform).
Address CI failures on PR RimSort#2448: - Lint (super-linter PYTHON_MYPY): add missing type annotations for _patch_autodetect params and test fixture params, type _FakeWinreg tree as dict[str, Any] with isinstance narrowing (satisfies mypy strict + pyright), add method-assign ignore for test-only MethodType patch, fix import order and formatting. - Windows pytest: isolate TestNonSteamLinuxGameSearch from host platform by patching sys.platform to linux, so Heroic metadata lookup uses the Linux config path and validator on all runners. Fixes test_finds_heroic_metadata_custom_location which read the Windows metadata location on windows-latest and fell back to the Steam path. AIOS-Intentional: standalone nested repo (own .git, untracked by vault: git status shows rimsort-fork/ as ??), so vault Layer-8 session tracking cannot apply; agent-commit.sh and aios daemon cannot operate here. Both files verified by diff as own session work only.
LionelColaso
left a comment
There was a problem hiding this comment.
Thanks for this — the autodetection pipeline (Steam VDF → launcher metadata → bounded root scan → legacy fallback), the read-only/symlink-safe scanning, and content-based validation are a solid approach, and the test breadth is good.
However, the two launcher-metadata parsers don't match the formats actually written by GOG Galaxy and Heroic, so those branches won't fire on real installs, and the silent-autofill exit has a gap. CI is green here, but only because the new tests encode the same assumptions (fake registry "executable" value; Heroic installed.json as a top-level list) — the codecov report also shows ~37 uncovered lines concentrated in path_autodetect_service.py.
Requesting changes for three items (inline):
app/services/path_autodetect_service.py:497— GOG Galaxy registry value ispath/exe, notexecutable.app/services/path_autodetect_service.py:398— Heroicgog_store/installed.jsonis{"installed": [...]}, not a top-level list.app/views/main_content_panel.py:472—check_if_essential_paths_are_setreturnsTrueon partial autofill without re-verifying the config folder.
Suggest fixing the parsers and backing them with fixture-based tests using the real schemas, which would also close the codecov gap.
|
Coverage hardening is complete in |
LionelColaso
left a comment
There was a problem hiding this comment.
All three blockers are resolved and verified against the head at 37e22bf:
- GOG Galaxy registry now reads
path/exe/EXEwith per-value content validation and stale-value fallback, matching the real Galaxy schema and independent consumer implementations (path/exe, notexecutable). - Heroic metadata parses the electron-store
{"installed": [...]}shape while tolerating a legacy top-level list; fixtures now use the real schema with negative cases. - Silent autofill re-checks
_instance_essential_paths_readyafter filling, so a missing config folder still shows the Essential path(s) dialog, with a regression test for the fresh-install case.
Verified locally (95 passed; the 3 symlink failures were a local Windows privilege limitation, all green on CI), and the follow-up commits since the fixes are test-only (100% patch coverage per codecov). Lint, pytest (macOS/ubuntu/windows), pyright, builds, CodeQL and codecov all pass on the final head. Nice work — approving.
Resolves #2447
Problem
PathAutodetectServiceonly detects Steam installations. When RimWorld comes from GOG (Galaxy on macOS defaults to/Applications/RimWorld.app; the offline installer / Heroic / Lutris on Linux use other roots), autodetection returns non-existent Steam fallback paths, leaves the location fields empty, and the essential-paths check keeps failing on launch.What this PR does
Non-Steam discovery pipeline in
PathAutodetectService, shared by macOS, Linux and Windows, tried only when Steam detection does not produce an existing game folder:Steam VDF parsing (unchanged) → launcher metadata → bounded search over standard roots → legacy hardcoded fallback.
installed.json(install_pathentries, path resolved per-platform) covers custom Heroic install locations; on Windows, the GOG Galaxy registry key (HKLM\SOFTWARE\WOW6432Node\GOG.com\Games, per-gameexecutablevalue) covers custom install drives without any filesystem scanning./Applicationsand~/Applicationson macOS;~/GOG Games(GOG offline installer, minigalaxy) and~/Games(Heroic, Lutris) on Linux;C:/GOG Games,~/GOG Gamesand~/Gameson Windows. Depth ≤ 2, so~/GOG Games/<title>/gameand~/Games/<provider>/<title>are covered without hardcoding game folder names.Content validation instead of name matching. A candidate must carry RimWorld markers — a parsable
Version.txt(e.g.1.6.4871 rev573) or a known game executable; macOS bundles additionally needContents/plus the Ludeon bundle-root layout (Data/,Mods/). A look-alike folder is rejected regardless of its name.RimWorldLinux64is now accepted alongside the legacyRimWorldLinuxbinary inget_executable_path()and in the settings validation message (current Steam/GOG Linux builds ship the 64-bit binary).Silent first-run fill in
MainContent.check_if_essential_paths_are_set(): before showing the "Essential path(s)" dialog, the missing essential paths (game, config, local mods; workshop only if it exists) are auto-filled from the same service and saved. Existing values are never overwritten, Steam-integration checkboxes are not touched, and refreshes withprompt=False(e.g. after "Clear All Locations") do not re-trigger autodetection.Security considerations (the search runs on the user's filesystem, so it is deliberately conservative):
os.scandirwithfollow_symlinks=False, plus explicitis_symlink()checks), so symlink loops cannot occur;Testing
tests/controllers/test_path_autodetection.py(GOG/Heroic discovery on all three platforms — the Windows registry lookup is covered by a read-only fakewinreg, so it runs on every platform — content validation, bounded/symlink-safe search,RimWorldLinux64) andtests/views/test_essential_paths_autodetect.py(silent fill, no-overwrite, no-refill after clearing, dialog only when autodetection finds nothing). Shared view fixtures moved totests/views/conftest.py. One Linux-specific assertion (non-executable binary rejection) is skipped on Windows whereos.access(X_OK)does not reflect the executable bit.pytest— 1414 passed, 1 skipped; ruff, mypy and pyright clean on the touched files./Applications/RimWorld.app, the RimWorld config folder and the bundle-rootModsfolder, and the metadata scan lists all six Ludeon mods (Core + Anomaly, Biotech, Ideology, Odyssey, Royalty). The Autodetect button behaves identically when invoked manually.Happy to adjust the root lists or the validation markers if maintainers prefer different trade-offs.