Skip to content

fix(bot): resolve autoplay queue by metadata guild id - #364

Merged
LucasSantana-Dev merged 1 commit into
mainfrom
fix/autoplay-queue-resolution
Mar 25, 2026
Merged

LucasSantana-Dev merged 1 commit into
mainfrom
fix/autoplay-queue-resolution

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented Mar 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • extend queue resolution fallback to match queue instances by guild identity in metadata (metadata.channel.guildId and metadata.channel.guild.id)
  • keep existing resolution order intact while covering non-standard cache key shapes observed in production
  • add regression coverage for metadata-based queue resolution and document the guardrail in the music skill/changelog

Verification

  • npm run test:music:incident
  • jest --config packages/bot/jest.config.cjs packages/bot/src/utils/music/queueResolver.spec.ts --runInBand

Summary by CodeRabbit

  • Bug Fixes
    • Fixed /autoplay queue resolution to work correctly with non-standard cache configurations, enabling autoplay during single-track playback.

@vercel

vercel Bot commented Mar 25, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lucky Ready Ready Preview, Comment Mar 25, 2026 3:29am

Request Review

@coderabbitai

coderabbitai Bot commented Mar 25, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The PR extends the music queue resolver's cache lookup logic to match queues by metadata-based guild IDs (queue.metadata.channel.guildId and queue.metadata.channel.guild.id) as fallback options, alongside the existing direct guild ID matching. Documentation, type definitions, implementation, test coverage, and changelog are updated accordingly.

Changes

Cohort / File(s) Summary
Documentation & Changelog
.cursor/skills/music-queue-player/SKILL.md, CHANGELOG.md
Added documentation and changelog entries specifying the queue resolution fallback behavior and regression test expectations.
Queue Resolver Implementation
packages/bot/src/utils/music/queueResolver.ts
Extended QueueNodeLike type with optional metadata.channel structure containing guildId and guild.id fields; updated cache scan logic to match queues by these metadata-based guild identifiers as fallback options.
Queue Resolver Tests
packages/bot/src/utils/music/queueResolver.spec.ts
Extended mocked QueueLike test type to include optional metadata.channel.guildId shape; added new test case verifying queue resolution via metadata-based guild ID cache scan.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

bot, size/m

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(bot): resolve autoplay queue by metadata guild id' clearly and concisely summarizes the main change: fixing autoplay queue resolution by using metadata guild IDs as a fallback mechanism.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/autoplay-queue-resolution

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot added the size/m label Mar 25, 2026
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/bot/src/utils/music/queueResolver.spec.ts (1)

141-157: Consider adding test coverage for metadata.channel.guild.id path.

This test covers metadata.channel.guildId, but Line 154 in the implementation also matches queue.metadata?.channel?.guild?.id. Adding a test for that branch would ensure full coverage of the new fallback logic.

📝 Suggested additional test
it('falls back to cache scan by metadata.channel.guild.id', () => {
    const queue: QueueLike = {
        id: 'queue-id',
        metadata: {
            channel: {
                guild: { id: 'guild-1' },
            },
        },
    }
    const cacheMap = new Map<string, QueueLike>([['different-key', queue]])
    const client = createClient({ cacheMap })

    const result = resolveGuildQueue(client, 'guild-1')

    expect(result.queue).toBe(queue)
    expect(result.source).toBe('cache.guild')
})
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bot/src/utils/music/queueResolver.spec.ts` around lines 141 - 157,
Add a unit test to cover the fallback branch that reads guild ID from
queue.metadata.channel.guild.id: create a QueueLike with metadata.channel.guild
= { id: 'guild-1' }, put it into a cacheMap under a different key, instantiate
the test client (createClient) with that cacheMap, call
resolveGuildQueue(client, 'guild-1') and assert the returned result.queue is the
created queue and result.source is 'cache.guild' so the
metadata.channel.guild.id path is exercised.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/bot/src/utils/music/queueResolver.spec.ts`:
- Around line 141-157: Add a unit test to cover the fallback branch that reads
guild ID from queue.metadata.channel.guild.id: create a QueueLike with
metadata.channel.guild = { id: 'guild-1' }, put it into a cacheMap under a
different key, instantiate the test client (createClient) with that cacheMap,
call resolveGuildQueue(client, 'guild-1') and assert the returned result.queue
is the created queue and result.source is 'cache.guild' so the
metadata.channel.guild.id path is exercised.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 74b50553-4d3d-4bb1-8635-83308e2d3d3b

