-
Notifications
You must be signed in to change notification settings - Fork 299
Cron delivery fails for Enterprise Slack workspaces — is_valid_instance_name misidentifies workspace IDs #520
Description
Summary
Enterprise Slack workspace/channel IDs (e.g. T0APRHSB676, D0APL3DF66S, C0APL3DF66S) contain mixed uppercase letters and digits. The is_valid_instance_name() function in src/messaging/target.rs only rejects the classic format (uppercase letter + all-digits, like T012345), causing Enterprise IDs to be misidentified as named adapter instances.
Impact
All cron jobs created from Enterprise Slack workspaces fail delivery. The stored delivery target slack:T0APRHSB676:D0APL3DF66S is parsed as:
- Expected: adapter=
slack, target=D0APL3DF66S - Actual: adapter=
slack:T0APRHSB676, target=D0APL3DF66S
This causes broadcast() to fail with no messaging adapter named 'slack:T0APRHSB676'.
Regular (non-cron) messages are unaffected because they use the adapter reference from the inbound message object, bypassing the delivery target parser.
Root Cause
is_valid_instance_name() at line 670:
// Only rejects: uppercase letter + ALL digits (T012345)
if name.len() > 6
&& name.starts_with(|c: char| c.is_ascii_uppercase())
&& name[1..].chars().all(|c| c.is_ascii_digit())Enterprise IDs like T0APRHSB676 have mixed uppercase+digits in the tail, so they pass through as valid instance names.
Fix
Broaden the pattern to also reject uppercase letter + uppercase/digits when length >= 9:
if name.starts_with(|c: char| c.is_ascii_uppercase()) {
let tail = &name[1..];
if (name.len() > 6 && tail.chars().all(|c| c.is_ascii_digit()))
|| (name.len() >= 9 && tail.chars().all(|c| c.is_ascii_uppercase() || c.is_ascii_digit()))
{
return false;
}
}Fix committed on branch fix/upgrade-slack-morphism with tests.