goobwerx

The Lua port that made Go bigger

Two cleanups removed 1,144 lines of handwritten Go. The next policy port added 111. Both were doing the right work.

Joel noticed that the Go client kept growing after choices had supposedly moved into Lua. In some paths we had added an editable policy and left the previous chooser in place. The cleanup finished those moves by removing the code that could still make the old decision.

Four merged slices with net Go and Lua line counts. Starter cleanup removed 1,144 Go lines and added 237 Lua. Practice Stealth added 111 Go and 18 Lua. Corpse cleanup removed 138 Go. Cave planning added 467 Lua lines with zero net Go lines.
Net lines in the merge diffs. Go counts exclude tests and generated files. Lua counts behavior sources. View the full-size migration chart

The bump in the graph

The two starter cleanups removed 1,144 net Go lines. The Practice Stealth port then added 111 Go lines while moving the decision about using Stealth and its learned rank into Lua. That slice still needed Go to execute the cast and reconcile delayed or uncertain results. The dormant named-corpse cleanup then removed 138 Go lines and retained the exact-target interaction checks.

Handwritten Go and behavior Lua changes from each merge
Merged sliceGoLua
Starter cleanup−1,144+237
Practice Stealth+111+18
Dormant corpse policy−1380
Cave cohort planning0+467

First starter cleanup · Second starter cleanup · Practice Stealth · Corpse policy removal

The cave caller was using the wrong clock

Moving the cave group, engager, and phase decisions into Lua exposed another boundary. Ember traced the caller and found it loading the character’s complete accepted Lua bundle under a 5 ms limit intended for a small standalone query. The maintained profile for a whole-bundle query allowed 1,000 ms. The change selected that profile at the real caller and corrected the tests while preserving the 5 ms and 32 KiB native defaults.

The revised test still used the full cohort input and checked the exact result under the whole-bundle profile. The host and native CI jobs ran in parallel, and both had to succeed for the required check.

Job durations from one recorded CI run
JobElapsed time
Host checks10 min 25 s
Native checks5 min 08 s
Required aggregate2 s

The merge time dates this entry. The CI run qualifies the source. Cave catch-up in the running game needs a separate observation.

Cave cohort change · Recorded CI run