test(attention-item): wait for the unique index before asserting on it (main is red) - #1520
Merged
Merged
Conversation
main went red at 77b8857 (#1517) on 'keeps a recipient/source fact unique': Mongoose builds indexes in the background after first use, so the duplicate insert raced the index build and resolved instead of rejecting. The PR's own CI passed the race once; the merge commit lost it. syncIndexes() before the first create makes the assertion depend on the index, not on timing. Tests only. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHfcrzjN6MpeuCCAap5Qnb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
mainis red at77b8857b(#1517's merge commit):Tests / Test & Coveragefails onAttentionItem › keeps a recipient/source fact uniquewith Received promise resolved instead of rejected. #1519's rebase onto that main fails the same way — the failure is main's, not #1519's.What
Mongoose builds indexes in the background after a model's first use, so the duplicate insert raced the unique-index build and resolved. One line:
await AttentionItem.syncIndexes()before the first create, so the assertion depends on the index rather than on timing. Tests only; no model or service change.Proof
Locally green on the file. CI on this PR is the real proof, and
maingoes green when it lands.🤖 Generated with Claude Code
https://claude.ai/code/session_01UHfcrzjN6MpeuCCAap5Qnb