📥 Commits

Reviewing files that changed from the base of the PR and between d0573fc and a341f01.

📒 Files selected for processing (4)
  • .cursor/skills/music-queue-player/SKILL.md
  • CHANGELOG.md
  • packages/bot/src/utils/music/queueResolver.spec.ts
  • packages/bot/src/utils/music/queueResolver.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Quality Gates
  • GitHub Check: SonarCloud Scan
🧰 Additional context used
📓 Path-based instructions (17)
**/*.{js,jsx,ts,tsx,vue,html}

📄 CodeRabbit inference engine (.cursor/rules/accessibility-openness.mdc)

Provide accessible UI components using semantic HTML and ARIA attributes where necessary

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • packages/bot/src/utils/music/queueResolver.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/dependency-injection.mdc)

**/*.{ts,tsx,js,jsx}: Prefer constructor injection for classes that require dependencies
Avoid global mutable singletons unless necessary
Use explicit interfaces for external dependencies to make testing easier

**/*.{ts,tsx,js,jsx}: Include required references in PRs/code for non-trivial logic: TypeScript (official docs), MDN (JavaScript reference), and official docs for any runtime/framework/libraries used (e.g., Node.js, React) as applicable.
Before assuming behavior of an API, include the doc link and a ≤25-word quote when the change relies on it.

**/*.{ts,tsx,js,jsx}: Prefer named exports for clear usage and easier refactors in TypeScript/JavaScript
Keep import order consistent: external first, then internal modules
Remove dead code and unused imports

**/*.{ts,tsx,js,jsx}: Use PascalCase naming convention for React/UI components
Use camelCase naming convention for variables and functions
Use UPPER_SNAKE_CASE naming convention for constants
Maintain consistent import grouping and ordering within the project, keeping third-party imports separate from local imports
For external data sources (HTTP, database), always validate and sanitize input using type guards or schema validators

**/*.{ts,tsx,js,jsx}: Use Prettier with no semicolons, single quotes, 4-space indent, 80 character width
Files must not exceed 250 lines and this is enforced

Implement TypeScript typecheck and linter in CI quality checks

**/*.{ts,tsx,js,jsx}: Use TypeScript for enhanced type safety
Implement error handling and error logging
Avoid commenting code unless extremely necessary - code should explain itself with descriptive names
Leave NO todos, placeholders or missing pieces in the code
Variables and functions must use camelCase
Constants must use UPPER_SNAKE_CASE
Use arrow functions for methods and computed properties
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements
Maintain consistent import grouping/order: external imports first, then...

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • packages/bot/src/utils/music/queueResolver.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/error-handling.mdc)

**/*.{js,jsx,ts,tsx}: Never throw strings. Throw Error (or typed subclasses) with descriptive messages
Include causal error as cause when available for better debugging
Define clear, stable error codes (e.g., ERR_AUTH_EXPIRED, ERR_NETWORK_TIMEOUT)
Provide optional metadata (e.g., details, retryable, status, correlationId) in error objects
Use domain error classes per area (e.g., AuthenticationError, ValidationError, NetworkError)
Log errors with structure (message, code, stack, cause, correlationId, user context where appropriate)
Mark retryable vs nonRetryable errors where helpful for operations
Set timeouts and handle aborts/cancellations; avoid dangling requests in API/network code
Implement backoff for transient failures; avoid infinite retries
Map HTTP status → domain errors; 4xx vs 5xx behave differently (e.g., retry for 5xx/network)

**/*.{js,jsx,ts,tsx}: Use functional components with hooks in React/React Native. Avoid class components.
Keep components focused on a single responsibility; extract complex logic into custom hooks.
Keep state local when possible. Use Context/Zustand/Redux only when necessary for state management.
If props or state traverse more than 3 levels, consider using context or a feature-scoped store instead of prop drilling.
Use performance optimization techniques: React.memo, useMemo, useCallback, Suspense (web), and virtualization for long lists; avoid unnecessary re-renders.
Web accessibility: use semantic HTML, labels, focus management, keyboard navigation, and aria-* attributes as needed.
React Native accessibility: use accessibility props (accessible, accessibilityLabel), proper roles and labels.
Identify and extract repetitive UI components proactively to components/ with clear props and minimal coupling.
Web styles: prefer co-located styles or design system tokens; avoid global style leakage.
React Native styles: prefer StyleSheet.create, design tokens, and theme providers; avoid in...

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • packages/bot/src/utils/music/queueResolver.ts
**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/frontend.mdc)

**/*.{test,spec}.{js,jsx,ts,tsx}: Test behavior, not implementation. Prefer Testing Library utilities for testing React/React Native components.
For React Native tests: mock native modules and test component interactions and accessibility labels.

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/pattern.mdc)

