Skip to content

test(discord): regression coverage for PR #51 thread binding and agent sort - #64

Merged
chr1syy merged 1 commit into
mainfrom
test/pr51-regression-tests
Jul 20, 2026
Merged

test(discord): regression coverage for PR #51 thread binding and agent sort#64
chr1syy merged 1 commit into
mainfrom
test/pr51-regression-tests

Conversation

@chr1syy

@chr1syy chr1syy commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #51 (merged as 77245d2). Codex review flagged two of the four fixes as merged without direct regression tests. This adds them.

Tests only — no source changes.

Fix 2 — parent-channel binding in threads

New src/__tests__/discord-channelsDb.test.ts unit-tests getChannelInfoForInteraction:

  • direct binding resolves without a parent lookup
  • unbound thread falls back to its parent channel binding
  • a thread's own binding wins over the parent's
  • unbound channel / unbound thread+parent / thread with no parentId / interaction with no channel

Plus an integration test in auto-run-command.test.ts covering the /auto-run autocomplete path — this was the genuinely uncovered one. (gist already had an equivalent test.)

Fix 4 — sorted agents list

In agents-command.test.ts:

  • /agents autocomplete orders results by name, not input order
  • sorting happens before the 25-choice Discord cap, so alphabetically-first agents aren't truncated away — the failure mode a naive slice-then-sort would introduce

Verification

Mutation-tested: reverting either fix in the source makes these tests fail (confirmed 5 failures, then restored). Not just passing tests — tests that actually bite.

Suite: 268 passing, up from 258.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Expanded autocomplete coverage to verify alphabetical ordering and correct handling of the 25-choice limit.
    • Added coverage for resolving agents through a thread’s parent channel.
    • Added validation for channel binding resolution across direct channels, threads, parent fallbacks, and missing channel data.

…agent sort

Codex review of #51 flagged two fixes as merged without direct
regression tests. Adds coverage for both (tests only, no source
changes):

- Fix 2 (parent-channel binding): new discord-channelsDb.test.ts unit
  tests for getChannelInfoForInteraction — direct binding, thread
  fallback to parent, thread binding taking precedence, and the
  unbound/no-parentId/no-channel edge cases. Plus an integration test
  covering the auto-run autocomplete path, which had no coverage
  (gist already had one).

- Fix 4 (sorted agents): asserts /agents autocomplete orders by name,
  and that sorting happens before the 25-choice Discord cap so the
  alphabetically-first agents survive truncation.

Verified by mutation: reverting either fix fails these tests.
Suite: 268 passing (was 258).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 85b782b7-b9ba-47bf-819d-5e7eb019058d

📥 Commits

Reviewing files that changed from the base of the PR and between 77245d2 and 02559ee.

📒 Files selected for processing (3)
  • src/__tests__/agents-command.test.ts
  • src/__tests__/auto-run-command.test.ts
  • src/__tests__/discord-channelsDb.test.ts

📝 Walkthrough

Walkthrough

The pull request adds tests for alphabetical agent autocomplete ordering, Discord’s 25-choice limit, thread parent-channel fallback, binding precedence, unresolved channels, and auto-run autocomplete resolution.

Changes

Autocomplete and channel resolution

Layer / File(s) Summary
Agent autocomplete ordering
src/__tests__/agents-command.test.ts
Tests verify agent results are alphabetized and sorted before truncation to 25 choices.
Thread channel binding resolution
src/__tests__/discord-channelsDb.test.ts, src/__tests__/auto-run-command.test.ts
Tests cover direct and parent-channel binding resolution, thread precedence, undefined cases, missing channels, and auto-run file autocomplete from a parent binding.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: Discord regression tests for thread binding and agent autocomplete sorting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 test/pr51-regression-tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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.

@chr1syy
chr1syy merged commit bb6e56a into main Jul 20, 2026
3 checks passed
@chr1syy
chr1syy deleted the test/pr51-regression-tests branch July 20, 2026 19:29
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