Repository navigation
v0.14.2
wavemelo v0.14.2
Highlights
- Fixes a live
/queuefailure where Discord rejected the reply with
HTTP 400COMPONENT_CUSTOM_ID_DUPLICATED(error code50035). - Every pagination button now carries its action slot in the
custom_id, so
First / Previous / Next / Last can never collide, even when they all point at
the same page. - New regression tests pin the fix across one-page, first-page, middle-page, and
last-page states.
Fixed
-
/queuepagination renderedcustom_ids that encoded only the destination
page:wavemelo:queue:<guild>:<page>On a queue with a single page (including an empty queue) all four buttons
resolved to page 1 and produced the same string. Discord forbids duplicate
custom_ids within one message — disabled buttons included — so the entire
reply was rejected with:{ "code": 50035, "message": "Invalid Form Body", "errors": { "components": { "0": { "components": { "2": { "custom_id": { "_errors": [ { "code": "COMPONENT_CUSTOM_ID_DUPLICATED" } ] } }, "3": { "custom_id": { "_errors": [ { "code": "COMPONENT_CUSTOM_ID_DUPLICATED" } ] } } } } } } } -
The rendered ID now includes the navigation slot:
wavemelo:queue:<guild>:<first|prev|next|last>:<page>pageis the page that was on screen, so a row is unique by construction:
one slot per button, one page per row. Length stays far below Discord's
100-character cap. -
parse_queue_custom_idaccepts the five-field shape and rejects the previous
four-field shape, unknown action slots (skip,pp, ...), trailing fields,
non-canonical numbers, and oversized IDs. -
Navigation resolves the destination from the action slot plus the rendered
page against the freshly collected page count. A queue that shrank between
render and click clamps into range instead of requesting a page that no
longer exists. -
Audited every other component builder: Now Playing controls
(/nowplaying) already embed a distinct operation code per button, and
/historyrenders no components./queuewas the only affected surface.
Added
QueueActionenum (First,Prev,Next,Last) and
queue_target_page, both pure and unit-tested.queue_custom_idandparse_queue_custom_idnow include the action slot.- Regression tests that serialize the rendered action rows with
serde_jsonand assert thecustom_ids Discord actually receives are
strictly unique:ui::components::tests::queue_custom_ids_are_unique_for_every_page_stateui::components::tests::queue_custom_ids_encode_their_action_slotui::components::tests::queue_actions_resolve_into_boundsui::components::tests::queue_ids_round_trip_and_reject_malformed_input
Compatibility
- Old queue messages rendered by v0.14.1 and earlier carry the four-field
custom_idand are now rejected as malformed. Re-running/queuerenders
fresh buttons; no other interaction breaks. - Interaction acknowledgements, guild binding, and permission checks are
unchanged.
Testing and validation
| Gate | Command | Result |
|---|---|---|
| Format | cargo fmt --all -- --check |
passed |
| Clippy | cargo clippy --all-targets --locked -- -D warnings |
passed |
| Tests | cargo test --locked |
125 passed, 0 failed |
| Release build | cargo build --release --locked |
passed |
| Compose | docker compose config --quiet |
passed |
| Thai scan | src/ |
0 matches |
| Production panics | .unwrap()/.expect()/panic!/todo!()/unsafe outside #[cfg(test)] |
0 |
Live failure replay
Destination page per button (First, Previous, Next, Last), guild id omitted:
| Page state | Previous | Now (slot + page) |
|---|---|---|
| 1 page of 1 | 1, 0, 1, 1 |
first:1, prev:1, next:1, last:1 |
| Page 1 of 2 | 1, 0, 2, 2 |
first:1, prev:1, next:1, last:1 |
| Page 2 of 2 | 1, 1, 2, 2 |
first:2, prev:2, next:2, last:2 |
| Page 1 of 3 | 1, 0, 2, 3 |
first:1, prev:1, next:1, last:1 |
| Page 2 of 3 | 1, 1, 3, 3 |
first:2, prev:2, next:2, last:2 |
| Page 3 of 3 | 1, 2, 3, 3 |
first:3, prev:3, next:3, last:3 |
The reported payload (components.2 and components.3 duplicated) matches the
one-page case, where three of the four buttons collapse onto page 1. The
previous encoding also emitted the out-of-range page 0 for Previous on the
first page.
Only the new encoding is accepted by the parser, and only the new encoding is
ever rendered.
Upgrade instructions
Restart the bot. No configuration, Lavalink, or Docker changes are required.
Existing /queue messages keep working after the next /queue invocation.
Known limitations
- Buttons are still disabled rather than removed at the ends of the range, so a
one-page queue shows four disabled buttons. This is intentional: the IDs are
unique and the layout stays stable across page changes. - Queue pagination remains stateless. A page number is re-resolved on every
click against the live queue, so a heavily mutated queue lands on the nearest
valid page rather than the exact position the user saw earlier.