From e1c5d0ff394ce23cb930faa219f34daf1bae4fbf Mon Sep 17 00:00:00 2001 From: Frotty Date: Sat, 24 Oct 2026 21:02:22 +0200 Subject: [PATCH 1/3] BACKLOG: Lua hot reload open work after 24 Oct 2026 Replay results of two real projects, the five defects the second replay found (each on a draft branch), what is not started (command-line session staging, first reload after a command-line start, -luaHotReload in wurst_run.args, payload weight, old-generics wrappers, shrinking order groups) and what is not measured in the game. --- BACKLOG.md | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/BACKLOG.md b/BACKLOG.md index 0e6c2f355..d98b7918c 100644 --- a/BACKLOG.md +++ b/BACKLOG.md @@ -214,10 +214,29 @@ Notes; finished-work narrative does not. map: new and changed functions, globals, fields, classes, lambdas and packages, measured on the 3.0.1.24371 client in a test map over five payloads ([docs/LUA_HOT_RELOAD.md](docs/LUA_HOT_RELOAD.md)). Tuned constants take their new values too. Every kind of edit, constants included, was run again in the game on - 24 Oct, nine payloads in one game, driven from the compiler's command line. - Not yet measured: how often a real project's edits are rejected, and its payload sizes and reload - times. Later stages are in the design note: a library reload hook, and multiplayer only through a - synchronised channel. + 24 Oct, fourteen payloads in one game, from the compiler's command line and through the language server as the + editor drives it. Real edits, replayed offline from a project's history: Castle Fight accepts 23 of its last 30 + commits, a second large map 20 of 36. A warm reload in the editor takes 14 to 30 s on Castle Fight (item below). + Multiplayer only through a synchronised channel is a later stage in the design note. +- **Lua hot reload: open work after 24 Oct 2026.** Found while making hot reload ready for daily use; each needs a + failing test first. + - Replaying the second large map found five defects, each started on its own draft branch: closures ordered by + source positions compared as text (`ImTranslator.getSortKey`, "L101" before "L98", renumbers closures an edit + moves across line 10, 100 or 1000, and caused one of Castle Fight's refusals); a changed `__wurst_supertypes` + refused although only the instanceof polyfill reads it; compile-time objects named by their order (an object + added by an edit is nil after the reload, one inserted above another takes its value, both accepted silently); + a closure's identity including later calls of its method chain (`ClosureTranslator.makeNameSuffix`); removing + every closure of an order group refused although nothing is left to confuse. + - Not started: the command-line session has only `start` and `send`, so `grill run --hot` replaces the running + map's session before it launches, and a failed launch has already deleted its payloads (the language server + stages, launches, then activates or restores). The first reload after a command-line start checks the whole + model again (about 47 s on Castle Fight). `-luaHotReload` written into `wurst_run.args` is combined with the + build-only `+` lines of a release build and refused. The initialiser-order check of a payload lists every key + (about 370 KB with 23,000 keys on a large map), and generated object-data functions ship whole. Old-generics + `run_wrapper` functions form order groups too. An order group which shrinks but keeps some closures stays + refused: which survivor is which is ambiguous. + - Not measured in the game: the changes of #1558 to #1561 (the in-game suite last ran on #1556), and the launch of + `grill run --hot` with a payload picked up. - **Lua hot reload: a reload translates the whole program.** Proposal, measured on 24 Oct 2026 in the language server on Castle Fight (`wurst.hotreload` after a body edit, a constant edit and a declaration edit, four of each): a warm request took 14 to 30 s on a loaded machine, the first after a command-line start about 47 s (it checks the From 82df38ce9df105bebb0cfce85ae27ca49989cffc Mon Sep 17 00:00:00 2001 From: Frotty Date: Sat, 24 Oct 2026 21:05:37 +0200 Subject: [PATCH 2/3] BACKLOG: what the randomised hot reload test and the order-group branch left open --- BACKLOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/BACKLOG.md b/BACKLOG.md index d98b7918c..725df1c51 100644 --- a/BACKLOG.md +++ b/BACKLOG.md @@ -227,6 +227,12 @@ Notes; finished-work narrative does not. added by an edit is nil after the reload, one inserted above another takes its value, both accepted silently); a closure's identity including later calls of its method chain (`ClosureTranslator.makeNameSuffix`); removing every closure of an order group refused although nothing is left to confuse. + - The randomised differential test (its own draft branch) found two defects it fixes, and two it leaves: an + anonymous closure inserted before others of its order group while their bodies also change is accepted and + runs the wrong body (check it against the order-group branch before merging either), and a closure which + starts capturing a variable reads its default without a warning. On the order-group branch Castle Fight + accepts 27 of 30; of the 3 left, one is a new-generics specialisation whose field stores take another one's + names, which no branch addresses. - Not started: the command-line session has only `start` and `send`, so `grill run --hot` replaces the running map's session before it launches, and a failed launch has already deleted its payloads (the language server stages, launches, then activates or restores). The first reload after a command-line start checks the whole From 26fb4b4a4971d63b0b6c8c3bdfe41cb4d8566841 Mon Sep 17 00:00:00 2001 From: Frotty Date: Sun, 25 Oct 2026 00:18:35 +0200 Subject: [PATCH 3/3] Reconcile hot reload follow-ups with the completed fixes --- BACKLOG.md | 56 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/BACKLOG.md b/BACKLOG.md index 5f41eccc9..9bc9616c5 100644 --- a/BACKLOG.md +++ b/BACKLOG.md @@ -218,31 +218,30 @@ Notes; finished-work narrative does not. editor drives it. Real edits, replayed offline from a project's history: Castle Fight accepts 23 of its last 30 commits, a second large map 20 of 36. A warm reload in the editor takes 14 to 30 s on Castle Fight (item below). Multiplayer only through a synchronised channel is a later stage in the design note. -- **Lua hot reload: open work after 24 Oct 2026.** Found while making hot reload ready for daily use; each needs a - failing test first. - - Replaying the second large map found five defects, each started on its own draft branch: closures ordered by - source positions compared as text (`ImTranslator.getSortKey`, "L101" before "L98", renumbers closures an edit - moves across line 10, 100 or 1000, and caused one of Castle Fight's refusals); a changed `__wurst_supertypes` - refused although only the instanceof polyfill reads it; compile-time objects named by their order (an object - added by an edit is nil after the reload, one inserted above another takes its value, both accepted silently); - a closure's identity including later calls of its method chain (`ClosureTranslator.makeNameSuffix`); removing - every closure of an order group refused although nothing is left to confuse. - - The randomised differential test (its own draft branch) found two defects it fixes, and two it leaves: an - anonymous closure inserted before others of its order group while their bodies also change is accepted and - runs the wrong body (check it against the order-group branch before merging either), and a closure which - starts capturing a variable reads its default without a warning. On the order-group branch Castle Fight - accepts 27 of 30; of the 3 left, one is a new-generics specialisation whose field stores take another one's - names, which no branch addresses. - - Not started: the command-line session has only `start` and `send`, so `grill run --hot` replaces the running - map's session before it launches, and a failed launch has already deleted its payloads (the language server - stages, launches, then activates or restores). The first reload after a command-line start checks the whole - model again (about 47 s on Castle Fight). `-luaHotReload` written into `wurst_run.args` is combined with the - build-only `+` lines of a release build and refused. The initialiser-order check of a payload lists every key - (about 370 KB with 23,000 keys on a large map), and generated object-data functions ship whole. Old-generics - `run_wrapper` functions form order groups too. An order group which shrinks but keeps some closures stays - refused: which survivor is which is ambiguous. - - Not measured in the game: the changes of #1558 to #1561 (the in-game suite last ran on #1556), and the launch of - `grill run --hot` with a payload picked up. +- **Lua hot reload: remaining daily-use work.** Each correctness change needs a failing test first. + - A closure which starts capturing a variable gives existing objects that capture's typed default without a + warning. Decide whether to warn that reconstructing those objects requires a restart. An anonymous order group + cannot distinguish simultaneous additions/removals and body edits between the same unchanged anchors; make + those edits in separate payloads. A removed closure may still have live objects, so reusing table names its old + bodies read is refused even after intermediate payloads remove the whole group. Do not weaken that guard. + Replay the real-map histories again to measure acceptance after the closure fixes; the recorded 27/30 Castle + Fight result was from an intermediate branch, not the final implementation. + - A recorded Castle Fight refusal involved a new-generics specialisation whose field stores took another + specialisation's names. Minimize that source into a regression and fix the identity where it is assigned. + Old-generics `run_wrapper` functions form order groups too; investigate their source ownership before trying + to accept ambiguous edits. Materialized compile-time expressions without distinct bindings also retain an + order-group count; changing that count requires a restart. Shared object graphs use the first binding that + reaches them, so changing that root needs investigation before promising stable identity. + - The command-line session has only `start` and `send`, so `grill run --hot` replaces the running map's session + before it launches, and a failed launch has already deleted its payloads. Add staged activation/restoration in + the owning CLI integration, matching the language server's launch lifecycle. The first reload after a command-line + start checks the whole model again (about 47 s on Castle Fight). `-luaHotReload` in `wurst_run.args` is combined + with the build-only `+` lines of a release build and refused. The initializer-order check lists every key + (about 370 KB with 23,000 keys on a large map), and generated object-data functions ship whole. Measure smaller + representations without discarding the order check or splitting effectful initialization incorrectly. + - Run the in-game suite again: it last ran on #1556, before #1558 through #1566, including closure lineage remaps + and compile-time snapshot replay. Also exercise `grill run --hot` launching a map and picking up a payload. + Stock Lua and CI do not verify Warcraft's preload channel or numeric runtime. - **Lua hot reload: a reload translates the whole program.** Proposal, measured on 24 Oct 2026 in the language server on Castle Fight (`wurst.hotreload` after a body edit, a constant edit and a declaration edit, four of each): a warm request took 14 to 30 s on a loaded machine, the first after a command-line start about 47 s (it checks the @@ -313,8 +312,11 @@ Notes; finished-work narrative does not. payload (made by the session, as the editor makes it) into the running base program in the test Lua, and compares what it prints with fresh runs of the edited program. CI runs 10 programs of 3 edits; before changing `LuaHotReload` or how a hot-reload build names its declarations, run a campaign (`WURST_FUZZ_PROGRAMS=500`, a fresh - `WURST_FUZZ_SEED`, `-PtestTimeoutMillis=3600000`; about 2 s a program) and plant a bug to see it caught. A failing - seed leaves its sources, scripts and payloads in `test-output/fuzz-hotreload/`. + `WURST_FUZZ_SEED`, `-PtestTimeoutMillis=3600000`; timing depends on the host) and plant a bug to see it caught. A failing + seed leaves its sources, scripts and payloads in `test-output/fuzz-hotreload/`. Set + `WURST_FUZZ_INSERT_ANONYMOUS=1` to cover insertions before anonymous siblings too; expected ambiguity refusals + are counted separately. Warning-oracle edits must actually change the value, and retained-state comparisons + must account for objects which survive removal; a fresh run alone cannot establish their semantics. - **Making the grammars SLL-clean is not worth it.** The SLL-first parse (`AntlrTokenPipeline`) parses a file again with the full LL prediction when SLL does not accept it, which also happens to a few valid files (`blizzard.j`,