Skip to content

test(attention-item): wait for the unique index before asserting on it (main is red) - #1520

Merged
lilyshen0722 merged 2 commits into
mainfrom
fix/attention-item-unique-index-test
Sep 3, 2026
Merged

lilyshen0722 merged 2 commits into
mainfrom
fix/attention-item-unique-index-test

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Why

main is red at 77b8857b (#1517's merge commit): Tests / Test & Coverage fails on AttentionItem › keeps a recipient/source fact unique with 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 main goes green when it lands.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UHfcrzjN6MpeuCCAap5Qnb

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
@lilyshen0722
lilyshen0722 merged commit e0e33f0 into main Sep 3, 2026
14 checks passed
@lilyshen0722
lilyshen0722 deleted the fix/attention-item-unique-index-test branch September 3, 2026 17:36
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