Repository navigation
test(vm): pin short-circuit depth-4 semantics; correct constructs skip - #294
Conversation
The constructs.lua short-circuit harness (lines 287-298) was suspected of exercising an executor short-circuit bug at level=4 register aliasing or a `not` precedence wrinkle. Bisecting a faithful in-process replica up to level=4 (204105 cases, both _ENV.GLOB1 values) shows the harness passes completely: the `test_and`/`test_or` CPS path evaluates deep `((((a op b) op c) op d) op e)` compositions and their `not(...)` wrappings correctly. There is no executor bug. The real blockers gating constructs.lua lines 225-313 are upstream of the harness and unrelated to short-circuiting: `debug.getinfo(1,"n").name` returns nil (call-stack name introspection unimplemented) at line 226, and `os.time` is nil at line 237, feeding `_ENV.GLOB1` used by line 248 and the harness leaf. Add a regression test pinning the short-circuit semantics (explicit depth-4 chains, `not` wrapping, the if-condition side-effect shape, and the level-3 generative harness) and rewrite the skip reason to name the two upstream blockers and reference the issue. Plan: A45 Closes #281
Review: sound investigation, ready to land greenI independently reproduced the central claim. Running the full level-4 harness (204105 cases) in-process with a faithful
So the harness genuinely never executes in the suite, and the previous "load()-driven short-circuit harness" skip reason was indeed a misattribution. The classification holds: this is the "otherwise" branch of #281 — no tractable executor fix, corrected skip reason, harness pinned by regression test. Issue #281's described "fails at ~120000 iterations" symptom does not reproduce on current main (likely fixed by intervening closure/upvalue work, or it was always the blockers masking the harness). Conventions: all clean. Tests: the 14 cases pass; hand-computed expected values spot-checked correct, including the Minor notes (non-blocking)
Nothing here blocks marking ready once |
Summary
Bisected the
constructs.luashort-circuit harness (lines 287-298) atlevel=4, as flagged in #281. The suspected executor short-circuit bug(register aliasing under conditional-jump bytecode, or a
notprecedencewrinkle) does not reproduce.
A faithful in-process replica of the harness —
createcasesup tolevel=4, theif %s then IX = true end; return %sprogram template, runthrough
load— passes all 204105 cases for both_ENV.GLOB1 = 0and_ENV.GLOB1 = 1. Thetest_and/test_orCPS path in the executorevaluates deep
((((a op b) op c) op d) op e)compositions and theirnot(...)wrappings correctly.Reduced findings
The real blockers gating
constructs.lualines 225-313 are upstream of theharness and unrelated to short-circuiting:
assert(debug.getinfo(1, "n").name == 'F')—debug.getinfoalways returns
name = nil; call-stack name introspection isunimplemented.
_ENV.GLOB1 = math.floor(os.time()) % 2—os.timeis nil(the
oslibrary is essentially unimplemented).GLOB1then feeds line248's concat and the harness leaf
(0==_ENV.GLOB1), so line 237 cannotsimply be blanked.
Both are out of scope for this issue, which targeted the short-circuit
executor path. This is therefore the "otherwise" branch of #281: no
tractable executor fix, so the skip reason is corrected and the harness is
pinned green by a regression test.
Changes
test/lua/vm/short_circuit_test.exs— new regression test pinning theshort-circuit semantics: explicit depth-4
and/orchains,notwrapping, the if-condition side-effect shape, and the level-3 generative
harness (4105 cases). The full level-4 run (204105 cases) passes
identically but is too slow for the default suite.
test/lua53_skips.exs—constructs.luaskip reason rewritten to namethe two upstream blockers and reference the issue; previously it wrongly
implicated a "load()-driven short-circuit harness" edge case.
Why draft
Per #281, the directive was to fix the executor bug if tractable, otherwise
narrow the skip with a precise reason and open a draft documenting the
reduced repro. The executor is correct, so there is no fix to land; this PR
documents that and pins it. Opened as draft for review of the
classification before the skip-reason correction merges.
Validation
mix formatmix compile --warnings-as-errorsmix test— 2051 passed, 22 skippedmix test test/lua53_suite_test.exs --only lua53— 14 passed, 15 skipped (no delta; constructs.lua stays skipped with an accurate reason)Plan: A45
Closes #281
🤖 Generated with Claude Code