Skip to content

fix(rich-ui): don't duplicate option list when menu renders#141

Merged
royosherove merged 2 commits into
mainfrom
fix/menu-caption-no-duplication
May 16, 2026
Merged

fix(rich-ui): don't duplicate option list when menu renders#141
royosherove merged 2 commits into
mainfrom
fix/menu-caption-no-duplication

Conversation

@royosherove
Copy link
Copy Markdown
Member

When the inline keyboard renders, the verbose *Available:* block above it is redundant — the buttons already show the options.

Fix: Add optional RichResponse.menuCaption for the concise body shown next to the keyboard. Transports use it when rendering a menu; fall back to text (verbose) otherwise.

buildSelectableMenu() now sets both:

  • text (fallback): header + Available list + hint
  • menuCaption (with menu): header + hint only

Tests: 565 green (+3). Mutation-tested: assert text content NOT in sent payload when menuCaption is set.

When postRich rendered the inline keyboard, it also showed the verbose
text fallback ("*Available:*" + every option key) above it. Buttons
already enumerate the options — redundant noise.

Fix: add optional `RichResponse.menuCaption` for the concise body
shown next to the keyboard. Transports prefer it when rendering a
menu; fall back to `text` (verbose) when caption is absent or when
menu can't render.

`buildSelectableMenu()` now sets:
- `text` (fallback): header + *Available:* list + hint
- `menuCaption` (with menu): header + hint only

+3 tests:
- rich-helpers: caption is concise (no Available block, no option keys)
- telegram-postrich: menuCaption is sent (not text) when both present
- telegram-postrich: falls back to text when menuCaption absent

565 tests green (+3).
Architect review of PR #141 caught drift: design doc shows old
RichResponse shape. Add menuCaption + one-line rationale; point
to types.ts as source of truth.
@royosherove royosherove merged commit 5f0d662 into main May 16, 2026
1 check passed
@royosherove royosherove deleted the fix/menu-caption-no-duplication branch May 16, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant