Repository navigation
[CTX-1932] fix(config): list toggle_panel_mode in KNOWN_ACTIONS_HINT (bitty#3303) - #3304
Conversation
…(bitty#3303) The unknown-action diagnostic drifted from the shipped defaults: #3302 landed `("ctrl+alt+a", "toggle_panel_mode")` in DEFAULT_KEYMAPS and the `toggle_panel_mode` parse/canonical arms, but never added the spelling to KNOWN_ACTIONS_HINT (crates/bitty-config/src/keymap.rs:1793), so the `keymaps[].action` error for a typo still denied a spelling the defaults themselves ship. Add `toggle_panel_mode` to the hint (after `toggle_pinned`, mirroring the canonical() arm order; the `command:<owner:command>` tail stays last) and gate the list by enumeration: the new `known_actions_hint_covers_every_default_keymaps_action` test derives every action spelling DEFAULT_KEYMAPS ships, requires each to parse through the action table, and requires each one's base spelling (cut at the first ':', so `goto_split:left` matches `goto_split:<...>`) to be listed in the hint. Retired spellings stay excluded — none ship in DEFAULT_KEYMAPS, so the enumeration never asks for one, and the existing absence asserts stay green. Closes #3303
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Xuepoo
left a comment
There was a problem hiding this comment.
Independent review (guard-dispatched independent reviewer; not the PR author). Reviewed head: de43acf767019632202fe8c523f4ac29f22e5a0c — unchanged from the expected head when I fetched it; PR state open. All gates were re-run by me against the lane worktree with a fresh review target dir (.targets/ctx-1932-review), never the lane's warm dir.
| # | Check | Verdict |
|---|---|---|
| 1 | Diff scope | PASS |
| 2 | Production hunk | PASS |
| 3 | Enumeration gate quality | PASS |
| 4 | Independent discrimination proof | PASS |
| 5 | Exclusion integrity | PASS |
| 6 | Gates at head, re-run | PASS |
| 7 | PR hygiene | PASS |
1. Diff scope — PASS. Exactly one commit on the branch (API .commits = 1): de43acf7 [CTX-1932] fix(config): list toggle_panel_mode in KNOWN_ACTIONS_HINT (bitty#3303), parent 944a4b1f = the PR base SHA. API file list: only crates/bitty-config/src/keymap.rs, +51/−1. git status --short empty at head.
2. Production hunk — PASS. crates/bitty-config/src/keymap.rs:1798 now reads ... toggle_palette, toggle_floating, toggle_pinned, toggle_panel_mode, tab_open, tab_next, ... — toggle_panel_mode placed immediately after toggle_pinned, mirroring the canonical() arm order at :1493-1494. Verified programmatically that the line still ends ..., new_window, command:<owner:command>";, i.e. the command:<owner:command> tail is the LAST entry of the string. New doc comment at :1793-1797 records the enumeration gate.
3. Enumeration gate quality — PASS. known_actions_hint_covers_every_default_keymaps_action (keymap.rs:3625) derives its required set from the table itself, not a hand-picked list:
- :3638-3646 builds
listedfromKNOWN_ACTIONS_HINTitself — strips theexpected one oflead-in (:3639), splits on", ", cuts each entry at the first':'or'['(:3643), sogoto_split:<left|right|up|down>counts asgoto_splitandtoggle_scratchpad[:<name>]astoggle_scratchpad. - :3647
for (_chord, action) in DEFAULT_KEYMAPSiterates the actual shipped table — I independently counted 106 binding tuples (73 distinct action strings → 36 distinct base spellings), matching the PR body's numbers. - :3648-3649 requires every shipped binding to parse via
ChromeAction::parse, panicking otherwise. - :3650-3655 requires each binding's BASE spelling (cut at the first
':') to appear in the hint. - :3660-3665 pins the convention: the last comma-separated hint entry must
starts_with("command:").
Residual drift surface (noted, not blocking): the gate enumerates only DEFAULT_KEYMAPS-shipped spellings, so parse-accepted spellings with no default binding (open_composer, fold_*, toggle_palette, paste_from_primary, scratchpad_to_tiled, new_window) could drift out of the hint without this test failing, and there is no subset assert rejecting bogus extra non-retired entries. Both are outside the test's stated contract ("covers every shipped default"), which the PR body scopes exactly that way.
4. Independent discrimination proof — PASS. I copied the tree to my own scratch dir (/tmp/bitty/ctx-1932-review-mut/, byte-identical: sha256 of keymap.rs 63d92fff…deccc86 matched the lane head), reverted ONLY the production hunk (removed toggle_panel_mode, from the hint string, test kept), and ran cargo nextest run -p bitty-config known_actions_hint with the review target dir. RED as claimed, exit 100:
FAIL bitty-config keymap::tests::known_actions_hint_covers_every_default_keymaps_action
panicked at crates/bitty-config/src/keymap.rs:3651:13:
KNOWN_ACTIONS_HINT must advertise shipped action "toggle_panel_mode" (base "toggle_panel_mode", canonical "toggle_panel_mode")
Summary: 1 test run: 0 passed, 1 failed, 553 skipped
Scratch restored to pristine afterwards (sha256 re-matched; diff -r clean). The lane worktree was never mutated.
5. Exclusion integrity — PASS. Verified programmatically that the hint string at :1798 contains none of enter_copy_mode, open_search, search_next, toggle_help, show_help. The exclusion asserts all still exist and pass at this head: the W-144 retired-namespace asserts at :3614-3615 and :3619-3621 (previously :3614-3616, shifted +5 by the new doc comment), the toggle_help hint-absence assert at :5508-5511 (previously :5460, shifted +51 by the insertion), and the no-hint retired-error assert assert!(!err.contains(KNOWN_ACTIONS_HINT)) at :5648 inside retired_action_parse_error_names_the_migration (previously :5597) — untouched by this diff and unchanged in intent. The derivation cannot force a retired spelling into the hint: retired spellings fail closed in ChromeAction::parse, so a hypothetical retired DEFAULT_KEYMAPS binding would panic at :3648-3649 ("shipped default must parse") instead of ever being asserted into the vocabulary.
6. Gates at head, re-run by me — PASS.
cargo fmt --check— exit 0.cargo clippy -p bitty-config --all-targets -- -D warnings— exit 0 (fresh compile from the lane path).cargo nextest run -p bitty-config— 554 tests run: 554 passed, 0 skipped, exit 0, freshCompiling bitty-configfrom the lane path. One honest note: my first nextest invocation silently reused the test binary my own discrimination run had left in the shared review target dir (Finished in 0.06s, no rebuild) and false-REDdened; I purged the package (cargo clean -p bitty-config) and re-ran with a genuine rebuild — the counts above are from that clean run. That is precisely the warm-target-dir artifact-reuse hazard the review protocol warns about; the lane's.targets/ctx-1932was never touched.cargo +1.85 check -p bitty-config --tests --offline— exit 0 (fresh from the lane path).RUSTDOCFLAGS="-D warnings" cargo doc -p bitty-config --no-deps— exit 0.- MSRV eyeball of the new test: no let-chains, no if-let match guards, no const-eval-only reads; the newest API used is the
[char; N]pattern forstr::find(stable since 1.71), comfortably under 1.85, and the+1.85 --testscheck compiles the test green.
7. PR hygiene — PASS. Body contains Closes #3303 (also in the commit message), an evidence summary (## Summary, ## What the enumeration gate derives, ## Gate results) and the discrimination result (## Discrimination proof, green 554/554 plus the red failure line). Labels: fix, P2, area:config. Milestone: v0.1.0.
VERDICT: APPROVE
Summary
The
keymaps[].actionunknown-action diagnostic drifted from the shipped defaults (issue #3303).("ctrl+alt+a", "toggle_panel_mode")inDEFAULT_KEYMAPS(crates/bitty-config/src/keymap.rs:2315) together with the parse arm (keymap.rs:1382) and the canonical spelling arm (keymap.rs:1494).KNOWN_ACTIONS_HINT(keymap.rs:1793), which the unknown-action error formats atkeymap.rs:1445asunknown action 'x'; expected one of ..., was never updated — so a config typo still got a hint that denied a spelling the defaults themselves ship.Fix
toggle_panel_modetoKNOWN_ACTIONS_HINT(aftertoggle_pinned, mirroring thecanonical()arm order). Thecommand:<owner:command>tail stays last per the hint ordering convention.known_actions_hint_covers_every_default_keymaps_actionderives every action spellingDEFAULT_KEYMAPSships (106 entries), requires each to parse through the action parse table, and requires each one's base spelling — everything from the first:stripped, sogoto_split:leftmatches thegoto_split:<left|right|up|down>entry andtoggle_scratchpadmatchestoggle_scratchpad[:<name>]— to appear in the hint. It also pins the convention that thecommand:<owner:command>tail stays last.What the enumeration gate derives
toggle_panel_mode— no other shipped action was absent, so no extra spellings were added.enter_copy_mode,open_search,search_next,toggle_help,show_help, ...) do not ship inDEFAULT_KEYMAPS, so the enumeration never asks for one; the existing absence asserts (keymap.rs:3614-3616,keymap.rs:5460) and the no-hint retired-error assert (keymap.rs:5597) stay green unchanged.Discrimination proof
cargo nextest run -p bitty-config→ 554/554 passed, including the new test./tmp/bitty/ctx-1932-mutation/, production hunk reverted only —toggle_panel_moderemoved from the hint, test kept): the test fails withKNOWN_ACTIONS_HINT must advertise shipped action "toggle_panel_mode" (base "toggle_panel_mode", canonical "toggle_panel_mode"). The lane worktree was never mutated for the proof and was pristine before commit.Gate results
cargo fmt --check— passcargo clippy -p bitty-config --all-targets -- -D warnings— pass (exit 0)cargo nextest run -p bitty-config— 554 run, 554 passed, 0 skippedcargo +1.85 check -p bitty-config --tests --offline— pass (exit 0)RUSTDOCFLAGS="-D warnings" cargo doc -p bitty-config --no-deps— pass (exit 0)Closes #3303
Summary by CodeRabbit