Repository navigation
test(search): fix flaky legacy desc vector test caused by Meilisearch task batching - #4676
Conversation
TestIntegration_MarkersSurviveLegacyDescriptionVectors failed now and then
with "doc 1 kept the retired desc vectors".
The setup retired the `desc` embedder through EnsureIndex, which queues a
reset of the embedders and the new settings without awaiting the reset in
between. Usually Meilisearch runs them as two batches: the reset moves the
user-provided desc vectors into the document bodies, where the closure
edit function deletes them. When the engine is slow, both tasks land in
one batch and Meilisearch applies only the net change ({skills, desc} to
{skills}). The desc vectors then stay out of the document bodies, so the
function cannot see them, yet retrieveVectors still returns them.
The setup now awaits a standalone reset before EnsureIndex, which always
produces the production state the test is about.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 27 minutes. View limit details
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. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: e7db810f-39bb-43ab-89ce-ff915031d4a1) |
TestIntegration_MarkersSurviveLegacyDescriptionVectorsfailed now and then withdoc 1 kept the retired desc vectors(for example on #4591, which does not touchinternal/search; the rerun passed). It was a race in the test setup, not in the closure code.Cause
The setup retired the
descembedder throughEnsureIndex. That function queues "reset embedders" and then the new settings, without awaiting the reset in between (on purpose, seeensure). Meilisearch may or may not put both tasks into one batch:descvectors into the document bodies, and the closure edit function deletes them. This is the production state the test is about.{skills, desc}to{skills}. Thedescvectors are not moved into the document bodies, so the edit function never sees them, yetretrieveVectorsstill returns them. The assertion fails.Evidence (local Meilisearch v1.49.0, throwaway loop that logs
batchUidfor every task):-count=20, machine under heavy load_vectorsfieldensuremakes)Fix
The test now awaits a standalone
ResetEmbeddersbeforeEnsureIndex. Thedescvectors always end up in the document bodies, howeverEnsureIndex's own tasks are batched. Product code is unchanged. In the one-batch case the closure edit still succeeded and set every marker. The only leftover is unuseddescvectors in the vector store.Checks
go test -tags=integration -run TestIntegration_MarkersSurviveLegacyDescriptionVectors -count=20 ./internal/search/search/: 40/40 passed, run twice (once with Meilisearch at 0.2 CPU)gofmt -l,go vet ./...,go vet -tags=integration ./...,go test ./internal/search/...: cleanCreated with Claude Opus 5.5 in Claude Code.
Note
Low Risk
Test-only change to integration setup; no production behavior modified.
Overview
Stabilizes
TestIntegration_MarkersSurviveLegacyDescriptionVectorsby awaiting a standaloneResetEmbeddersafter seeding legacydescchunk vectors and beforeEnsureIndex.That ordering removes a flaky setup race: when Meilisearch batches the reset with
EnsureIndex's settings update,descvectors may never land in document bodies, so the closure edit function cannot strip them and the test intermittently fails with “kept the retired desc vectors.” Production search code is unchanged—only test setup and comments are updated.Reviewed by Cursor Bugbot for commit 1dbb26f. Bugbot is set up for automated code reviews on this repo. Configure here.