Skip to content

fix(send): @-mention with whitespace = broadcast not DM (closes #141) - #253

Merged
joelteply merged 1 commit into
canaryfrom
fix/at-mention-in-channel-not-dm
Apr 28, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/at-mention-in-channel-not-dm

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Whitespace inside the parsed @-target = not a peer name = user wants in-channel @-mention. Treat as broadcast.

continuum-b741's QA finding 2026-04-27: `airc msg "@bob looks good"`
parsed @bob as DM target and rejected the multi-word remainder (or in
post-#234 sent rest as DM). Users want IRC-style in-channel @-mentions
for emphasis without forcing them to add filler text before the @name.

## Fix

After collecting leading @-tokens into _peer_csv, check for internal
whitespace. Peer names are [a-z0-9-] — whitespace inside the parsed
target means it's not a peer name. Treat as broadcast intent: put the
@-prefix back in the message body, set peer_name=all.

  airc msg "@bob looks good"  →  broadcast: '@bob looks good'
  airc msg @bob "looks good"  →  DM to bob: 'looks good'  (unchanged)
  airc msg @bob               →  empty-body error w/ recovery hint  (#147)

Verification: tabs 19/0; manual exercise of all 3 cases.
Copilot AI review requested due to automatic review settings April 28, 2026 23:04
@joelteply
joelteply merged commit 535770c into canary Apr 28, 2026
@joelteply
joelteply deleted the fix/at-mention-in-channel-not-dm branch April 28, 2026 23:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adjusts airc msg/airc send DM-target parsing so that a quoted @... token containing whitespace is treated as an in-channel @-mention (broadcast) rather than a DM target, addressing #141.

Changes:

  • Adds a whitespace check on the parsed @ target list to reinterpret it as broadcast intent.
  • Reconstructs the message body by re-attaching the @ prefix when broadcasting.
  • Updates the “empty body after leading @-tokens” usage guidance to reflect the new rule.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/airc_bash/cmd_send.sh
Comment on lines +128 to +139
# #141: if the parsed @-target contains whitespace, it's not a peer
# name (peer names are [a-z0-9-]); user clearly wanted an in-channel
# @-mention via something like `airc msg "@bob looks good"`. Treat
# as broadcast and put the @-prefix back in the message body.
case "$_peer_csv" in
*[[:space:]]*)
msg="@${_peer_csv}"
if [ -n "$*" ]; then
msg="${msg} $*"
fi
peer_name="all"
;;

Copilot AI Apr 28, 2026

Copy link

Choose a reason for hiding this comment

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

The whitespace-in-$_peer_csv heuristic can accidentally convert an intended DM into a broadcast. Example: airc msg @alice "@bob looks good" currently parses the quoted message as another @-target (because it starts with @), then hits the whitespace branch and broadcasts @alice,bob looks good to everyone. This is a privacy/leak risk. Consider handling this earlier during the while loop: if an @... token contains internal whitespace, stop collecting DM targets and treat that token (with its leading @) as the start of the message body instead of folding it into $_peer_csv.

Copilot uses AI. Check for mistakes.
Comment thread lib/airc_bash/cmd_send.sh
Comment on lines +129 to +131
# name (peer names are [a-z0-9-]); user clearly wanted an in-channel
# @-mention via something like `airc msg "@bob looks good"`. Treat
# as broadcast and put the @-prefix back in the message body.

Copilot AI Apr 28, 2026

Copy link

Choose a reason for hiding this comment

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

The comment says peer names are [a-z0-9-], but _validate_peer_name enforces [a-z0-9-]+ and also rejects names starting with - (airc:360-372). Please update this comment to match the actual peer-name rules to avoid misleading future changes.

Suggested change
# name (peer names are [a-z0-9-]); user clearly wanted an in-channel
# @-mention via something like `airc msg "@bob looks good"`. Treat
# as broadcast and put the @-prefix back in the message body.
# name (peer names match [a-z0-9-]+ and cannot start with '-');
# user clearly wanted an in-channel @-mention via something like
# `airc msg "@bob looks good"`. Treat as broadcast and put the
# @-prefix back in the message body.

Copilot uses AI. Check for mistakes.
Comment thread lib/airc_bash/cmd_send.sh
Comment on lines +128 to +132
# #141: if the parsed @-target contains whitespace, it's not a peer
# name (peer names are [a-z0-9-]); user clearly wanted an in-channel
# @-mention via something like `airc msg "@bob looks good"`. Treat
# as broadcast and put the @-prefix back in the message body.
case "$_peer_csv" in

Copilot AI Apr 28, 2026

Copy link

Choose a reason for hiding this comment

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

This change introduces new parsing behavior for quoted @-mentions (whitespace inside an @... token). There are integration tests for airc msg/send in test/integration.sh, but none appear to cover the #141 case; adding a scenario for airc msg "@bob looks good" (broadcast) and airc msg @alice "@bob looks good" (should remain a DM) would help prevent regressions.

Copilot uses AI. Check for mistakes.
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.

2 participants