Repository navigation
feat(shared): resolve every herdr action, direct binding and navigate key - #4398
Conversation
resolveAllHerdrKeys(keys) takes the same [keys] table as resolveHerdrKeys and returns every one of herdr's 52 actions outside navigate mode with its default and the bindings herdr keeps for it (after the prefix or direct, each with its chords and digit index), the prefix keys, the direct (prefix-free) chords, whether the config was read, and refusals with a machine-readable code: a direct binding on a key that types text without ctrl, alt or super is refused and gets no binding, as are unreadable chords, a key an earlier user binding holds, a prefix key, a misplaced range and an unknown [keys] name. Both resolvers now read one resolution over the one FIELDS table of actions and defaults. The HerdrKeys type and what resolveHerdrKeys returns are unchanged: its answers for 22 config fixtures are byte-identical before and after. Slice: 2j
…r's answer for sparse lists
herdr reads navigate-mode keys under [keys] (navigate_workspace_*, navigate_pane_*) and allows plain keys there. resolveAllHerdrKeys no longer calls them unknown actions: it returns them in a new navigate field (name, text, chord), kept apart from the terminal-mode bindings, and refuses only what navigate mode cannot take: a prefix+ form or a range (unparsable), Escape, Enter, Tab, an arrow or a digit (reserved), a prefix key, or a chord an earlier navigate key holds.
The prefix lists are read again in a way that skips a hole in an array, as resolveHerdrKeys did before: { prefix: [, "ctrl+a"] } answers ["ctrl+a"] instead of throwing. The existing resolver answers 498 inputs, including parsed values no TOML text produces, exactly as at the base, and throws for the same ones.
Slice: 2j
…herdr's own defaults herdr 0.9.5's printed default configuration names exactly six navigate-mode keys under [keys], with their defaults: navigate_workspace_up up, navigate_workspace_down down, navigate_pane_left h, navigate_pane_down j, navigate_pane_up k, navigate_pane_right l. They are now one small table beside the 52 actions, and resolveAllHerdrKeys returns all six in that order, each with its default and the key it holds: the user's when written, else the default. A key the user writes that keeps nothing holds no key, as an action the user writes does. Any other navigate_* name is an unknown name, so a typo is reported. remote_image_paste, which the same file documents, is a known name too. The reserved rule follows herdr's own sentence (do not include prefix+, esc, enter, tab, or 1..9): a plain Escape, Enter, Tab or digit 1 to 9 is refused as reserved, a prefix+ form as unparsable. The arrows, 0 and any key with a modifier are kept, so herdr's own up and down defaults written out give no refusal. The existing resolver is untouched: it answers 581 inputs, sparse lists and all six navigate names included, exactly as at the base, and throws for the same ones. Slice: 2j
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 13 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Merged through reviews: dori review CLEAR at 19f17cb; omo gate reviewer (GPT-6 Astra) CLEAR at 19f17cb; CodeRabbit: review limit reached |
…4493) (#4975) ## What Fixes seven of the CodeRabbit findings collected in #4493, each reproduced on origin/main with a test that fails there and passes here: - **`scripts/test-hc.ts` (item 2):** `stop()` revalidates the instance's root before stopping a core, so it no longer runs `server stop` against another isolated core's socket. - **`server/herdr-core/connection.ts` (item 3):** an `onEnd` listener that throws no longer stops cleanup: pending calls are still refused, channels closed and the transport killed (try/finally), and the error still reaches the caller. - **`server/herdr-core/core.fake.ts` (item 4):** the fake core sends the attach reply, then the first paint, then the bytes written during the resize; it no longer sends DATA on a new channel before the attach reply. - **`tui/crash.ts` (item 7):** a message line that starts with `at ` is no longer taken for a stack frame. - **`tui/main.ts` (item 13):** the terminal is restored before crash diagnostics are built, so a throwing stack getter cannot skip `leave()`. - **`tui/host/guard.ts` (items 10, 11):** an end listener that throws no longer stops signal shutdown (it counts as ended; the signal sets the exit code, 143/129 as before); when the terminal is gone at ENTER, stdin is not read, whether the end listener gives the terminal back at once or later (the app's own listener closes asynchronously). `enter()` still returns true there, because the loop maps false to `not_a_terminal`. `HeadlessHost.reading()` was added for the tests only. ## Not changed here Already fixed on main: item 5 (#4414) and item 14 (#4420). Not reproduced: item 15 (the keymap refuses printable direct bindings, #4398) and item 16 (a partial write needs about 219 KB on Linux; the report line is at most about 98 KB). Left for a decision: items 1, 6, 8, 9 and 12 (see the issue). ## Validation - The 8 new tests fail with origin/main's sources and pass here; the touched files' suites pass (255 tests). - `bun run check fast`: exit 0 (30029 pass). Earlier runs on a loaded PC timed out in untouched files (`winvm-runner.test.ts`, `machine-core-choice.test.ts`), which pass alone. - No test signals a process it did not start. ## Reviews omo gate at a0df8a7: CLEAR (LOWs only). Codex via axwith ran its 25 minutes without a verdict; omo-native-code-reviewer stood in: CLEAR with one MEDIUM (reading still started when the end listener gives the terminal back asynchronously), fixed in f5003f9 with a test that fails without it (tui/host, loop and main suites: 258 pass; typecheck exit 0). Refs #4493 --------- Co-authored-by: sisyphus-dev-ai <[email protected]>
Change
resolveAllHerdrKeys(keys)inshared/herdr-keys.tsreads the same[keys]table asresolveHerdrKeysand returns all of it:navigate_workspace_up,navigate_workspace_down,navigate_pane_left,navigate_pane_down,navigate_pane_up,navigate_pane_right), in that order, each with its default and the key it holds;[keys]name (so a typo is reported), and for a navigate key what herdr reserves there (a plain Escape, Enter, Tab or digit 1 to 9, or aprefix+form).Both resolvers now read one resolution over one table of actions and defaults.
resolveHerdrKeysand itsHerdrKeystype are unchanged: it answers 581 inputs, sparse lists and the navigate names included, exactly as at the base, and throws for the same ones;{ prefix: [, "ctrl+a"] }still answers["ctrl+a"]. Nothing callsresolveAllHerdrKeysyet: the web and the server keepresolveHerdrKeys.shared/is a remote-bundle input (scripts/release-guards.ts), so the next release raisesREMOTE_BUNDLE_VERSION.Validation
bun run check fastat19f17cb76, on the heavy host (hosthatch), with its own hc: exit 0. Workflow syntax, generated types, generated themes, typecheck and build ok; unit tests 21531 pass, 0 fail, 45 skip in 1098 files,shared/herdr-keys.test.tsamong them.scripts/herdr-prefix-keys-demo-regression.ts, the browser script that reads herdr's keys, in the self-hosted CI runner image as its own user, the wayci.yml's browser jobs run it: pass.bun run check full.Slice: 2j