Skip to content

fix(configuration): resolve Discord guild and Slack workspace filters by id - #87

Open
iphuongtt wants to merge 1 commit into
getpaseo:mainfrom
iphuongtt:fix/discord-guild-id-resolution
Open

fix(configuration): resolve Discord guild and Slack workspace filters by id#87
iphuongtt wants to merge 1 commit into
getpaseo:mainfrom
iphuongtt:fix/discord-guild-id-resolution

Conversation

@iphuongtt

@iphuongtt iphuongtt commented Aug 29, 2026

Copy link
Copy Markdown

Problem

filters.guild never matches a real Discord guild id. Activation fails with a message that names the very connection that owns the guild:

.paseo/workflows/discord-help.yml: filters.guild: "100000000000000000" does not match any Discord connection (connected: example-discord "Example")

The organization has a connection for exactly that guild:

      slug      |      guild_id      | guild_name
----------------+--------------------+------------
 example-discord| 100000000000000000 | Example

Cause

resolveResource looks the connection up by slug but returns the resource id, so the lookup key and the resolved value disagree:

const connection = (await database.organizationConnectionUsage(organizationId)).discord.find(
  ({ id, slug }) => slug === resource && allowedConnectionIds.has(id),
);
return connection === undefined
  ? undefined
  : { connectionId: connection.id, resourceId: connection.guildId };

resource is filters.guild (via readAuthoredResource), so a snowflake id is compared to a slug such as "example-discord" and can never match. The Slack branch has the same shape with teamId. The GitHub branch above matches on the resource (repository.fullName) and is unaffected.

This contradicts the public docs, which state:

Discord filters use IDs, not server names, display names, or Hub connection slugs.

and instruct users to obtain the value via Copy Server ID.

Fix

Match on the resource id, while still accepting the connection slug:

({ id, slug, guildId }) =>
  (guildId === resource || slug === resource) && allowedConnectionIds.has(id),

I kept the slug arm deliberately. store.test.ts has a passing test that authors guild: "discord-primary" (a slug) and expects activation to succeed, and existing self-hosted configurations may rely on that. Dropping it would be a breaking change beyond the scope of this bug. Happy to cut it if you would rather take the hard change per AGENTS.md.

Tests

Added accepts a Discord guild id as documented in filters.guild, which asserts the authored guild id activates and compiles to the right connectionId/resourceId.

Verified it is a real regression test: on main it fails at assert.equal(revision.validationErrors, null); with the fix it passes.

The existing rejection test still passes unchanged — its id (1481169421832814616) is not primary.guildId ("100"), so an unknown guild is still correctly rejected.

src/configuration + src/triggers:  208 passed | 1 skipped
npm run typecheck:                 clean
oxlint / oxfmt:                    clean

Verification against a live instance

Same bundle, same database, only the image differs:

Image Result
ghcr.io/getpaseo/hub:latest (0.8.0) Error: ... does not match any Discord connection
locally built with this patch PROJECT default · VALID true · WORKFLOWS 1

🤖 Generated with Claude Code

… by id

`filters.guild` and `filters.workspace` were compared against the
connection slug in `resolveResource`, so a documented snowflake id never
matched and activation failed with "does not match any Discord
connection" even when the organization had a connection for that exact
guild.

The Discord branch already returned `connection.guildId` as the resolved
resource id, and the Slack branch returned `connection.teamId`, so the
lookup key and the resolved value disagreed. The GitHub branch above
matches on the resource (`repository.fullName`) and was unaffected.

Match on the resource id while continuing to accept the connection slug,
which keeps existing slug-based configurations activating.

Documented in public-docs as "Discord filters use IDs, not server names,
display names, or Hub connection slugs".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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