Skip to content

Comments

fix(evaluator): fix off-by-one in SpellingBeeEvaluator#5

Merged
DASPRiD merged 2 commits intomainfrom
copilot/fix-evaluator-bloop-filtering
Feb 21, 2026
Merged

fix(evaluator): fix off-by-one in SpellingBeeEvaluator#5
DASPRiD merged 2 commits intomainfrom
copilot/fix-evaluator-bloop-filtering

Conversation

Copy link
Contributor

Copilot AI commented Feb 21, 2026

client_ids is stored in reverse order (last letter first). The current bloop is already verified against client_ids[0], so only N-1 prior bloops need to be fetched from global_bloops(). Using take(N) caused the comparison to silently fail whenever extra older bloops existed in history, because the iterator lengths would be unequal and eq() would return false.

The existing tests passed by coincidence — each had exactly N-1 prior bloops, so take(N) never grabbed an extra item.

Changes

  • src/evaluator/spelling_bee.rs
    • take(self.client_ids.len())take(self.client_ids.len() - 1)
    • Adds regression test matches_correct_sequence_with_prior_bloops: correct sequence with an extra older bloop in history that would have triggered the bug
// Before
.take(self.client_ids.len())           // takes N, but skip(1) only has N-1 → fails with any prior history
.map(|bloop| &bloop.client_id);

last_client_ids.eq(self.client_ids.iter().skip(1))

// After
.take(self.client_ids.len() - 1)       // correctly takes only the N-1 remaining letters
.map(|bloop| &bloop.client_id);

last_client_ids.eq(self.client_ids.iter().skip(1))

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: DASPRiD <233300+DASPRiD@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix spelling bee evaluator logic for client IDs Fix off-by-one in SpellingBeeEvaluator: take(len) → take(len - 1) Feb 21, 2026
Copilot AI requested a review from DASPRiD February 21, 2026 11:00
@DASPRiD DASPRiD marked this pull request as ready for review February 21, 2026 11:00
@DASPRiD DASPRiD changed the title Fix off-by-one in SpellingBeeEvaluator: take(len) → take(len - 1) fix(evaluator): fix off-by-one in SpellingBeeEvaluator Feb 21, 2026
@DASPRiD DASPRiD merged commit fd2f10d into main Feb 21, 2026
5 of 7 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 21, 2026
## [1.10.8](v1.10.7...v1.10.8) (2026-02-21)

### Bug Fixes

* **evaluator:** fix off-by-one in SpellingBeeEvaluator ([#5](#5)) ([fd2f10d](fd2f10d))
@github-actions
Copy link

🎉 This PR is included in version 1.10.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants