Repository navigation
test(api): stabilize Redis delivery and vector factory isolation - #46624
Merged
Merged
Conversation
Contributor
Pyrefly Type Coverage
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-11-17 15:26:43.442465170 +0000
+++ /tmp/pyrefly_pr.txt 2026-11-17 15:26:15.453295452 +0000
@@ -5026,15 +5026,15 @@
ERROR Object of class `Subscription` has no attribute `_start_if_needed` [missing-attribute]
--> tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py:216:13
ERROR Argument `FakeRedisClient` is not assignable to parameter `client` with type `Redis[Unknown] | RedisCluster[Unknown]` in function `libs.broadcast_channel.redis._subscription.RedisSubscriptionBase.__init__` [bad-argument-type]
- --> tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py:693:20
+ --> tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py:684:20
ERROR Argument `FakeRedisClient` is not assignable to parameter `client` with type `Redis[Unknown] | RedisCluster[Unknown]` in function `libs.broadcast_channel.redis._subscription.RedisSubscriptionBase.__init__` [bad-argument-type]
- --> tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py:713:20
+ --> tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py:704:20
ERROR Argument `TestRedisShardedSubscription.test_get_message_uses_target_node_for_cluster_client.DummyRedisCluster` is not assignable to parameter `client` with type `Redis[Unknown] | RedisCluster[Unknown]` in function `libs.broadcast_channel.redis._subscription.RedisSubscriptionBase.__init__` [bad-argument-type]
- --> tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py:898:20
+ --> tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py:882:20
ERROR Argument `FakeRedisClient` is not assignable to parameter `client` with type `Redis[Unknown] | RedisCluster[Unknown]` in function `libs.broadcast_channel.redis._subscription.RedisSubscriptionBase.__init__` [bad-argument-type]
- --> tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py:1028:20
+ --> tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py:1012:20
ERROR Argument `FakeRedisClient` is not assignable to parameter `client` with type `Redis[Unknown] | RedisCluster[Unknown]` in function `libs.broadcast_channel.redis._subscription.RedisSubscriptionBase.__init__` [bad-argument-type]
- --> tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py:1125:24
+ --> tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py:1109:24
ERROR Class member `FailExpireRedis.expire` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
--> tests/unit_tests/libs/broadcast_channel/redis/test_streams_channel.py:87:9
ERROR Class member `FailXrevrangeRedis.xrevrange` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #46624 +/- ##
=======================================
Coverage 90.26% 90.26%
=======================================
Files 6441 6441
Lines 405890 405890
Branches 81575 81575
=======================================
+ Hits 366377 366380 +3
+ Misses 33112 33111 -1
+ Partials 6401 6399 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
hyoban
marked this pull request as ready for review
November 17, 2026 16:01
lyzno1
approved these changes
Nov 17, 2026
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.
Summary
Two independent test failures removed unrelated PRs from the merge queue. Each fix has its own commit.
Wait for Redis listener delivery
The Redis pub/sub listener tests can fail unrelated merge-queue entries before the background thread has delivered its first message. This happened in run 43374058153 for #46174 and run 43707398723 for #46389, in the sharded and regular variants of
test_listener_thread_normal_operation.Both tests replaced
time.sleepwith a no-op, started the listener, and immediately inspected its private queue. They now assert the payload through the publicreceive(timeout=1)boundary, which waits for actual delivery. The test timeout is unchanged; there are no retries, fixed sleeps, or skips. Redis remains mocked at its network boundary.The precondition is a fresh subscription with a Redis message available; the postcondition is delivery of that message's exact payload through
receive(). Production subscription behavior is unchanged.Validation
Entire
api/tests/unit_tests/libs/broadcast_channel/redis/test_pubsub_channel.py, four concurrent lanes,nice -n 10, no test-name filter:sys.setswitchinterval(0.000001)to exercise thread scheduling: 2/12 failed file runs, one in each affected test.git diff --checkpass.Isolate cached vector factory test doubles
Dataset cleanup failed in run 42757668757 and run 42758935827, both queue entries for unrelated webhook refactoring #45912. The registry returned a fake
ElasticSearchVectorFactorywith noinit_vectormethod.test_vector_factory.pyreplaces backend modules with empty test classes. Its fixture cleared the registry only before a test, so restoringsys.modulesafterward still left the cached fake class available to another file on the same worker. The fixture now clears the cache infinallyafter yielding the module, including when a case fails.The fixture accepts an arbitrary previous cache state, starts each test with a fresh registry, and leaves no cached test factories behind. No production registry behavior changes.
Validation: four concurrent
nice -n 10lanes ran both complete files (test_vector_factory.pyandtest_clean_dataset_task.py), with no test-name filtering. A temporary collection-order hook placed the Elasticsearch fake lookup last in the factory file, before the cleanup file, to exercise the order a shared xdist worker can receive. This produced the exact CI error in 12/12 runs before the fix and 0/12 afterward, 89 tests per run. Ruff and commit hooks pass.Open PR #46368 changes type annotations in the factory suite, but its diff does not clear the cache after tests and does not fix this failure. Its changes were inspected before this fix.
Other scanned failures
The scan covered 61 merge-group runs in the requested 24-hour window (17 failures, 44 successes), plus the older supplied trigger runs. Other failures are tracked separately rather than silently treated as fixed:
EPERM: each entire file passed 20/20 local macOS stress runs; Windows-specific diagnosis is still needed.gh run viewand the REST check suite. It needs GitHub Actions-level investigation; there is no failed test trace to patch.Screenshots
Not applicable: test synchronization only.
Checklist
make lint && make type-check(backend) andvp staged(frontend) to appease the lint godsScoped checks are recorded above; full local backend checks and integration/E2E runs were intentionally left to CI.