Skip to content

[CTX-1932] fix(config): list toggle_panel_mode in KNOWN_ACTIONS_HINT (bitty#3303) - #3304

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-1932-fix-known-actions-hint
Nov 21, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-1932-fix-known-actions-hint

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The keymaps[].action unknown-action diagnostic drifted from the shipped defaults (issue #3303).

  • [CTX-1931] feat(ctl,ui): add the ctrl+alt+a mode toggle and ctl panel mode verb (bitty#2388) #3302 landed ("ctrl+alt+a", "toggle_panel_mode") in DEFAULT_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 at keymap.rs:1445 as unknown 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

  • Add toggle_panel_mode to KNOWN_ACTIONS_HINT (after toggle_pinned, mirroring the canonical() arm order). The command:<owner:command> tail stays last per the hint ordering convention.
  • Gate the list by enumeration, not a hand-picked list: the new test known_actions_hint_covers_every_default_keymaps_action derives every action spelling DEFAULT_KEYMAPS ships (106 entries), requires each to parse through the action parse table, and requires each one's base spelling — everything from the first : stripped, so goto_split:left matches the goto_split:<left|right|up|down> entry and toggle_scratchpad matches toggle_scratchpad[:<name>] — to appear in the hint. It also pins the convention that the command:<owner:command> tail stays last.

What the enumeration gate derives

  • The 106 shipped bindings reduce to 36 distinct base spellings; the only one missing from the hint was toggle_panel_mode — no other shipped action was absent, so no extra spellings were added.
  • Retired spellings (enter_copy_mode, open_search, search_next, toggle_help, show_help, ...) do not ship in DEFAULT_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

  • Green (lane worktree, with fix): cargo nextest run -p bitty-config → 554/554 passed, including the new test.
  • Red (scratch copy under /tmp/bitty/ctx-1932-mutation/, production hunk reverted only — toggle_panel_mode removed from the hint, test kept): the test fails with KNOWN_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 — pass
  • cargo clippy -p bitty-config --all-targets -- -D warnings — pass (exit 0)
  • cargo nextest run -p bitty-config — 554 run, 554 passed, 0 skipped
  • cargo +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

  • Bug Fixes
    • Updated the available action hints to include the panel mode toggle, keeping them aligned with supported actions.

…(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
@Xuepoo Xuepoo added this to the v0.1.0 milestone Nov 21, 2026
@Xuepoo Xuepoo added fix Bug fix area:config Area: configuration P2 Priority: medium labels Nov 21, 2026
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The keymap action hint now includes toggle_panel_mode. A new test checks that shipped default actions appear in the hint and that the open-ended command: entry remains last.

Changes: Keymap action hint

Layer / File(s) Summary
Hint entry and coverage check
crates/bitty-config/src/keymap.rs
The hint adds toggle_panel_mode. A test checks that each shipped default action parses and is listed in the hint, and that command: remains the final entry.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • bitty-terminal/bitty#3302: Introduces and ships the toggle_panel_mode action that this change adds to the hint and coverage test.
Merge Risk: Minimal · up to de43a

The unknown-action error message now lists the shipped panel-mode action, and a new test guards against future drift. The risk of merging is minimal.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #3303 requires (1) adding toggle_panel_mode to KNOWN_ACTIONS_HINT, (2) a test that enumerates parse-table and DEFAULT_KEYMAPS actions and checks each appears in the hint, (3) keeping the command… Make the diff or the changed hunks of crates/bitty-config/src/keymap.rs readable at the reviewed head (the KNOWN_ACTIONS_HINT const and the known_actions_hint_covers_every_default_keymaps_action test). Then confirm that toggle_panel_mode ap…
Passed Passed checks: 3 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: adding toggle_panel_mode to KNOWN_ACTIONS_HINT in the config crate. The raw summary and objectives confirm this is the primary change, with a supporting test. The titl…
Out of Scope Changes check Passed The raw summary reports changes only in crates/bitty-config/src/keymap.rs (+51/-1), with no public declaration changes. The described changes are the hint entry and a test that checks hint coverage an…
Full details: Title check

Explanation

The title names the main change: adding toggle_panel_mode to KNOWN_ACTIONS_HINT in the config crate. The raw summary and objectives confirm this is the primary change, with a supporting test. The title includes a ticket ID and a conventional-commit prefix, which is acceptable and does not make it misleading.

Full details: Out of Scope Changes check

Explanation

The raw summary reports changes only in crates/bitty-config/src/keymap.rs (+51/-1), with no public declaration changes. The described changes are the hint entry and a test that checks hint coverage and the command: tail ordering, both within the issue #3303 scope. The summary shows no unrelated functional change. This assessment relies on the summary because the diff could not be read; the file-level scope is consistent with the stated fix.

Full details: Linked Issues check

Explanation

Issue #3303 requires (1) adding toggle_panel_mode to KNOWN_ACTIONS_HINT, (2) a test that enumerates parse-table and DEFAULT_KEYMAPS actions and checks each appears in the hint, (3) keeping the command:<owner:command> tail last and retired spellings excluded. The PR summary and PR description state that all three are implemented in crates/bitty-config/src/keymap.rs (+51/-1). I could not verify this. The diff tool reported that the changed blobs are missing from the checkout, and a full-file read of keymap.rs truncated at 16000 bytes before reaching KNOWN_ACTIONS_HINT (~line 1793) or the new test. The test results (554/554) are author-reported and not independently confirmed.

Resolution

Make the diff or the changed hunks of crates/bitty-config/src/keymap.rs readable at the reviewed head (the KNOWN_ACTIONS_HINT const and the known_actions_hint_covers_every_default_keymaps_action test). Then confirm that toggle_panel_mode appears in the hint, that the test enumerates DEFAULT_KEYMAPS and the parse table, and that the command: tail assertion exists.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f6c22958-3618-4dd9-950a-8c317551337c
Commits

Reviewing files that changed from the base of the PR and between 944a4b1 and de43acf.

Files selected for processing: 1

  • crates/bitty-config/src/keymap.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@Xuepoo Xuepoo left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 listed from KNOWN_ACTIONS_HINT itself — strips the expected one of lead-in (:3639), splits on ", ", cuts each entry at the first ':' or '[' (:3643), so goto_split:<left|right|up|down> counts as goto_split and toggle_scratchpad[:<name>] as toggle_scratchpad.
  • :3647 for (_chord, action) in DEFAULT_KEYMAPS iterates 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, fresh Compiling bitty-config from 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-1932 was 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 for str::find (stable since 1.71), comfortably under 1.85, and the +1.85 --tests check 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

@Xuepoo
Xuepoo merged commit 48f297d into main Nov 21, 2026
21 checks passed
@Xuepoo
Xuepoo deleted the ctx-1932-fix-known-actions-hint branch November 21, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:config Area: configuration fix Bug fix P2 Priority: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[config] KNOWN_ACTIONS_HINT omits the shipped toggle_panel_mode action (unknown-action hint drift)

1 participant