leonida_mods checks the executable and DLLs by SHA-256 before starting gta6rt (carry of #358) #3084
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3084"
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?
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T10:29:08Z.
Claimed in the coordination issue as: OLD-8041, OLD-8404 (the original author's claim: https://github.com/ProjectLeonida/mandy/issues/14#issuecomment-7121328982)
What and why
Carry of #358 (ItsMrDubey), unchanged since 2026-11-24. Branch = main + the author's head (commit kept) + conflict resolution + my commits.
The change makes
tools/leonida_mods.pycheck the executable and the package DLLs by SHA-256 before it startsgta6rt(CLIrunand the GUI launch buttons; not--print). A newmanifest_verifier.check_fileschecks size first, then the streamed SHA-256, with the same cache rules as--cache.game/xbox-1.0.2.1.jsongainsexpected_exe_sizeandexpected_exe_sha256, the values already published indocs/runtime_imports.md.--imagestill names a stand-in executable that is not checked (the DLLs still are). See #358 for the full description.What I did on top of the author's commit:
tools/leonida_mods.py(imports): kept main'sTOOLSpath setup andreport_pathsimport, and the PR'smanifest_verifierimport.check_filestest back intoTestVerifyCache. main addedTestSaveVerifyCacheright after it, so the merge had placed the test in the wrong class, where it failed withTypeError: 'dict' object is not callable.check_launch_filesskipped a manifest DLL that the package does not contain, so a partially copied package passed. Every DLL in the manifest is now checked, and a missing one fails with<file>: cannot read it (...).runtime_commandstartsEXPECTED_EXE. The check now usesEXPECTED_EXE, so the file checked is the file started.Two tests cover these.
The other review comments on #358 (the
needs rebaselabel and the request to rebase for CI) are addressed by this branch being based on current main.Tested
Windows 11, no GPU, no game files, on main
a917c54d6plus this branch (head7539b86cb).python -I tests/test_leonida_mods.py: Ran 23 tests, OK (includes the 5 launch-check tests of the PR and my 2).python -I tests/test_manifest_verifier.py: Ran 81 tests, OK (skipped=5).python -m pytest tests/test_manifest_verifier.py -k check_files(venv): 1 passed.tools/leonida_mods.py,tools/manifest_verifier.pyandgame/xbox-1.0.2.1.jsonrestored to main's version,python -I tests/test_leonida_mods.pyfails with 7 errors (all inLaunchCheckTests) and thecheck_filestest fails (nocheck_fileson main). With only the PR's originalcheck_launch_files(before my fix commit),test_declared_dll_missing_from_the_package_refuses_to_startandtest_checks_the_executable_that_is_started_not_the_manifest_namefail; everything passes with the fix. The files were restored afterwards andgit statuswas clean.python -I scripts/check_no_game_data.pyon the 6 changed files: clean (exit 0).python -m compileall -q tools tests: ok.git merge-treeagainst origin/main80910637f(newer than the base above): no conflict.Not run: the full suite, CI.
GPUs tested: n/a (unit tests only)
AI-assisted: yes. Models: Claude Opus 5.5 in Claude Code (carry, conflict resolution, fixes, tests); separate read-only reviewer agent: Claude Opus 5.5.
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (No translator rule here, so nothing to add.)Supersedes #358 once merged; the original stays open until a maintainer decides.
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T11:02:03Z.
Ran this natively on Windows 11 (NTFS), Python 3.13, no game files. Head
7539b86cbmerged with currentmain(43e5769d8), no conflicts.Unit tests (
py -I):tests/test_leonida_mods.py: 23 tests, OKtests/test_manifest_verifier.py: 81 tests, OK (5 skipped)tests/test_exe_sha.py: 16 tests, OKcheck_fileswith its cache on NTFS. I also drovemanifest_verifier.check_filesdirectly on a temp folder with one DLL and one exe and averified_files.jsoncache. I wrappedsha256_fileto count reads and setRACY_WINDOW_NS = 0so the cache fills at once.os.utimea.dll: SHA-256 is …, expected …os.replacefor a file with the same bytes and timesnormcasekey matches)cannot read it (The system cannot find the file specified)So the rewrite with the old mtime restored is caught on Windows. That works through the NTFS ChangeTime in
_cache_stamp, notst_ctime. An expected hash in upper case is also accepted, because of the.lower().Not checked: the GUI launch buttons, a real game package, and the time to hash the 120 MB exe the first time.
GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T12:14:03Z.
RUN (independent run on Windows, #3084 head
43e5769d8, merged locally intomain9b4d71899withgit merge --no-ff, no conflicts. CI on the head: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass.)f35a1c4e2(ItsMrDubey) is an ancestor of the head through the merged0266321a, under its author's name.game/xbox-1.0.2.1.jsonare the valuesdocs/runtime_imports.mdonmainalready publishes (both found there).python -Ion the three changed test files:tests/test_leonida_mods.py: main 16 tests OK; merge 23 tests OK.tests/test_manifest_verifier.py: main 80 tests OK (3 skipped); merge 81 tests OK (3 skipped).tests/test_exe_sha.py: main 16 tests OK; merge 16 tests OK.python -m pyteston the 12 test files that nameleonida_mods,manifest_verifierorexe_sha: main 218 passed / 11 skipped; merge 226 passed / 11 skipped.main's tools and manifest with this pull request's three test files.test_leonida_mods.py: 23 tests, 7 errors, all inLaunchCheckTests(mainhas noVERSIONSorcheck_launch_files).test_manifest_verifier.py: 81 tests, 1 error (mainhas nocheck_files).test_exe_sha.py: 16 OK, since its change only points the--print-keystest at its own empty manifest. These match the body.test_leonida_mods.pyandtest_manifest_verifier.py, and restored afterwards (git statusclean). 6 of 8 are killed:and os.path.isfile(...)): killed bytest_declared_dll_missing_from_the_package_refuses_to_start. This is the first review point.version.get("expected_exe", EXPECTED_EXE)): killed bytest_checks_the_executable_that_is_started_not_the_manifest_name. This is the second review point.check_launch_filesno longer called beforesubprocess.callinrun: killed (6 failures).check_files: killed in both files.--imagestill has the executable checked: killed.test_check_files_size_then_hash_then_cache, which passes uppercase digests._stable_stamp. It survivestest_leonida_mods.pybut is killed intest_manifest_verifier.py(test_what_never_gets_cached), which covers the shared helper.hit["sha256"] == expecteddropped). A file cached as passing would then pass a manifest that expects another digest. No test changes the expected digest of an unchanged, cached file.Not covered here: Linux and macOS, the GUI launch buttons (they call
check_launch_filestoo, but tkinter is not driven here), and a real game package (synthetic manifests and files only).Verdict: PASS. The launch check works as described, both review points of #358 are pinned by a test that fails on the original code, red on
mainand green on the merge match the body, and the author's commit is kept. One gap remains: no test changes the expected digest of a file that is already cached.Machine: Windows 11 Pro 26300 (NTFS), i9-13900K, 64 GB, CPython 3.13.12 (CI uses 3.12); unit tests only, no GPU or game files used.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:17:56Z.
Merging. Head
43e5769d8merges cleanly withmainf6dd2242eand does not force a rebase of #2566. Independent check on head43e5769d8: enlight3d's red/green on main + this head (7 failures + 1 error with main's tools, related suite 218 -> 226, 6 of 8 mutations killed incl. both original bugs of #358; one survivor: a cache that no longer compares the expected SHA, no test changes a cached file's expected SHA, noted as a gap), comment 7345034560; ItsMrDubey's commit from #358 is kept; CI green incl. no-game-data; no open review or question. Merged by MoonEyes.AI-assisted (Claude Code).