spacedriveapp / spacedriveapp/spacebot

Cron delivery fails for Enterprise Slack workspaces — is_valid_instance_name misidentifies workspace IDs

Open
#520 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.4k
Forks
367
PR merge metrics
No merged PRs in 30d

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/messaging/target.rs at is_valid_instance_name(), then review the existing tests for delivery-target parsing. Verify that Enterprise Slack workspace and channel IDs are not treated as named adapter instances, and confirm cron delivery succeeds for targets such as slack:T0APRHSB676:D0APL3DF66S.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.