Introduce interfaces at module boundaries to enable testing and substitutions

**/*.{ts,tsx}: Avoid using any type in TypeScript. If unavoidable, use unknown with type guards and justify with a code comment
Prefer interface for defining public object shapes in TypeScript, use type for unions and utility types
Use TypeScript utility types such as Partial, Pick, Omit, Readonly, and Record when appropriate
Use I{Name} naming convention for interfaces in TypeScript
Use T{Name} naming convention for type aliases and utility types in TypeScript

**/*.{ts,tsx}: Functions must be less than 50 lines with cyclomatic complexity less than 10
Do not use any types - ESLint enforces this at error level

**/*.{ts,tsx}: Prefer types over interfaces for most cases
Don't ever use any - type safety always
Avoid enums; use const objects instead
For complex types, create a separate file to declare them and import them
Avoid using any type; if unavoidable, use unknown with type guards and justify with code comment
Prefer interface for public API shapes; use type for unions and utility types
Use TypeScript utility types (Partial, Pick, Omit, Readonly, Record)

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • packages/bot/src/utils/music/queueResolver.ts
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/pattern.mdc)

**/*.{test,spec}.{ts,tsx,js,jsx}: Test behavior, not implementation details
Prefer unit tests for core logic; add integration tests at meaningful boundaries

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
**/*.{test,spec}.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/testing-quality.mdc)

**/*.{test,spec}.{js,ts,jsx,tsx}: Use Jest + a React testing library for unit and component tests as applicable
Test behavior, not implementation details

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/documentation.mdc)

**/*.{js,ts,tsx,jsx}: Minimize comments in code; explain the 'why' when non-obvious, let code express the 'what' through clear naming
Document trade-offs briefly when deviating from ideal patterns

**/*.{js,ts,tsx,jsx}: Store secrets, ports, and hosts in environment variables (.env, .env.example) and never hardcode them
Avoid redundant or decorative AI comments; code should be self-explanatory and only commented when logic is non-obvious; prefer refactoring over lengthy comments

Never hardcode secrets, IPs, or ports; use .env and docs/ for required configuration variables

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • packages/bot/src/utils/music/queueResolver.ts
packages/bot/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/lucky-discord-bot.mdc)

packages/bot/**/*.{ts,tsx}: Use useMainPlayer() from discord-player to access the player instance; do not instantiate player directly
Do not duplicate queue or player state outside Discord Player; use shared services from @lucky/shared for persistent data like track history and session information
Use errorLog and debugLog from @lucky/shared/utils for logging throughout the bot package
Use embed and reply utilities from @lucky/shared for consistent message formatting and error sanitization across the bot
Use services from @lucky/shared (DatabaseService, Redis client) for database and cache access; do not instantiate Prisma or Redis directly in the bot package

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • packages/bot/src/utils/music/queueResolver.ts
packages/bot/**

📄 CodeRabbit inference engine (.cursor/rules/lucky-project.mdc)

The bot package depends on shared and contains Discord bot commands and player handlers using Discord.js and Discord Player

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • packages/bot/src/utils/music/queueResolver.ts
**/*.{js,mjs,ts,mts}

📄 CodeRabbit inference engine (.cursor/rules/lucky-project.mdc)

Use Node.js version ≥22 with ESM (ECMAScript modules) only; no CommonJS

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • packages/bot/src/utils/music/queueResolver.ts
**/*.{spec,test}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/quality.mdc)

**/*.{spec,test}.{ts,tsx,js,jsx}: Use Jest for unit and integration tests
Test behavior, not implementation details
Run unit, integration tests, and coverage report in CI quality checks

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/quality.mdc)

Unit tests must use naming convention *.spec.ts

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
packages/bot/src/**/*.ts

📄 CodeRabbit inference engine (.cursor/rules/subagent-discord.mdc)

