You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lua Mode-D: a mid-file keyword desync emits one oversized _[Truncated] satellite that swallows real functions #2437
_slice_by_keywords (Mode D) desynchronises its opener/closer keyword count somewhere mid-file in
several language-crucible/data/lua files, leaving one scope open. Unlike an EOF desync (#2405's
blast-radius containment re-scans that remnant), a desync whose scope DOES eventually close
mid-file produces one oversized <name>_[Truncated] satellite that swallows every real function
declared inside the runaway span.
Surfaced by the tri-comparison-ledger-sweep for lua: lua/function/existence/agree[gitgalaxy]_vs[ctags,tree_sitter] -- 8 of ~9 occurrences are _[Truncated] satellites (BinaryTreesDemo_[Truncated], WriteForm_[Truncated], bit.bnot_[Truncated], Anonymous_Block_[Truncated], new_[Truncated], ...). It also accounts
for part of the residual lua/function/existence/agree[ctags,tree_sitter]_vs[gitgalaxy] recall
gap (api.lua:B, binarytrees.lua:WriteForm sit inside the same span).
Likely triggers (to confirm)
a lua keyword (end, do, for, if, function) used as a table key or string that prism.py's lua shielding leaves live
repeat ... until vs the \bend\b / \buntil\b closer set
function-as-a-value on a line the opener regex counts but no matching end is attributed to
Contain the blast radius (independent of the trigger)
Same idea as #2405's EOF containment but for a mid-file runaway: when a Mode-D satellite's span
exceeds a sanity threshold (e.g. > N lines or > X% of the file) AND _slice_by_labels finds >= 2 func_start matches inside it, re-slice it by labels instead of emitting one _[Truncated]
block.
Update from PR #2441 (the same sweep that filed this):
The two keyword-desync sources this issue lists as "likely triggers" turned out to be _apply_literal_shield bugs, both fixed in #2441:
# (Lua length operator) and // (floor division) were in the shared default comment_markers set, so for i = 1, #arg do ... end was truncated at the # and lost its end from the Mode-D count (bit.bnot_[Truncated]).
Lua long-bracket literals [[ ]] / --[[ ]] were never shielded (code.lua's Anonymous_Block_[Truncated], coroutine.lua's new_[Truncated]).
After #2441, every lua corpus file's Mode-D keyword count is perfectly balanced — this issue
has no remaining lua repro. The 4 residual _[Truncated] satellites
(binarytrees.lua, events.lua, fetch.lua, maxmind.lua) are a different mechanism —
polyglot segmentation splitting a function when a [[ ]] string carries embedded HTML — now
tracked separately as #2440.
The "contain the blast radius for a mid-file runaway" suggestion is still a reasonable defensive
measure to keep if a non-lua Mode-D language hits this shape, but it's no longer load-bearing for
lua. Closing vs. keeping open as a general hardening task is a maintainer call.
Resolved by the accumulated lua fixes — #2438 (one-line function heads), #2439 (proto-table class gate), #2440 (polyglot <style> split), #2447 (\z string-continuation shield), #2461 (;-anchored func_start/function_opener).
Verified as of main @ 5ea3eaa: zero _[Truncated] satellites in the entire lua corpus (and none in shell/tcl/ruby either — the Mode-D mid-file desync class is gone corpus-wide). The ledger shape this issue was surfaced by, lua/function/existence/agree[gitgalaxy]_vs[ctags,tree_sitter], is now still_reproduces: false.
The generic blast-radius-containment mechanism proposed here (re-slice an oversized Mode-D satellite by labels when it contains ≥2 func_start matches) is a reasonable defensive hardening, but there is no remaining repro to drive or validate it. Closing; if a future corpus addition re-triggers a mid-file desync, reopen with that file as the repro.
Activity
squid-protocol commentedon Aug 29, 2026
Update from PR #2441 (the same sweep that filed this):
The two keyword-desync sources this issue lists as "likely triggers" turned out to be
_apply_literal_shieldbugs, both fixed in #2441:#(Lua length operator) and//(floor division) were in the shared defaultcomment_markersset, sofor i = 1, #arg do ... endwas truncated at the#and lost itsendfrom the Mode-D count (bit.bnot_[Truncated]).[[ ]]/--[[ ]]were never shielded (code.lua'sAnonymous_Block_[Truncated],coroutine.lua'snew_[Truncated]).After #2441, every lua corpus file's Mode-D keyword count is perfectly balanced — this issue
has no remaining lua repro. The 4 residual
_[Truncated]satellites(
binarytrees.lua,events.lua,fetch.lua,maxmind.lua) are a different mechanism —polyglot segmentation splitting a function when a
[[ ]]string carries embedded HTML — nowtracked separately as #2440.
The "contain the blast radius for a mid-file runaway" suggestion is still a reasonable defensive
measure to keep if a non-lua Mode-D language hits this shape, but it's no longer load-bearing for
lua. Closing vs. keeping open as a general hardening task is a maintainer call.
fix(lua): Mode-D nested-function recall + literal-shield tokenisation
fix(lua): Mode-D nested-function recall + literal-shield tokenisation (…
fix(lua): one-line functions, [[ ]] segmentation splits, class heuris…
fix(lua): shield `\z` string continuation across newlines (#2437) (#2447
squid-protocol commentedon Aug 30, 2026
Resolved by the accumulated lua fixes — #2438 (one-line function heads), #2439 (proto-table class gate), #2440 (polyglot
<style>split), #2447 (\zstring-continuation shield), #2461 (;-anchoredfunc_start/function_opener).Verified as of
main@ 5ea3eaa: zero_[Truncated]satellites in the entire lua corpus (and none in shell/tcl/ruby either — the Mode-D mid-file desync class is gone corpus-wide). The ledger shape this issue was surfaced by,lua/function/existence/agree[gitgalaxy]_vs[ctags,tree_sitter], is nowstill_reproduces: false.The generic blast-radius-containment mechanism proposed here (re-slice an oversized Mode-D satellite by labels when it contains ≥2
func_startmatches) is a reasonable defensive hardening, but there is no remaining repro to drive or validate it. Closing; if a future corpus addition re-triggers a mid-file desync, reopen with that file as the repro.fix(recall): dart/typescript/lua reach 100% function recall — close t…