Skip to content

fix(events): remove duplicate interaction dispatch after handler restore#115

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

fix(events): remove duplicate interaction dispatch after handler restore#115
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-correctness-bugs-8183

Conversation

@cursor

@cursor cursor Bot commented Jun 9, 2026

Copy link
Copy Markdown

Bug and impact

After c430893 restored per-module Guild event registration, slash commands, dev commands, and UI components were dispatched twice on every interaction:

  1. src/events/Guild/interactionCreate.js / components.js (re-enabled)
  2. src/events/validations/* (always active)

Concrete trigger: User runs /economy → Create, /deposit, /rob, or clicks a setup button. Both handlers call run(), causing duplicate DB writes (economy balance corruption), duplicate account creation/deletion, and InteractionAlreadyReplied errors.

Root cause

The broken folder-scoped events handler (pre-c430893) registered Guild modules on a non-existent "Guild" event, so only the validations chain ran. Fixing registration brought back the legacy Guild dispatch path without removing the validations path.

Fix

  • Delete duplicate interactionCreate.js and components.js Guild handlers
  • Move config.handler.commands.* toggles into the relevant validators
  • Add interaction.replied || interaction.deferred guards to all validators that call run()
  • Add regression tests in tests/interaction-dispatch.test.js

Validation

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

Restoring per-module Guild event registration (c430893) re-enabled
interactionCreate.js and components.js alongside the validations chain.
Both paths executed the same slash commands, dev commands, and UI
components, causing double DB writes (economy corruption) and
InteractionAlreadyReplied errors.

Delete the duplicate Guild handlers, route command-type toggles through
validators, and guard all validation handlers against re-entry when an
interaction was already handled.

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