Use @lucky/shared for database, Redis, logging, and embed utilities instead of implementing them locally

Files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • packages/bot/src/utils/music/queueResolver.ts
{CHANGELOG.md,README.md}

📄 CodeRabbit inference engine (.cursor/rules/agent-rules.mdc)

ALWAYS update CHANGELOG.md and README.md as changes are made.

Files:

  • CHANGELOG.md
CHANGELOG.md

📄 CodeRabbit inference engine (.cursor/rules/templates-examples.mdc)

CHANGELOG.md must be updated with all changes in pull requests

Always update CHANGELOG.md with all code changes

Update CHANGELOG.md with all changes, include breaking changes documentation, and reference issues and PRs

Files:

  • CHANGELOG.md
{CHANGELOG.md,docs/**}

📄 CodeRabbit inference engine (.cursor/rules/lucky-project.mdc)

Update CHANGELOG.md and relevant docs/ files when behavior or setup changes

Files:

  • CHANGELOG.md
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/subagent-discord.mdc:0-0
Timestamp: 2026-03-09T20:21:52.065Z
Learning: Applies to packages/bot/src/functions/music/**/*.ts : Use existing voice/queue/guild validators before manipulating player or queue state
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/subagent-discord.mdc:0-0
Timestamp: 2026-03-09T20:21:52.065Z
Learning: Applies to packages/bot/src/functions/music/commands/**/*.ts : Use `.cursor/skills/music-queue-player/SKILL.md` for play, queue, skip, volume commands and player lifecycle management
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/lucky-discord-bot.mdc:0-0
Timestamp: 2026-03-09T20:20:47.877Z
Learning: Applies to packages/bot/**/*.{ts,tsx} : Do not duplicate queue or player state outside Discord Player; use shared services from `lucky/shared` for persistent data like track history and session information
📚 Learning: 2026-03-09T20:21:52.065Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/subagent-discord.mdc:0-0
Timestamp: 2026-03-09T20:21:52.065Z
Learning: Applies to packages/bot/src/functions/music/**/*.ts : Use existing voice/queue/guild validators before manipulating player or queue state

Applied to files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • .cursor/skills/music-queue-player/SKILL.md
  • packages/bot/src/utils/music/queueResolver.ts
📚 Learning: 2026-03-09T20:21:52.065Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/subagent-discord.mdc:0-0
Timestamp: 2026-03-09T20:21:52.065Z
Learning: Applies to packages/bot/src/functions/music/commands/**/*.ts : Use `.cursor/skills/music-queue-player/SKILL.md` for play, queue, skip, volume commands and player lifecycle management

Applied to files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • .cursor/skills/music-queue-player/SKILL.md
  • packages/bot/src/utils/music/queueResolver.ts
📚 Learning: 2026-03-09T20:20:47.877Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/lucky-discord-bot.mdc:0-0
Timestamp: 2026-03-09T20:20:47.877Z
Learning: Applies to packages/bot/**/*.{ts,tsx} : Do not duplicate queue or player state outside Discord Player; use shared services from `lucky/shared` for persistent data like track history and session information

Applied to files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • .cursor/skills/music-queue-player/SKILL.md
  • packages/bot/src/utils/music/queueResolver.ts
📚 Learning: 2026-03-09T20:21:08.612Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/lucky-project.mdc:0-0
Timestamp: 2026-03-09T20:21:08.612Z
Learning: Applies to {packages/*/tests/**/*.test.{js,ts},tests/**/*.test.{js,ts}} : Add or adjust unit and integration tests when changing behavior; follow existing patterns in `packages/*/tests` and root `tests/` directories

Applied to files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • .cursor/skills/music-queue-player/SKILL.md
📚 Learning: 2026-03-09T20:20:47.877Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/lucky-discord-bot.mdc:0-0
Timestamp: 2026-03-09T20:20:47.877Z
Learning: Applies to packages/bot/src/functions/*/commands/**/*.{ts,tsx} : Use existing validators from `packages/bot/src/utils/command/` for voice channel, queue, and guild validations in commands

Applied to files:

  • packages/bot/src/utils/music/queueResolver.spec.ts
  • .cursor/skills/music-queue-player/SKILL.md
  • packages/bot/src/utils/music/queueResolver.ts
📚 Learning: 2026-03-15T21:57:49.951Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-15T21:57:49.951Z
Learning: When working on music queue/player features (play/queue/skip/volume, player lifecycle), use the `music-queue-player` skill

Applied to files:

  • .cursor/skills/music-queue-player/SKILL.md
📚 Learning: 2026-03-09T20:21:52.065Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/subagent-discord.mdc:0-0
Timestamp: 2026-03-09T20:21:52.065Z
Learning: Applies to packages/bot/src/functions/{general,music,download}/commands/**/*.ts : Apply `.cursor/rules/lucky-discord-bot.mdc` rules for Discord bot commands and player implementation

Applied to files:

  • .cursor/skills/music-queue-player/SKILL.md
  • packages/bot/src/utils/music/queueResolver.ts
📚 Learning: 2026-03-09T20:21:52.065Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/subagent-discord.mdc:0-0
Timestamp: 2026-03-09T20:21:52.065Z
Learning: Applies to packages/bot/src/functions/{general,music,download}/commands/**/*.ts : Use `.cursor/skills/discord-commands/SKILL.md` for implementing slash commands

Applied to files:

  • .cursor/skills/music-queue-player/SKILL.md
📚 Learning: 2026-03-09T20:21:08.612Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/lucky-project.mdc:0-0
Timestamp: 2026-03-09T20:21:08.612Z
Learning: Applies to packages/bot/** : The `bot` package depends on `shared` and contains Discord bot commands and player handlers using Discord.js and Discord Player

Applied to files:

  • .cursor/skills/music-queue-player/SKILL.md
📚 Learning: 2026-03-09T20:20:47.877Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/lucky-discord-bot.mdc:0-0
Timestamp: 2026-03-09T20:20:47.877Z
Learning: Applies to packages/bot/**/*.{ts,tsx} : Use `useMainPlayer()` from `discord-player` to access the player instance; do not instantiate player directly

Applied to files:

  • .cursor/skills/music-queue-player/SKILL.md
📚 Learning: 2026-03-15T21:57:49.951Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-03-15T21:57:49.951Z
Learning: When working on unit tests, Jest ESM mocks, or fixing disabled tests, use the `testing-lucky` skill

Applied to files:

  • .cursor/skills/music-queue-player/SKILL.md
📚 Learning: 2026-03-09T20:21:31.459Z
Learnt from: CR
Repo: LucasSantana-Dev/Lucky PR: 0
File: .cursor/rules/quality.mdc:0-0
Timestamp: 2026-03-09T20:21:31.459Z
Learning: Applies to **/*.{spec,test}.{ts,tsx,js,jsx} : Run unit, integration tests, and coverage report in CI quality checks

Applied to files:

  • .cursor/skills/music-queue-player/SKILL.md
🔇 Additional comments (5)
packages/bot/src/utils/music/queueResolver.ts (2)

29-35: Type extension looks correct.

The optional metadata.channel shape with guildId and nested guild.id properly aligns with the matcher logic below.


149-158: Remove or refactor the metadata.channel fallback checks—they target unreachable data.

The queue creation paths in the codebase never populate metadata.channel:

  • sessionStartupRestore.ts explicitly sets channel: null
  • queueHandler.ts and watchdog.ts don't provide metadata at all

The fallback conditions checking queue.metadata?.channel?.guildId and queue.metadata?.channel?.guild?.id (lines 150–154) will never match in production because metadata.channel is always null or undefined. Either populate metadata.channel during queue creation or remove these defensive checks.

packages/bot/src/utils/music/queueResolver.spec.ts (1)

15-21: Type extension aligns with implementation.

The test type correctly mirrors the QueueNodeLike shape from the implementation.

CHANGELOG.md (1)

10-12: Changelog entry is accurate and well-written.

The entry clearly describes the fix and the scenario it addresses (non-standard cache key shapes).

.cursor/skills/music-queue-player/SKILL.md (1)

44-51: Skill documentation updates are comprehensive.

The guardrail documentation, required test coverage, and fast verification command additions appropriately reflect the implementation changes.

@LucasSantana-Dev
LucasSantana-Dev merged commit d53f4e1 into main Mar 25, 2026
12 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the fix/autoplay-queue-resolution branch March 31, 2026 22:15
LucasSantana-Dev added a commit that referenced this pull request May 13, 2026
Co-authored-by: LucasSantana-Dev <LucasSantana-Dev@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Preview — a341f01b Deployed Mar 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant