leonida-lua: per-mod PRNG for math.random/math.randomseed #3115
Closed
imShangLi wants to merge 1 commit from
upstream-pr/3115 into main
pull from: upstream-pr/3115
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!3115
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3115"
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 imShangLi on 2026-12-02T11:42:24Z.
What
Give each mod its own
math.random/math.randomseedPRNG state instead of sharingthe single
lua_StatePRNG through mlua's real C closures. Before this change, onemod's
math.randomseed(42)changed another mod'smath.randomsequence, breakingthe sandbox's mod-isolation promise ("one mod changing ... changes nothing for
another", docs/lua-modding.md:169-170).
Why
Finding D3D12-LUA-MATH-RANDOM-IS-STATE-WIDE:
mathtable entries were copied per mod,but
math.random/math.randomseedremained the shared C closures over the sharedlua_State. Now they are per-mod Rust closures over a per-mod xorshift64ModRng,isolated from every other mod. Semantics match Lua 5.4:
math.random()-> [0,1)math.random(n)-> [1,n]math.random(m,n)-> [m,n]Tests
New
tests::math_random_is_per_mod_not_shared_state: mod A callsmath.randomseed(42); mod B and mod C each drawmath.random(1000)twice. B's pairmust equal C's pair (A's reseed must not leak into B).
Red/green: before the fix B != C; after the fix all 41
leonida-luaunit tests pass,including the new one.
Environment
Tested on Linux/Fedora 45 inside a VMware Workstation guest (no GPU, no game files
needed).
leonida-luais one of the 9d3d12/crates that compile offline on Linux,so the suite runs natively here; no D3D12 adapter or Windows/MSVC required.
This change is AI-assisted.
Signed-off-by: imShangLi [email protected]
Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T12:25:12Z.
Ran this natively on Windows 11 (MSVC, Rust 1.98.1), head
ba5121192merged into currentmain.Suite:
cargo test -p leonida-lua --lib --lockedran 41 passed. Withmain'ssandbox.rsand this branch'stests.rs,math_random_is_per_mod_not_shared_statefails withb="pair 742 50" c="pair 332 342", so the red and green reproduce on Windows.Edge cases. The isolation works, but the replacement
math.random/math.randomseeddrift from Lua 5.4, which the workspace builds (mluawithlua54). Three calls panic in Rust rather than raising a Lua error.I ran each call in its own mod through
rig, insidepcall, with a throwaway test (not pushed). The same probe ran againstmain's sandbox for the reference column.main(Lua 5.4's own)math.random(10)1, integer10.0, floattostring(math.random(10))"7""10.0"math.random(0)ModRng::range)math.random(-5)1.586e19math.random(5, 3)3.0(bounds swapped silently)math.random(10.0)1, integermath.random(math.mininteger, math.maxinteger)math.randomseed()Option::unwrap()onNonemath.randomseed(1.5)math.random(1, 2, 3)pcalldoes not stop these panics: in the test they unwind out ofrig. Two of them are ordinary Lua idioms:math.random(0), andmath.randomseed()with no argument to reseed from time.Smaller points:
0x9e37…), so with no reseed each mod gets the same sequence on every launch. Lua 5.4 seeds each state randomly at start.unit()divides byu64::MAX, sonext() == u64::MAXgives exactly1.0, outside[0, 1). That is rare but reachable;(next() >> 11) as f64 * 2^-53is the usual way.mainwithout mod A. B and C share one generator there, so C draws after B. A test where B draws the same values with and without A'srandomseed(42)would pin the leak itself.One way to keep Lua 5.4's behaviour:
i64, so results are integers.10.0is accepted.lo > hi.random(0)return a full random integer.projectdoes.randomseed()with no argument take a fresh seed.GPUs tested: n/a (CPU-only tests).
AI-assisted: yes (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:41:57Z.
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 lixonik on 2026-12-02T15:19:24Z.
RUN (in game) -- render-path gate run for PR #3115:
ba5121192mainSHA:acc350745(git merge --no-ff, clean merge;python -I scripts/check_no_game_data.pyPASS;cargo test -p leonida-lua --lib --locked45 passed, 0 failed)diagprofile (diagnostics,dlss,mimalloc), Series S profile, DLSS on, Frame Gen off, same restored save snapshotba5121192onacc350745)mainalone (acc350745)Both runs loaded cleanly into the world, stayed up past 300 s in-world with 0 device lost / 0 crashes / 0
ERRORlines, and closed cleanly. Rendered FPS matchesmain(26.9vs26.8fps).Verdict: PASS.
AI-assisted: yes (Antigravity).
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:14:03Z.
Verified on Linux (the crate is portable): the new test is red then green, but the new
math.random/math.randomseedlet a mod panic the host and change Lua 5.4 semantics.Red/green:
python -I scripts/red_green.py pr/3115 --base origin/main --no-fetch --work-dir <scratch>So the isolation itself works. I then added a throwaway probe test (not pushed) to the merged tree, a mod running through
rig(...)as the existing tests do:pcall(math.randomseed)sandbox.rs:287:53: called Option::unwrap() on a None value;pcalldoes not contain it, the test thread diespcall(math.random, 0)sandbox.rs:109:13: attempt to calculate the remainder with a divisor of zero(debug;% 0panics in release too)math.type(math.random(10)),tostring(...)float,5.0(Lua 5.4, which mlua is built with, returns an integer:5)pcall(math.random, 5, 1)true 1.0(Lua 5.4 raises "interval is empty")Defects
d3d12/crates/leonida-lua/src/sandbox.rs:287(merged-tree line):args.into_iter().next().unwrap()panics onmath.randomseed()with no argument, which is valid Lua 5.4. A mod can take down the runtime, defeating the sandbox's own "a mod cannot crash the host" intent. Return an error (or reseed from a fresh value) instead ofunwrap.sandbox.rs:109(range):1 + self.next() % nwithn == 0divides by zero;math.random(0)(valid in 5.4, returns a full random integer) andmath.random(minint, maxint)(hi - lo + 1overflows to 0, and is an overflow panic in debug before that) both reach it. Negativenis cast withas u64and returns a huge value instead of an error.f64, somath.random(n)is a float (5.0),math.typesaysfloat, and values above 2^53 lose precision. Returni64for the 1- and 2-argument forms.random(m, n)withm > nswaps the bounds instead of raising "interval is empty"; float arguments with an integral value (math.random(10.0)) are rejected with "expected integer" while Lua accepts them.unit()divides byu64::MAX, so it can return exactly1.0(the documented range is[0, 1)).(next() >> 11) as f64 * 2^-53is the usual fix.0x9e3779b97f4a7c15, so all unseeded mods draw the same sequence and it is the same on every run. Stock Lua 5.4 seeds each state randomly. If deterministic is intended, say so in the docs; otherwise seed each mod from a per-run value.Suggested shape: keep the per-mod state, but implement
randomby Lua 5.4's rules (lmathlib.cmath_random/project), with integer results and error returns, and add tests for no-argrandomseed,random(0),random(5, 1)andmath.type.PR template: no
GPUs tested:line (fine for a CPU-only crate, but say so). AI use is disclosed.Verdict: defects. The isolation is right and proven red/green; the replacement functions need to follow Lua 5.4 and must not panic 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-02T18:21:31Z.
RUN (in game, batch of seventeen render-path pull requests), each head merged with
git merge --no-ffonto main3c106eb2f, in one build: #311115b579756, #29485284c6eae, #26981f188c4f7, #294644bf554fe, #3001d924cbb65, #28320c861595a, #291558e8535cf, #2822d359a2f85, #2896c9c6b103d, #29838278ef1b9, #3115ba5121192, #2945d2c08c14f, #297574512d658, #295126da88e8e, #2800b6ebcedd4, #28937c7e99b48, #3113fa1460b6b(and #30970d7a451ab, merged since). RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world.The drops under 5 fps line up with shaders being translated while walking (about 500 translations in the last 330 s): this batch changes the shader translation, so the shader cache built by earlier runs did not apply and the pipeline precompile alone took about 45 minutes. The batch-5 run on the same machine and route had no sample under 5 fps (median 16.4). I read this as cold-cache stutter, not as a regression of a single pull request, but this run cannot tell them apart.
Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.
Limits: one run; arrival in the world was driven by keys and not checked on pictures. A first attempt of this batch is not counted: the run script gave up waiting for the game window after 40 minutes of precompile.
AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T23:26:58Z.
VERIFY-3115 — Windows nativo: pasa, y un hallazgo sobre lo que el test no asegura
ba5121192—sandbox.rs(+102),tests.rs(+21)ba5121192(on an oldermain: 41 tests here, 47 onmain81efe4566)Ran
What the change is:
math.random/math.randomseedare overridden per mod with a small xorshift64 (ModRng), because the shared C closures all read the onelua_StatePRNG — so one mod'srandomseedmoved every other mod's sequence. The comment says it, and the test does: mod A reseeds, mods B and C never do, and B's pair must equal C's pair.Two controls, and what they taught me:
Rc<RefCell<ModRng>>in astaticdoes not compile (cannot be shared between threads safely). So the type system already makes the bug harder to reintroduce than the test does; I could not express the regression in the same shape.unit()return a constant (0.5) — the test still passes.That second one is the finding: the test pins isolation, not randomness. With
math.randomreturning the same number every time, B's "500 500" equals C's "500 500" and the assertion is satisfied. What it does catch is the leak of A's seed into B's sequence, which is what it was written for — but a one-line addition would also catch a dead RNG:I would not block on it — the property the pull request claims is isolation, and that is tested — but a test named after a shared-state bug is the one place worth also proving the state is doing something.
What I could not test
Written with an AI assistant.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T07:01:15Z.
This pull request has a merge conflict with current
main(d9b618f10), so it can't be run in game or merged as it is. Could you merge the latestmaininto it (or rebase onto it) and resolve the conflict? Once the head is updated, the in-game gate run can be done on the new head.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T10:25:01Z.
Intenté rebasarla y no la voy a entregar: la unión automática no sirve para estos dos conflictos, y lo cuento con el error
Las dos PRs de conflicto parecían adiciones de los dos lados (un
ModRngnuevo y un test nuevo), así que probé a quedarme con las dos mitades. No funciona, y el compilador lo dice:Y el motivo es el mismo en los dos: el bloque de conflicto no es una unidad completa — corta la firma de una función y deja el cuerpo fuera. Pegar las dos mitades deja una función abierta.
Y en
sandbox.rshay algo más que la unión no podía saber:mainya cambiónew_lua— ahora espub fn new_lua() -> Result<(Lua, Guard)>, sin argumento — y la rama trae la versión vieja,new_lua(guard: &Guard) -> Result<Lua>. Quedarse con las dos es dos funciones con el mismo nombre y la segunda sin cuerpo.Lo que eso convierte en obvio: esta PR no es «un
ModRngnuevo»: es unModRngnuevo más unnew_luaque ya no existe con esa firma. La resolución correcta es mirar qué hizomainconnew_luay portar elModRngal mundo nuevo — y eso es leer, no pegar.No la he empujado: el worktree está borrado, el rebase abortado y
mainsigue limpio. Y lo dejo escrito porque el intento costó veinte minutos y el siguiente no tiene por qué repetirlo.Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T10:26:12Z.
Corrección a lo que escribí arriba, porque me equivoqué en un dato y prefiero decirlo yo
Dije que
mainhabía cambiadonew_luaapub fn new_lua() -> Result<(Lua, Guard)>. Es al revés: esa firma es la de esta PR, ymainsigue con la antigua:Lo que sí cambió
maindesde la base de la PR es el contenido de los dos ficheros, y no poco:Y eso es lo que hace esta rebasada distinta de las de
switches.md: allí el conflicto era una línea derivable (el recuento se recalcula contando el fichero). Aquí hay dos cambios de verdad en el mismo sitio — la PR reescribenew_luaymainha añadido 43 líneas alrededor de ella — y por eso ni «quedarse con los dos lados» ni «tomar el fichero de la PR» sirven: lo primero deja la función abierta (lo comprobé:unclosed delimiteren los dos ficheros) y lo segundo tiraría las 43 líneas y los 312 demain.La resolución, dicha en una frase para quien la haga: coger el
ModRngy la firma nueva de esta PR y aplicarlos encima de la versión demaindenew_lua— o sea, mirar qué hacen las dos versiones del cuerpo y quedarse con una que tenga lo demainy lo del PR. Eso es leer veinte minutos, y no lo va a hacer un script.Lo que no he hecho: intentarlo más allá del
unclosed delimiter. El worktree está borrado, el rebase abortado y no hay rama mía con esto.Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T10:26:46Z.
Ahora está claro del todo, y es la explicación que le falta a esta rebasada: los tres árboles tienen la misma función en tres versiones distintas, y no es un conflicto de posición.
La PR se escribió sobre la base y no vio el cambio de
main— no es que los dos hayan añadido cosas distintas al mismo sitio: es quemaincambió la forma de la función (elGuardpasó de dentro a fuera) y la PR cambió su contenido (elModRng) sobre la forma vieja.Por eso la resolución no es ni un lado ni el otro, y ahora se puede escribir sin ambigüedad:
Y por eso «quedarse con los dos lados» no solo rompía la sintaxis: habría dejado dos
new_luay ningún camino que tenga las dos ideas.Lo que no voy a hacer, y es la última vez que lo digo en este hilo: escribir yo ese
B + RNG.new_luaconstruye el entorno de un mod — es la frontera de seguridad del sandbox de Lua — y un merge mal hecho aquí no rompe un test, abre una puerta. El autor tiene la PR en la cabeza; yo tengo el diagnóstico escrito, que es lo que puedo aportar sin ejecutar el juego.Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-03T18:02:42Z.
Thanks for the work on this. This pull request has a merge conflict with the current
mainand has had no new commit, comment or review for more than 5 hours, so I am closing it to keep the list of open pull requests manageable. This is not a judgement of the change. Whenever you like, merge the latestmaininto your branch, resolve the conflict, and reopen it (or open a new pull request that links this one). Please re-run the relevant tests on the new head; a reviewer will look at it when time allows, with no guarantee of timing or outcome.Generated by Claude Code
Pull request closed