From 928d05d2987c3706e910deda4f17e14da0ebb3e6 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 12 Nov 2026 06:37:31 +0000 Subject: [PATCH 1/2] test(contracts): resolved Space shortcuts survive the wire round trip Failing reproduction for #32007. AI-assisted; verified with the tests and tools listed above. --- packages/contracts/src/keybindings.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/contracts/src/keybindings.test.ts b/packages/contracts/src/keybindings.test.ts index 0b887507859fc..9ea9272e6c3d8 100644 --- a/packages/contracts/src/keybindings.test.ts +++ b/packages/contracts/src/keybindings.test.ts @@ -37,6 +37,21 @@ it.effect("drops resolved rules with commands this build does not know", () => }), ); +it.effect("round-trips resolved Space shortcuts", () => + Effect.gen(function* () { + const codec = Schema.fromJsonString(ResolvedKeybindingsConfig); + const rules = [ + { + command: "composer.dictation" as const, + shortcut: { ...shortcut, key: " ", metaKey: true, modKey: false }, + }, + ]; + const encoded = yield* Schema.encodeEffect(codec)(rules); + const parsed = yield* decode(codec, encoded); + assert.deepEqual(parsed, rules); + }), +); + it.effect("drops malformed resolved rule entries", () => Effect.gen(function* () { const parsed = yield* decode(ResolvedKeybindingsConfig, [ From ca10122aca5e1c589764e857f58c215019d26d4e Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 12 Nov 2026 06:42:49 +0000 Subject: [PATCH 2/2] fix(contracts): Space shortcuts reach clients instead of reverting to defaults The space token resolves to the key " ", but KeybindingShortcut.key reused the trimmed KeybindingValue, so it crossed the wire as "" and clients dropped the rule. Shortcut keys now keep their whitespace. Fixes pingdotgg/t3code#32007 AI-assisted; verified with the tests and tools listed above. --- packages/contracts/src/keybindings.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/contracts/src/keybindings.ts b/packages/contracts/src/keybindings.ts index 3338c1a456002..eda5138b760b9 100644 --- a/packages/contracts/src/keybindings.ts +++ b/packages/contracts/src/keybindings.ts @@ -154,8 +154,14 @@ export const KeybindingsConfig = Schema.Array(KeybindingRule).check( ); export type KeybindingsConfig = typeof KeybindingsConfig.Type; +// Untrimmed: the `space` token resolves to the key " ". +const KeybindingShortcutKey = Schema.String.check( + Schema.isMinLength(1), + Schema.isMaxLength(MAX_KEYBINDING_VALUE_LENGTH), +); + export const KeybindingShortcut = Schema.Struct({ - key: KeybindingValue, + key: KeybindingShortcutKey, metaKey: Schema.Boolean, ctrlKey: Schema.Boolean, shiftKey: Schema.Boolean,