Skip to content

test(ci): fix flaky matrix failures from image pulls, OTel timing and row order - #884

Open
vishal-bala wants to merge 2 commits into
mainfrom
fix/ci-matrix-flakes
Open

vishal-bala wants to merge 2 commits into
mainfrom
fix/ci-matrix-flakes

Conversation

@vishal-bala

Copy link
Copy Markdown
Collaborator

Motivation

Matrix test jobs often fail and then pass on rerun. Over the last month, 18 jobs failed this way. This PR fixes the 11 failures whose cause is in the test code or CI configuration. The other seven were runner problems or HuggingFace model loading, and none has happened since the model caches were reworked on 25 November.

Changes

Pull the Redis image once per job

Every pytest-xdist worker ran its own docker compose pull from the redis_container fixture. All workers pulled at the same moment, so when one worker's pull failed, every test that worker ran afterwards errored: 1,600 to 2,000 errors per job. CI now runs .github/actions/run-service-tests/pull_redis_image.sh first. It pulls through tests/docker-compose.yml and retries twice. CI then sets REDISVL_TEST_SKIP_PULL=1 so that the fixture skips its own pull. Local runs pull as before. The script lives beside the action because the fork-PR workflow runs that action from a trusted checkout that contains only .github/actions.

Measure OpenTelemetry overhead relative to a no-op baseline

The OTel test asserted that an instrumented call takes under 25 µs; on busy runners it measured 25–73 µs. It now times the same calls on OpenTelemetry's NoOpTracer and NoOpMeter, in alternating batches, and asserts that RedisVL's cost is under 3× that baseline.

Ignore row order only where Redis does not define it

test_aggregate_direct and its async twin run FT.AGGREGATE with no SORTBY and compared rows by position. Those two tests now pass ordered=False to assert_results_equal. The hybrid and multi-vector tests keep the ordered comparison, because their queries sort their rows.

Allow a zero indexing time in the migration tests

A four-document index can finish building before the first status check. Its build time then rounds to 0.0 s, and the indexing rate is reported as None. The migration tests now expect a rate only when the recorded duration is above zero. A new unit test pins _build_benchmark_summary on both executors.

Minor changes

  • tests/unit/test_voyageai_reranker_rank_by.py is reformatted, because it was unformatted on main and failed the pre-commit hook.

AI Assistance

  • No AI assistance was used for this PR.
  • This PR is AI-assisted. I have reviewed and understood everything in it, and I take responsibility for it.

Claude Code (claude-opus-5-5): failure investigation, implementation, tests, pre-PR review and this description.

Reviewer Brief

Start here: .github/actions/run-service-tests/pull_redis_image.sh and the pull= argument in tests/conftest.py. Together they decide whether the workers still race to pull the image.

Where it could fail

Not verified: the fork-PR workflow, which runs only on manual dispatch; the OTel ratio on GitHub-hosted runners; the registry error behind the failed pulls, which testcontainers never prints.

Beyond CI: on an Apple M4 Pro, the OTel ratio measured 1.29–1.33×, both idle and with 24 CPU-bound processes running.

Reviewed 5ce1a786, fixes in b33169f5 · Claude Code (claude-opus-5-5) · lenses: correctness, security, design, tests, docs, Redis behaviour

Reruns of test.yml since late October came down to these, among others
outside the code (runner losses, model-cache misses since fixed):

- test_otel's cost check compared an absolute 25 us bound against loaded
  runners and failed at 25-73 us. It now compares against the same calls on
  the OTel API's no-op tracer and meter, in alternating batches, so load
  slows both alike: 1.3x idle and with every core busy, bound 3x.
- Every xdist worker's redis_container fixture ran its own
  `docker compose pull`; when one failed, every test on that worker errored
  (1,600-2,000 per failure). CI now pulls the image once per job with
  retries and sets REDISVL_TEST_SKIP_PULL so the fixture doesn't pull.
  Local runs still pull.
- test_resp3_aggregation compared RESP2 and RESP3 rows by position, but an
  unsorted FT.AGGREGATE has no row order. Rows are now compared as a sorted
  multiset.
- The migration tests required documents_indexed_per_second, which is None
  when a small index is ready at the first poll and the millisecond timer
  reads 0. They now require a rate exactly when the duration is non-zero.

Also formats test_voyageai_reranker_rank_by.py, unformatted on main, which
the pre-commit hook otherwise rewrites.
…action

Review fixes:

- assert_results_equal compares rows in order again by default. Only the two
  unsorted test_aggregate_direct tests pass ordered=False; the hybrid and
  multi-vector queries add SORTBY, so their row order is part of RESP2/RESP3
  parity.
- The pull script moves beside the run-service-tests action and is called
  through $GITHUB_ACTION_PATH. The fork-PR workflow runs that action from a
  trusted checkout of .github/actions over the fork's own checkout, which
  may predate the script.
- The script pulls through tests/docker-compose.yml, so it always pulls the
  image the fixture starts instead of keeping its own default.
- A unit test pins _build_benchmark_summary's rate on both executors: a
  0.5 s build of 2 docs gives 4.0, a 0.0 or missing duration gives None.
  The integration assertion relaxed in the previous commit can no longer
  catch a broken rate on its own.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.92%. Comparing base (449dfc9) to head (b33169f).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #884   +/-   ##
=======================================
  Coverage   80.92%   80.92%           
=======================================
  Files         121      121           
  Lines       15000    15000           
  Branches     2632     2632           
=======================================
+ Hits        12138    12139    +1     
  Misses       2212     2212           
+ Partials      650      649    -1     
Flag Coverage Δ
core 79.42% <ø> (+<0.01%) ⬆️
service 80.05% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vishal-bala vishal-bala added the auto:tests Add or improve existing tests label Dec 3, 2026
@vishal-bala
vishal-bala marked this pull request as ready for review December 4, 2026 09:30
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-04T09:32:03.601241Z b33169f Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

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

Labels

auto:tests Add or improve existing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants