loader: content-address PreparedImage with cached hash and synced staging (D3D12-LOADER-CONTENT-ADDRESSED-IMAGE) #2890
Open
djrolfes wants to merge 1 commit from
upstream-pr/2890 into main
pull from: upstream-pr/2890
merge into: ProjectLeonida:main
ProjectLeonida:main
ProjectLeonida:claude/loop-total
ProjectLeonida:claude/pops-collision-seed
ProjectLeonida:claude/dstorage-hold-page-reads
ProjectLeonida:claude/host-image-copy-switch
ProjectLeonida:feat/gdk-lifecycle-window-hook
ProjectLeonida:claude/d16s8-uav-nvidia-fallback
ProjectLeonida:feat/mfplat-offline-shim
ProjectLeonida:claude/gameinput-slow-reader
ProjectLeonida:fix/rt-null-barrier-clear
ProjectLeonida:claude/depth-resolve-sample-positions
ProjectLeonida:integration/palmetto-parity
ProjectLeonida:claude/valu-literal-sext
ProjectLeonida:claude/slot74-pool-handle
ProjectLeonida:claude/rgb9e5-uint-alias-view
ProjectLeonida:claude/fssm-root-layout-tables
ProjectLeonida:feat/gdk-speech-display-lifecycle
ProjectLeonida:asset-audio-skip-current
ProjectLeonida:qemmhd/old-9940-rectangle-quad-lists
ProjectLeonida:feat/ws2-offline-shim
ProjectLeonida:qemmhd/rt-d16-unorm-uav
ProjectLeonida:feat/xs-device-stops-7-9
ProjectLeonida:qemmhd/rt-depth-same-base-shapes
ProjectLeonida:qemmhd/rt-lazy-attachment-variant
ProjectLeonida:feat/acphal-xma2-decoder
ProjectLeonida:asset-audio-skip
ProjectLeonida:codex/coord-claim-check-20261124-7e48
ProjectLeonida:feat/xs-frame-pacing-presentx
ProjectLeonida:feat/xs-device-vm-options
ProjectLeonida:old-pr/9844
ProjectLeonida:old-pr/9978
ProjectLeonida:old-pr/9815
ProjectLeonida:old-pr/10057
ProjectLeonida:old-pr/9874
ProjectLeonida:old-pr/9965
ProjectLeonida:old-pr/9863
ProjectLeonida:old-pr/10068
ProjectLeonida:old-pr/10066
ProjectLeonida:old-pr/10067
ProjectLeonida:old-pr/10007
ProjectLeonida:old-pr/10061
ProjectLeonida:old-pr/10065
ProjectLeonida:old-pr/10059
ProjectLeonida:old-pr/10063
ProjectLeonida:old-pr/10055
ProjectLeonida:old-pr/10062
ProjectLeonida:old-pr/10042
ProjectLeonida:old-pr/10041
ProjectLeonida:old-pr/10049
ProjectLeonida:old-pr/10047
ProjectLeonida:old-pr/10046
ProjectLeonida:old-pr/10045
ProjectLeonida:old-pr/10056
ProjectLeonida:old-pr/10043
ProjectLeonida:old-pr/10036
ProjectLeonida:old-pr/10034
ProjectLeonida:old-pr/9984
ProjectLeonida:old-pr/10052
ProjectLeonida:old-pr/10038
ProjectLeonida:old-pr/10033
ProjectLeonida:old-pr/10028
ProjectLeonida:old-pr/10050
ProjectLeonida:old-pr/9891
ProjectLeonida:old-pr/9889
ProjectLeonida:old-pr/10051
ProjectLeonida:old-pr/10019
ProjectLeonida:old-pr/10027
ProjectLeonida:old-pr/10029
ProjectLeonida:old-pr/10031
ProjectLeonida:old-pr/10026
ProjectLeonida:old-pr/9941
ProjectLeonida:old-pr/10030
ProjectLeonida:old-pr/10040
ProjectLeonida:old-pr/9990
ProjectLeonida:old-pr/10021
ProjectLeonida:old-pr/9962
ProjectLeonida:old-pr/10022
ProjectLeonida:old-pr/10020
ProjectLeonida:old-pr/10015
ProjectLeonida:old-pr/10025
ProjectLeonida:old-pr/9886
ProjectLeonida:old-pr/10048
ProjectLeonida:old-pr/10014
ProjectLeonida:old-pr/10011
ProjectLeonida:old-pr/9861
ProjectLeonida:old-pr/10010
ProjectLeonida:old-pr/10008
ProjectLeonida:old-pr/9860
ProjectLeonida:old-pr/10006
ProjectLeonida:old-pr/9920
ProjectLeonida:old-pr/9995
ProjectLeonida:old-pr/10000
ProjectLeonida:old-pr/10016
ProjectLeonida:old-pr/10004
ProjectLeonida:old-pr/10023
ProjectLeonida:old-pr/9982
ProjectLeonida:old-pr/9981
ProjectLeonida:old-pr/9983
ProjectLeonida:old-pr/9970
ProjectLeonida:old-pr/9969
ProjectLeonida:old-pr/9968
ProjectLeonida:old-pr/9971
ProjectLeonida:old-pr/9972
ProjectLeonida:old-pr/9942
ProjectLeonida:old-pr/9963
ProjectLeonida:old-pr/9960
ProjectLeonida:old-pr/9964
ProjectLeonida:old-pr/9985
ProjectLeonida:old-pr/9973
ProjectLeonida:old-pr/9862
ProjectLeonida:old-pr/9953
ProjectLeonida:old-pr/10017
ProjectLeonida:old-pr/9952
ProjectLeonida:old-pr/9955
ProjectLeonida:old-pr/9946
ProjectLeonida:old-pr/9954
ProjectLeonida:old-pr/9938
ProjectLeonida:old-pr/9956
ProjectLeonida:old-pr/9856
ProjectLeonida:old-pr/9947
ProjectLeonida:old-pr/9924
ProjectLeonida:old-pr/9961
ProjectLeonida:old-pr/9927
ProjectLeonida:old-pr/9979
ProjectLeonida:old-pr/10032
ProjectLeonida:old-pr/9926
ProjectLeonida:old-pr/5237
ProjectLeonida:old-pr/9951
ProjectLeonida:old-pr/9931
ProjectLeonida:old-pr/9902
ProjectLeonida:old-pr/9921
ProjectLeonida:old-pr/9994
ProjectLeonida:old-pr/9775
ProjectLeonida:old-pr/9768
ProjectLeonida:old-pr/9905
ProjectLeonida:old-pr/9936
ProjectLeonida:old-pr/9901
ProjectLeonida:old-pr/9904
ProjectLeonida:old-pr/9906
ProjectLeonida:old-pr/9988
ProjectLeonida:old-pr/9908
ProjectLeonida:old-pr/9909
ProjectLeonida:old-pr/9911
ProjectLeonida:old-pr/9912
ProjectLeonida:old-pr/9913
ProjectLeonida:old-pr/9887
ProjectLeonida:old-pr/9916
ProjectLeonida:old-pr/9919
ProjectLeonida:old-pr/9925
ProjectLeonida:old-pr/9933
ProjectLeonida:old-pr/9935
ProjectLeonida:old-pr/9918
ProjectLeonida:old-pr/9879
ProjectLeonida:old-pr/9880
ProjectLeonida:old-pr/9881
ProjectLeonida:old-pr/9996
ProjectLeonida:old-pr/9876
ProjectLeonida:old-pr/9892
ProjectLeonida:old-pr/9899
ProjectLeonida:old-pr/9915
ProjectLeonida:old-pr/9914
ProjectLeonida:old-pr/9872
ProjectLeonida:old-pr/9869
ProjectLeonida:old-pr/9866
ProjectLeonida:old-pr/9819
ProjectLeonida:old-pr/10012
ProjectLeonida:old-pr/9857
ProjectLeonida:old-pr/9893
ProjectLeonida:old-pr/9897
ProjectLeonida:old-pr/9928
ProjectLeonida:old-pr/9868
ProjectLeonida:old-pr/9917
ProjectLeonida:old-pr/9940
ProjectLeonida:old-pr/9873
ProjectLeonida:old-pr/9816
ProjectLeonida:old-pr/10009
ProjectLeonida:old-pr/9900
ProjectLeonida:old-pr/9966
ProjectLeonida:old-pr/9859
ProjectLeonida:old-pr/9843
ProjectLeonida:old-pr/9991
ProjectLeonida:old-pr/10058
ProjectLeonida:old-pr/9883
ProjectLeonida:old-pr/9838
ProjectLeonida:old-pr/9835
ProjectLeonida:old-pr/9959
ProjectLeonida:old-pr/9895
ProjectLeonida:old-pr/9837
ProjectLeonida:old-pr/9858
ProjectLeonida:old-pr/9865
ProjectLeonida:old-pr/9864
ProjectLeonida:old-pr/9840
ProjectLeonida:old-pr/9820
ProjectLeonida:old-pr/4669
ProjectLeonida:old-pr/9848
ProjectLeonida:old-pr/9850
ProjectLeonida:old-pr/9810
ProjectLeonida:old-pr/9799
ProjectLeonida:old-pr/9853
ProjectLeonida:old-pr/9875
ProjectLeonida:old-pr/9831
ProjectLeonida:old-pr/9796
ProjectLeonida:old-pr/9801
ProjectLeonida:old-pr/9813
ProjectLeonida:old-pr/9794
ProjectLeonida:old-pr/7417
ProjectLeonida:old-pr/9781
ProjectLeonida:old-pr/9806
ProjectLeonida:old-pr/9958
ProjectLeonida:old-pr/9809
ProjectLeonida:old-pr/9791
ProjectLeonida:old-pr/9792
ProjectLeonida:old-pr/10053
ProjectLeonida:old-pr/9784
ProjectLeonida:old-pr/9789
ProjectLeonida:old-pr/9849
ProjectLeonida:old-pr/9846
ProjectLeonida:old-pr/9773
ProjectLeonida:old-pr/9785
ProjectLeonida:old-pr/9803
ProjectLeonida:old-pr/9826
ProjectLeonida:old-pr/9839
ProjectLeonida:old-pr/9922
ProjectLeonida:old-pr/9948
ProjectLeonida:old-pr/7189
ProjectLeonida:old-pr/9957
ProjectLeonida:old-pr/9823
ProjectLeonida:old-pr/9807
ProjectLeonida:old-pr/9851
ProjectLeonida:old-pr/9774
ProjectLeonida:old-pr/9830
ProjectLeonida:old-pr/9836
ProjectLeonida:old-pr/9822
ProjectLeonida:old-pr/9783
ProjectLeonida:old-pr/9833
ProjectLeonida:old-pr/9890
ProjectLeonida:old-pr/9770
ProjectLeonida:old-pr/9769
ProjectLeonida:old-pr/9772
ProjectLeonida:old-pr/9787
ProjectLeonida:old-pr/9852
ProjectLeonida:old-pr/9834
ProjectLeonida:old-pr/9845
ProjectLeonida:old-pr/9871
ProjectLeonida:old-pr/9771
ProjectLeonida:old-pr/9776
ProjectLeonida:old-pr/10005
ProjectLeonida:old-pr/9949
ProjectLeonida:old-pr/9923
ProjectLeonida:old-pr/9805
ProjectLeonida:old-pr/9829
ProjectLeonida:old-pr/9790
ProjectLeonida:old-pr/9827
ProjectLeonida:old-pr/9929
ProjectLeonida:old-pr/9855
ProjectLeonida:old-pr/9934
ProjectLeonida:old-pr/9907
ProjectLeonida:old-pr/9910
ProjectLeonida:old-pr/9779
ProjectLeonida:old-pr/9780
ProjectLeonida:old-pr/9885
ProjectLeonida:old-pr/9882
ProjectLeonida:old-pr/9877
ProjectLeonida:old-pr/9998
ProjectLeonida:old-pr/4251
ProjectLeonida:old-pr/9987
ProjectLeonida:old-pr/9989
ProjectLeonida:old-pr/9950
ProjectLeonida:old-pr/9777
ProjectLeonida:old-pr/10044
ProjectLeonida:old-pr/9884
ProjectLeonida:old-pr/2906
ProjectLeonida:old-pr/5076
ProjectLeonida:old-pr/9937
ProjectLeonida:old-pr/9986
ProjectLeonida:old-pr/3014
ProjectLeonida:old-pr/9943
ProjectLeonida:old-pr/9939
ProjectLeonida:old-pr/4682
ProjectLeonida:old-pr/4765
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
ProjectLeonida/mandy!2890
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2890"
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 djrolfes on 2026-12-01T15:36:58Z.
Claimed in the coordination issue as:
D3D12-LOADER-CONTENT-ADDRESSED-IMAGE.What and why
Content-address
PreparedImage::file_name()by a cached full BLAKE3 hash of the prepared bytes, sync staging files to disk before the atomic rename, and add a content-addressed fast path inpublish::write_content_addressed()(d3d12/crates/leonida-loader/src/{prepare.rs,publish.rs,windows.rs}).main,PreparedImage::file_name()keys the cached DLL on the first 16 hex chars oforiginal_hash(leonida-image-<16hex>.dll). If loader preparation bytes change for the same title build, the cached filename collides with the stale DLL.publish::write_if_changed()reads the entire ~115–200 MB prepared DLL back from disk into aVec<u8>just to byte-compare it againstprepared.bytes.prepare.rs: computes and cachespub prepared_hash: blake3::Hashonce insideprepare().PreparedImage::file_name(&self)delegates tocrate::publish::content_addressed_name(&self.prepared_hash)(leonida-image-<64hex>.dll), so neitherwindows.rs::loadnorapps/leonida/src/run.rsre-hashesprepared.bytes.publish.rs:write_staging()(File::create→write_all→sync_all, cleaning up the staging file on error) BEFOREpublish_staging()performs the atomic rename, preventing crash/power-loss from leaving a same-size zero-filled file at the content-addressed path.write_content_addressed(path, bytes, hash)which skips re-reading disk when the filename matchescontent_addressed_name(hash)andmetadata(path)confirms a regular file of the exact byte length, falling back towrite_if_changed()otherwise.windows.rs: passes&prepared.prepared_hashintocrate::publish::write_content_addressed, ensuringprepared.bytesis hashed exactly once per launch.LEONIDA_WRITE_SITEScaches keyed by the old 16-heximage_namewill regenerate once under the new 64-hex name; priorleonida-image-*.dllcache entries from earlier builds remain untouched in the cache directory.VirtualProtectbatching is split into its own separate PR (D3D12-LOADER-BATCHED-IAT-PROTECT, verified clean merge viagit merge-tree).prepare.rs,publish.rs,windows.rs) + fresh red→green unit tests + MEASURED 300 s in-world game gate.Tested
python3 -I scripts/check_no_game_data.py d3d12/crates/leonida-loader/src/prepare.rs d3d12/crates/leonida-loader/src/publish.rs d3d12/crates/leonida-loader/src/windows.rs→ exit 0.cargo clean -p leonida-loader --target x86_64-pc-windows-msvc)leonida-loaderunit test binary (x86_64-pc-windows-msvc) and ran under Wine:origin/main(only the new testprepare::tests::file_name_uses_full_blake3_of_prepared_bytesapplied):262439781(rebased onto3e7b34a52):git merge-tree --write-tree HEAD pr/loader-batched-iat-protect→ clean merge (zero conflicts withD3D12-LOADER-BATCHED-IAT-PROTECT).262439781, Series S + DLSS Quality1280×720 → 1920×1080, Option Amods/gate_drivermode = roamloaded):310.03 sin-world after world entry at68.77 s; also passed an earlier cold-cache 310.18 s run with0errors).3,275frames after +60 s (3,382total world presents),15.98median FPS (16.37end median FPS),111.22 msp95 frame time,4.433 slongest present gap (<= 10.0 s).6,686 MiBpeak VRAM (<= 7,400 MiB),0device losses (0x887A0005),0crashes,0panics,0faults before stop,0kernelNVRM: Xiderrors.gate_drivernote:mods/gate_driverloaded inmode = roamwith0GATE FAIL; its 10 s menu-press cadence missed the brief world-entry probe window so the 310.03 s run stayed on the in-world camera cleanly at15.98FPS.GPUs tested: NVIDIA GeForce RTX 3070 Ti 8 GB, driver 620.73.04, Arch Linux (Wine 11.22 + VKD3D-Proton 3.2.0).
AI-assisted: yes (authored by Gemini 4 Neon; independent fresh review pass by a separate Gemini 4 Neon agent requested
File::sync_all()before rename and cachingprepared_hashonce onPreparedImageto eliminate triple hashing, addressed and approved in re-review).Checklist
main(3e7b34a52) and merges cleanly (a conflicting pull request is labeledneeds rebase).check_no_game_data.pyclean on both source and PR description).docs/design.md, with how it was confirmed. (n/a — loader image cache naming & synced content-addressed publish fast path)Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-01T16:10:12Z.
Independent prepared-image publication and retry check at
26243978+0ff8a532f, using the Win64 test binary under Wine 11.22. The 7 prepare tests including my integration case and all 5 publish tests passed.I used the linked test executable as input. Two originals with different checksum bytes converge to identical prepared bytes and the same content-addressed name. Two distinct prepared payloads of exactly the same length instead publish to separate names. Four concurrent writers, two per name, left both payloads byte-for-byte correct and no staging files.
I then truncated one published file and held it open without delete sharing. Publishing returned PermissionDenied and left no staging file. Closing the reader and retrying repaired the truncated file while the other cache entry stayed byte-identical. This exercises the recovery path for a size mismatch with live Windows sharing semantics under Wine. Same-length corruption and power-loss durability were outside the fixture.
MEASURED with synthetic inputs. AI-assisted (Codex).
Imported from ubiquitarianism/leonida. Originally posted by KelboLive on 2026-12-01T17:32:29Z.
Review: COMMENTED
Content-addressing checks out: the key is
blake3(prepared bytes)(prepare.rs:112-118,publish.rs:16-18), so it covers the original image plus any change inprepare(), and theLEONIDA_*options only patch mapped memory afterLoadLibraryExW(windows.rs:90-110) — correctly not part of the file key. The old 16-hex collision is gone, and I confirmed the mutation that shrinks the key to 16 hex failsfile_name_uses_full_blake3_of_prepared_bytes. 86/86 lib tests here, and the three-way merge with #2889/#2891 compiles and passes 89/89.Two things to tighten:
publish.rs:30-34), so a same-length corruption — bit rot, AV rewrite, interrupted copy, a hand-placed file — is served forever and never healed, unlike the previous byte-compare. Your own test encodes that deliberately (publish.rs:93-98). That is a reasonable trade for the scale win, but it should be stated in the doc comment, or a smallhash.oksidecar written after the rename would restore self-repair.sync_allbefore rename (publish.rs:59), and deleting that line leaves all 86 tests green. A test hook that asserts the flush happens would pin the one invariant the whole design leans on.Nit: a crash mid-write leaves
.<64hex>.dll.<pid>.<n>.tmp(up to ~200 MB) unreaped — no startup sweep, no age-based reaping. Pre-existing pattern, but this is the cache-hygiene PR, so a stale.*.tmpsweep would close the staging lifecycle.Merge is clean against current main (the three touched files are byte-identical upstream), and clean paired with #2889 and #2891. CI's red
check/linux-python-and-viewerare untouched Python tool tests, not this diff.Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-01T17:35:04Z.
Verified on native Windows 11 (MSVC target, rustc 1.98.1, NTFS), since the runs in the description are under Wine.
Head
262439781merged withmaind2a564b66(clean merge):cargo test -p leonida-loader --lib: 86 passed, 0 failed, including the threerename_denied_*/ staging tests that matter most on Windows.cargo clippy -p leonida-loader --all-targets: no warnings in the loader.Both new tests catch their change:
original_hash[..16]name put back,file_name_uses_full_blake3_of_prepared_bytesfails (left: "leonida-image-4976ea11133df67f.dll");m.len() == bytes.len()check removed from the fast path,content_addressed_fast_path_requires_matching_name_and_sizefails atpublish.rs:103(the short file is kept).What the fast path saves here. I timed the two paths on a 114.7 MB file (the size
run.rsmentions), release build, file already in the OS cache, three runs:main'swrite_if_changed(read back + compare)write_content_addressed(metadata only)sync_all+ rename)blake3::hashof the prepared bytes, once per launchSo with a warm cache the launch saves about 15-20 ms net, since the new hash costs about half of what the skipped read-back cost. With a cold cache the read-back costs more, so the saving should be larger. I did not measure that.
Two notes, neither blocking:
sync_allbefore the rename covers a crash during publish. It does not cover a file changed later by something else, but a hash check would mean reading the file again.mainreused one name per title build, so a loader change toprepare()overwrote the old copy. Now each distinct prepared image keeps its own ~115 MB file inimages/.prepare.rshas changed twice this month, so it grows slowly. A cleanup of otherleonida-image-*.dllfiles after a successful publish might be worth a follow-up.Not checked: the game, and a cold-cache launch.
GPUs tested: n/a (CPU and file system tests only).
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:30:29Z.
This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).
Could you, or anyone with a working setup, post a run report on the current head merged onto current
main:mainSHA it was merged onto;mainalone for comparison, if you can.Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:03:00Z.
Code review only, not built (
leonida-loader'swindows.rspath is Windows-only). CI is red, but not because of this change. There is one design concern.262439781, merge base3e7b34a52, 493 behind currentmain45dc41f95. A trial merge is clean.linux-python-and-viewerandcheckfailed, whiled3d12 (windows-latest)passed. The failures are intests/test_wave_diff.py,test_piecewise_parse.py,test_wave_trace.pyandtest_x64_recomp*.py, withTypeError: WaveRef._check_vgpr_dst() missing 1 required positional argument: 'dst'fromtools/cpu_ref.py. These are Python tools this PR does not touch, somainwas broken when the run started (1 December 15:37). On currentmain45dc41f95,python3 -I tests/test_wave_diff.pypasses here. Rebasing or re-running CI should clear it.Review (
prepare.rs,publish.rs,windows.rs):write_stagingnow callssync_allbefore the atomic rename and removes the staging file on a write or sync error. That is an improvement on its own.write_content_addressedskips the content check when the name matches andlenmatches. The testcontent_addressed_fast_path_requires_matching_name_and_sizepins that a same-length different file is kept. That is an executable image the runtime thenLoadLibrarys.mainre-read the file and rewrote it on any difference, so a damaged or tampered copy healed itself. Now one with the right length persists until the user clears the cache. The saving is one sequential read of an image already in the page cache. I would hash the file on disk (BLAKE3 is fast at hundreds of MB/s), or keepwrite_if_changed's comparison, rather than trust the name.leonida-image-<16 hex>.dllfiles from earlier builds are left behind in the cache folder. A one-line cleanup or a note would help.Verdict: blocked-CI (re-run needed; the failure is unrelated). On the code, the fast path should verify content or be dropped before merge.
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T21:34:58Z.
RUN (independent run on Windows, head
2624397813775c1cdd7e09154852d776aedacb6a, merged intomainb41763227aeed2d23c98af84bcbc1bddc7acdc90withgit merge --no-ff)The merge was clean (no conflict). The PR changes only
d3d12/crates/leonida-loader/src/{prepare,publish,windows}.rs, so theleonida-gpusuite and the diagnostics feature are not touched by it. I ran the loader instead. No Python test is touched.Green
cargo test -p leonida-loader --release --locked --libon the merge: 92 passed, 0 failed. This includesfile_name_uses_full_blake3_of_prepared_bytesandcontent_addressed_fast_path_requires_matching_name_and_size, plus the existingrename_denied_*and concurrent-publisher tests.cargo check --release --locked -p leonida(the app that callsPreparedImage::file_name()inrun.rs): builds, no error.leonida-gpu: nothing in this change reaches it.Red
The two new tests only cover
prepare.rsandpublish.rs, and a straight swap of those files back tomain's version does not compile with them (prepared_hashandwrite_content_addresseddo not exist onmain), so I used targeted mutations of the new code instead. Each was run alone and reverted.file_name()back to the first 16 hex oforiginal_hashfile_name_uses_full_blake3_of_prepared_bytesprepared_hashcomputed overoriginalinstead of the prepared byteslencheckcontent_addressed_fast_path_requires_matching_name_and_sizesync_all()removed fromwrite_stagingSo the naming and the fast-path guard are pinned. The two durability properties are not: nothing checks that the flush happens before the rename, nor that the staging file is cleaned up after a failed write. This agrees with the existing review comment about
sync_all.Review
docs/switches.mddoes not need regenerating. The change is always on, but it only affects the cache file name and how the cached copy is published, not rendering.prepared_hashis computed once at the end ofprepare()from the final bytes, andwindows.rs::loadwrites the file beforeLoadLibraryExW.write_stagingsyncs beforepublish_stagingrenames. Correct as written.mainre-read and rewrote it. This is a real behaviour change for an image that is then loaded as code. Three reviewers already raised it (hash on disk, a sidecar, or at least a doc comment). It is not resolved on this head.leonida-image-<16hex>.dllfiles and stale.tmpstaging files are never removed, and every distinct prepared image keeps its own copy of roughly 115 MB. Already raised in the thread; a follow-up cleanup is the natural place.D3D12-LOADER-CONTENT-ADDRESSED-IMAGE, linked to a comment on issues/2570. I did not re-read the coordination tables.linux-python-and-viewerandcheckruns come from Python tools this PR does not touch, as noted in the thread (mainwas broken when the run started). Thed3d12 (windows-latest)job passed.main, with a comparison againstmain. None is posted for a native Windows run or on the currentmain.Not covered
sync_allordering, and no test for same-length corruption beyond the one that pins keeping it.leonida-gpunot run, because the PR does not touch them.Verdict
PARTIAL. The code does what it says and the new tests catch the naming and fast-path changes, but the
sync_allordering is unpinned, the same-length corruption trade-off is still open, and in-game run still required (none posted on this head merged onto currentmain).AI-assisted (Claude Code), models: Claude Opus 5.5 (checker), separate Claude Opus 5.5 judge.
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-03T00:54:32Z.
RUN (in game, gate-style): head
262439781tested in a batch of nine pull requests: #2609 (3fbcacc4e), #2654 (f4ae7b922), #2686 (4ce795127), #2823 (854796496), #2841 (24ff8f24c), #2890 (262439781), #3154 (854fc3441), #2588 (598930e5b) and #3119 (6097c033c), merged in that order withgit merge --no-ffontomainf3865cae8. One conflict, in the credit table ofd3d12/README.mdwhen #2588 went in (both rows kept); no code conflict. Files touched by more than one of the nine:d3d12/docs/switches.md(#2686, #3119, #3154) andd3d12/README.md(#2588, #3119). Built withdiagnostics,mimalloc, targetx86_64-pc-windows-msvc. RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro (build 26300).Launcher defaults except
-PrecompileUsed, Series S settings,-NoDlss -NoFrameGen, standing at the save. On thismainthe launcher precompiles every recorded pipeline by default (88,671 here: a first warm-up with the plain defaults had made 9,000 of them after 660 s when it was stopped), so the runs use-PrecompileUsed(the 2,455 pipelines earlier runs drew with). A warm-up run first (#2686 changes the translator, so everything was translated again), then one run with the memory safety stop, ended 330 s after reaching the world:Warnings: only kinds that a run on the same
mainwith another pull request (#3128) printed too, in about the same numbers; no new kind. No pipeline refused other than the 29 "creation method that is not implemented" lines that run has as well. The last frame saved (8192) shows the world drawn normally.This pull request's own lines: the prepared images are now named by their full content hash: the six images mapped in the run all have 64-hex names (
leonida-image-<64 hex>.dll), beside the 16-hex names an older build had left in the copied data folder. With shaders and pipelines already made, the game process started 12 s after the launcher.Verdict: PASS for the batch (a pass covers each of the nine; a failure would not have said which). Not covered here:
-RayTracing, DLSS and frame generation, other GPUs, Wine/Proton.AI-assisted: Claude Code (Claude Opus 5.5)
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T03:56:40Z.
VERIFY-2890 —
leonida-loaderen verde, y el cambio es de los que se pueden contarTres ficheros,
prepare.rs+22,publish.rs+66,windows.rs−6, cinco días abierto:El cambio, por su título: direcciona por contenido el
PreparedImagecon un hash cacheado y prepara el staging de forma sincronizada — dos cosas que en un caché van juntas: la clave (hash) y la escritura (staging). Un cache keyed by content without a synchronised write produces the classic race, y elwindows.rsque pierde seis líneas sugiere que la sincronización estaba en otro sitio y se movió al que corresponde.Lo que verifiqué: 86 tests del crate en su head, y que el diff toca tres ficheros con el mismo tema.
Lo que no: la carrera de verdad — un test de concurrencia en un caché de ficheros necesita dos procesos peleando por el mismo directorio, y un
#[test]no lo hace. Si el autor tiene un test que lanza dos hilos contra el mismopublish, es el que importa y está en los 86; si no lo tiene, esto es un cambio de plomería verificado por su forma y no por su comportamiento.Y la pregunta que le haría, en una línea: si el hash cacheado se invalida cuando el
PreparedImagecambia en sitio — porque un hash que se guarda y no se recalcula es un caché que devuelve la imagen anterior, que es peor que el que no cachea.View command line instructions
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.