fix(automations): four review findings on the trigger rows

Merged
SA
3mo ago
+82-11

Four of the six review findings from #6709. Three sit in flag-gated trigger UI that no customer can reach while automation-event-triggers stays internal; the fourth ships unflagged — see the callout below.

FixSymptom it removes
WebhookSentence copy button takes disabledToken was copyable from a row the parent had disabled
TokenField @-strip is now opt-inThe field also takes branches and labels, so a branch named @next was silently stored as next — a ref that doesn't exist. On for logins, off elsewhere
Cleared custom RRULE reports itselfAn emptied field parses to no problem at all, so the row sat blank under the previous rule's next run while being unsaveable
Slack options refetch after saveSaving auto-joins watched public channels, but the cached list kept botMember: false, so the membership warning outlived the save that fixed it

Also adds one case to the schedule row spec for the cleared-rule path.

One spec changed rather than added. TokenField had a test asserting a leading @ is always stripped — a deliberate decision about how people paste handles, not an accident. Rather than delete it, it now exercises the stripLeadingAt prop, with a companion case covering the branch value it used to mangle. The intent stays documented; only its scope narrows.

⚠️ One change reaches customers. The RRULE fix is in ScheduleSentence, and the Scheduled row bypasses the feature flag (provider.kind === "schedule" || kinds.has(...)), so it ships to everyone — prod holds 980 schedule triggers. It adds one string, "Enter a recurrence rule — changes aren't saved", following the two already in that row. Copy review is owed on it after the fact.

Not here: the EmojiNameChip minor, and the Major finding that useProviderOptions folds an option-source failure into an empty array, so a provider outage renders as "nothing to choose yet". That one's a real correctness gap and wants its own change.

Desktop 3238 pass / 0 fail, lint clean, typecheck clean.

https://claude.ai/code/session_01JZADY3P3hZ7PitayKpGKLg


Summary by cubic

Fixes four review findings in the trigger rows, three behind the internal automation-event-triggers flag; the custom-RRULE fix ships unflagged, so its copy is worth a review pass.

Bug Fixes

  • The webhook copy-token button now takes disabled, so a token can't be copied from a row the parent disabled.
  • TokenField only strips a leading @ when stripLeadingAt is set (on for logins); a value like @next keeps its @ instead of being stored as next.
  • TriggersEditor refetches Slack options after save — saving auto-joins watched public channels, and the cached list kept botMember: false, so the membership warning outlived its fix.
  • Clearing a saved custom RRULE now says "Enter a recurrence rule — changes aren't saved" instead of a blank editor under the old rule's next run.

The TokenField spec now exercises stripLeadingAt; the schedule spec covers the cleared-rule message.

Summary by CodeRabbit

  • Bug Fixes

    • Added a clear validation message when a custom schedule rule is emptied.
    • Slack trigger saves now refresh provider status, clearing outdated bot-membership warnings.
    • GitHub usernames remove a leading “@” when entered.
    • Other token values preserve “@” unless configured otherwise.
    • Disabled webhook copy buttons can no longer be activated.
  • Tests

    • Added coverage for empty schedule rules and GitHub token handling.