Repository navigation
Conversation
|
|
Thanks for narrowing this down to the minimal fix. Two things in the stub: Singular getters that end in local function empty_list()
return setmetatable({}, {
__index = function(_, k)
if type(k) == "number" then return nil end
return noop
end,
})
end
-- in hl's metatable
__index = function(_, key)
if type(key) == "string" and key:match("^get_.*s$") then
return empty_list
end
return noop
end,(The Nit: scan errors now disable the cache for good. Any config that errors under the mock (an unhandled For reference, the same hang is reported in #12052, #7025, #12124, #14243 and #13979. #12916 and #7564 are other open attempts at containing the scan. |
|
Thanks, re-checked: singular getters now get a list that still answers field lookups, and ordinary scan errors are cached again. Both look good. About Greptile's P1 on partial scans being cached: that's the tradeoff from my nit, so it's on me. It's fine as long as editing the config invalidates the cache. If the cache key doesn't already cover config changes (mtime or a hash), please add that so a fixed config gets rescanned. With that, LGTM. |
|
Thanks, both points are handled: singular getters still answer field lookups, and ordinary scan errors are cached again, with only the instruction guard skipping the cache. About Greptile's "partial scans become permanent": caching after an ordinary error is the behavior from before this PR (the |
The mocked hl API answered every unknown member with a self-returning noop proxy, so ipairs(hl.get_workspaces()) never terminated and each Super+K on a cache miss left a CPU-bound Lua process behind (omacom#13979). Return empty tables for plural hl.get_*s() queries, keep singular queries truthy and get_config() nil, and run the config scan under a generous 50M instruction guard so any other runaway loop ends. Bindings collected before a failed scan are still used, but that run is not cached so the next Super+K rescans.
Plural hl.get_*s() stubs now return an empty list whose numeric keys are nil (so ipairs/# terminate) but whose string fields still answer with the noop proxy, so singular getters that happen to end in s (get_cursor_pos, get_status, ...) no longer abort the scan. Only the instruction guard skips the cache; a config that merely errors under the mock is cached again as before.
bfd2fcb to
6e461c8
Compare
Comments Outside DiffThese findings could not be posted inline.
|
Fixes #13979
What
bin/omarchy-menu-keybindings: in the mockedhlAPI used by the Lua bind scanner, plural runtime queries (hl.get_workspaces(),get_monitors(),get_clients(),get_windows(), …, anyget_*smember) now return an empty table instead of the self-returning noop proxy, soipairs(...)terminates. Singular queries keep returning the truthy proxy andget_config()still returnsnil, as onquattro.debug.sethookinstruction guard (50M instructions) so any other runaway loop ends instead of spinning. If the scan errors or hits the guard, the bindings collected so far are still used for this menu, but the result is not written to the cache, so the next Super+K rescans.An earlier revision of this PR fed live
hyprctl -jsnapshots into the scan. That added more failure modes than it fixed (Greptile's trailing-]quoting hang, oversized snapshots skipping the scan, cache churn on window title changes), so it has been dropped in favour of the minimal fix above.Why
Unimplemented members of the mocked
hlreturned anooptable whose__index/__callreturn itself, soipairs(hl.get_workspaces())never sawniland looped forever. Each Super+K on a cache miss left a CPU-bound Lua process behind.Testing
bash -n bin/omarchy-menu-keybindingstest/shell.d/keybindings-menu-test.shpasses, including new cases: a loop over each plural query terminates undertimeout 5and a bind declared after the loop is recovered (so the stub, not the guard, ends the loop); a bind underif hl.get_active_monitor() thenis still recovered; an erroring or infinite config renders rows, publishes no cache, and the next run with the same config rescans; a finite 2M-iteration config is not cut short.