Skip to content

v0.14.2

Choose a tag to compare

@prxmel4 prxmel4 released this 29 Nov 08:01
· 9 commits to main since this release

wavemelo v0.14.2

Highlights

  • Fixes a live /queue failure where Discord rejected the reply with
    HTTP 400 COMPONENT_CUSTOM_ID_DUPLICATED (error code 50035).
  • 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

  • /queue pagination rendered custom_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>
    

    page is 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_id accepts 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
    /history renders no components. /queue was the only affected surface.

Added

  • QueueAction enum (First, Prev, Next, Last) and
    queue_target_page, both pure and unit-tested.
  • queue_custom_id and parse_queue_custom_id now include the action slot.
  • Regression tests that serialize the rendered action rows with
    serde_json and assert the custom_ids Discord actually receives are
    strictly unique:
    • ui::components::tests::queue_custom_ids_are_unique_for_every_page_state
    • ui::components::tests::queue_custom_ids_encode_their_action_slot
    • ui::components::tests::queue_actions_resolve_into_bounds
    • ui::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_id and are now rejected as malformed. Re-running /queue renders
    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.