Skip to content

Commit 69c4f1e

Browse files
fix(cli): complete the live slash-submit deps and fixture (#10944) (#10961)
Main's post-merge lane is red on its ESLint step, and two unit tests in the same area fail next to it. Both trace to #10929, which made Enter resolve a `/`-prefixed buffer against the live command list instead of the render-derived completion that can still describe the previous keystroke. The keypress callback that reads that list never added it to its dependencies, so `react-hooks/exhaustive-deps` reports a missing `slashCommands` and the lane's `--max-warnings 0` turns the single warning into a failed step. The omission is also the very staleness the commit set out to remove: a handler captured against an older list resolves the live command from stale data. The same commit exposed a fixture that never matched production. The test command list declared `memory` with subcommands but no action, while the real command is runnable, and the hook both the old and the new path consult requires an action before it calls a match perfect. Two tests therefore mocked a perfect match for a buffer the live list called unrunnable — a state the real hook cannot produce — and Enter stopped submitting. Giving the fixture the action the real command has restores both with their assertions untouched; a third test sharing the fixture had been passing only because the perfect-match branch was dead for that buffer, and now exercises the path it was written for.
1 parent b559525 commit 69c4f1e

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

packages/cli/src/ui/components/InputPrompt.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ const mockSlashCommands: SlashCommand[] = [
130130
name: 'memory',
131131
kind: CommandKind.BUILT_IN,
132132
description: 'Manage memory',
133+
action: vi.fn(),
133134
subCommands: [
134135
{
135136
name: 'show',

packages/cli/src/ui/components/InputPrompt.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,6 +1893,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
18931893
focus,
18941894
buffer,
18951895
completion,
1896+
slashCommands,
18961897
shellModeActive,
18971898
setShellModeActive,
18981899
onClearScreen,

0 commit comments

Comments
 (0)