Skip to content

Slash commands: remove the second /bb registration so /bb always opens the settings (#1360) - #1373

Merged
Cidan merged 1 commit into
mainfrom
fix-1360-duplicate-bb
Nov 19, 2026
Merged

Cidan merged 1 commit into
mainfrom
fix-1360-duplicate-bb

Conversation

@Cidan

@Cidan Cidan commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Fixes #1360. Also addresses the player report in #1246.

Problem

BetterBags registered /bb twice:

  • config/config.lua: Config:RegisterSettings registers /bb through AceConsole-3.0 as SlashCmdList["ACECONSOLE_BB"]. This handler runs /bb, /bb help, /bb changelog and /bb next.
  • data/items.lua: SLASH_BETTERBAGS_DEBUGITEMS1 = "/bb" and SlashCmdList["BETTERBAGS_DEBUGITEMS"], a debug command left over from Phase 2: Data Farming Engine & Graceful Deactivation #1002. /bb debugitems printed the harvested backpack items, and any other input printed the command's help line.

The client keeps one handler per command. ImportListToHash (Blizzard_ChatFrameBase/Shared/ChatFrameUtil.lua, the same on live, WoW: Forever and the Classic clients) walks SlashCmdList in the table's iteration order and writes hash_SlashCmdList["/BB"] for each entry; a later entry replaces an earlier one. Which handler survived therefore depended on the other addons a player had installed:

  • Where the debug handler won, /bb, /bb help, /bb changelog and /bb next printed "BetterBags Debug Commands: use '/bb debugitems' to dump harvested physical items." and did nothing else (/bb no longer opens up settings #1246).
  • Where AceConsole's handler won, /bb debugitems opened the settings window.

Changes

  • data/items.lua: remove the debug slash command, and remove its globals from the luacheck directive. The command is not moved under the /bb handler: the /bbdb debug window's Dump Backpack Items already records the backpack items, with what the client's APIs answered about each.
  • spec/integration/slash_commands_spec.lua (new, whole addon): /bb, /bbanchor and /bbdb are each claimed by exactly one SlashCmdList entry, the one Config registered. A model of ImportListToHash dispatches /bb, walking the entries first to last and last to first, and /bb opens the settings window in both orders. Before the fix, the uniqueness test and the first-to-last test failed. (spec/config/config_spec.lua stubs RegisterChatCommand, so it could not detect a second entry.)
  • .claude/rules/slash-commands.md (new): Config is the only file that registers chat commands; the client's import behavior, with source line numbers for each branch; the history of the duplicate.
  • config/README.md, docs/handoff.md, docs/render.md: document the single registrar, and point to /bbdb's Dump Backpack Items in place of /bb debugitems.

Testing

  • ~/.local/lua51/bin/busted: 8181 successes, 0 failures (rebased on main at 5e5b7be).
  • luacheck .: 0 warnings, 0 errors.
  • Bug review: no bugs found in the change. Three inaccurate citations in the new rules file (a section reference and Blizzard line numbers) were corrected.
  • Not tested in a game client.

…s the settings (#1360)

BetterBags registered /bb twice. Config:RegisterSettings (config/config.lua)
registers it through AceConsole-3.0 as SlashCmdList["ACECONSOLE_BB"], the
handler for /bb, /bb help, /bb changelog and /bb next. data/items.lua also
set SLASH_BETTERBAGS_DEBUGITEMS1 = "/bb" and SlashCmdList["BETTERBAGS_DEBUGITEMS"],
a leftover debug command from #1002 (/bb debugitems printed the harvested
backpack items; any other input printed its help line).

The client keeps one handler per command: ImportListToHash
(Blizzard_ChatFrameBase/Shared/ChatFrameUtil.lua, the same on live, WoW:
Forever and the Classic clients) walks SlashCmdList in the table's iteration
order and writes hash_SlashCmdList["/BB"] for each entry, the later one
replacing the earlier. Which handler survived therefore depended on the other
addons a player had installed. Where the debug handler won, /bb, /bb help,
/bb changelog and /bb next printed "BetterBags Debug Commands: use '/bb
debugitems' ..." instead of running (#1246). Where AceConsole's won,
/bb debugitems opened the settings.

The debug command is removed rather than moved under the /bb handler: the
/bbdb debug window's Dump Backpack Items already records the backpack items,
with what the client's APIs answered about each.

- data/items.lua: remove the debug slash command and its globals from the
  luacheck directive.
- spec/integration/slash_commands_spec.lua (new, whole addon): /bb, /bbanchor
  and /bbdb are each claimed by exactly one SlashCmdList entry, Config's; /bb
  dispatched through a model of ImportListToHash, walking the entries in both
  orders, opens the settings window. Before the fix the uniqueness test and
  the first-to-last test failed. spec/config/config_spec.lua stubs
  RegisterChatCommand, so it could not see the second entry.
- .claude/rules/slash-commands.md (new): Config is the only registrar of chat
  commands, why (the client's import, with source lines per branch), and the
  history of the duplicate.
- config/README.md, docs/handoff.md, docs/render.md: the single registrar, and
  /bbdb's Dump Backpack Items in place of /bb debugitems.

Fixes #1360.
@Cidan
Cidan merged commit 1ae34b3 into main Nov 19, 2026
4 checks passed
@Cidan
Cidan deleted the fix-1360-duplicate-bb branch November 19, 2026 05:37
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.

BetterBags registers /bb twice in SlashCmdList, so one handler never runs

1 participant