Skip to content

fix(events): remove duplicate slash/component execution handlers#129

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-bugs-051f
Draft

fix(events): remove duplicate slash/component execution handlers#129
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-bugs-051f

Conversation

@cursor

@cursor cursor Bot commented Jun 16, 2026

Copy link
Copy Markdown

Bug and impact

Every slash command and component button was executed twice per user interaction. This caused:

  • Double economy writes — e.g. /beg applied two random wallet changes per invocation
  • Duplicate side effects — e.g. ticket-close scheduled two channel deletes and sent two DMs
  • InteractionAlreadyReplied errors — second handler attempted to reply after the first already had

Root cause

The events handler regression fix (PR #71) restored per-module client.on(eventModule.event, …) registration for Guild/interactionCreate.js and Guild/components.js. Those legacy handlers call command.run() / component.run() for the same interactions that the validations/ chain already handles, so both paths fired on every interaction.

Fix

  • Removed src/events/Guild/interactionCreate.js and src/events/Guild/components.js (validators are the sole execution path)
  • Added interaction.replied || interaction.deferred guards to all six validators as a safety belt
  • Added tests/interaction-single-execution.test.js regression coverage

Validation

  • npm test — 39/39 passing
Open in Web View Automation 

Guild/interactionCreate.js and Guild/components.js both called command.run()
for the same interactions as the validations/ chain. After the events handler
regression fix restored per-module registration, every slash command and
button ran twice — causing double economy writes (/beg), duplicate ticket
closes, and InteractionAlreadyReplied errors.

Validators are now the sole execution path, with replied/deferred guards.

Co-authored-by: zVapor_ <contact@zvapor.xyz>
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