Skip to content

[suspicious] Add shared-clock-mock - #29074

Merged
charliermarsh merged 4 commits into
mainfrom
charlie/shared-clock-mock
Oct 26, 2026
Merged

charliermarsh merged 4 commits into
mainfrom
charlie/shared-clock-mock

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR adds a shared-clock-mock rule in preview. Patching a clock or sleep function on a shared module can affect unrelated threads or tasks, including when the target is qualified with the consuming module:

from unittest.mock import Mock, patch

from example import worker

sleep = Mock()
with patch.object(worker.time, "sleep", sleep):
    worker.retry()

Instead, you should replace the consuming module's binding to keep the fake local:

from types import SimpleNamespace
from unittest.mock import Mock, patch

from example import worker

sleep = Mock()
with patch.object(worker, "time", SimpleNamespace(sleep=sleep)):
    worker.retry()

We also flag patches of wall-clock, monotonic, and performance-counter readings, plus asyncio.sleep. The rule recognizes patch, patch.object, pytest-mock fixtures, and monkeypatch.setattr / delattr. (Nested .time and .asyncio targets use a naming heuristic, so a fixture that already installed a private clock can produce a false positive.)

Case analysis

The ecosystem run adds 601 diagnostics across eight projects.

Counting sleep calls in LangChain

This reduced version of LangChain’s device-login test records the polling interval before and after the server asks the client to slow down.

sleeps = []
monkeypatch.setattr(oauth_module.time, "sleep", sleeps.append)
login_chatgpt_device(store_path=tmp_path / "x.json", poll_interval=2.0)
assert sleeps[:2] == [2.0, 7.0]

The OAuth module does import time, so oauth_module.time and time are the same object. If another thread calls time.sleep(1) between the two polls, the recorder sees [2.0, 1, 7.0]. Installing SimpleNamespace(sleep=sleeps.append) on oauth_module.time keeps that call out of the list.

Running out of clock readings in Superset

Superset tests how long a screenshot request waits for a lock. It patches superset.dashboards.api.time.monotonic with side_effect=[10.0, 10.5, 11.0] and patches time.sleep on the same module. An unrelated time.monotonic() can consume the next reading. The request can then see the deadline early or exhaust the iterator and raise StopIteration. A private clock for superset.dashboards.api needs both monotonic and sleep.

Retrying an async request in Prefect

Prefect simulates three failed SQS requests and expects one two-second backoff. The test uses @patch("prefect_aws.observers.ecs.asyncio.sleep"), but the observer does import asyncio. A second task awaiting asyncio.sleep(0) would also call the mock and break assert_called_once_with(2).

A fixture that already installed a private clock

Ruff can see the same patch in two tests even though only one reaches the shared module. For example, an autouse fixture can replace worker.time before the test starts.

@pytest.fixture(autouse=True)
def private_clock(monkeypatch):
    monkeypatch.setattr(worker, "time", SimpleNamespace(sleep=lambda _: None))


def test_retry(monkeypatch):
    sleep = Mock()
    monkeypatch.setattr(worker.time, "sleep", sleep)  # shared-clock-mock
    worker.retry()

The warning in test_retry is a false positive. At runtime the receiver is the fixture’s SimpleNamespace. If the fixture returns that namespace, the test can use monkeypatch.setattr(private_clock, "sleep", sleep) and Ruff accepts it.

A package with its own time module

Gevent ships a gevent.time module with its own sleep binding. The dotted string is enough for Ruff to flag this reduced example.

import time
from unittest.mock import patch

original_sleep = time.sleep
with patch("gevent.time.sleep"):
    assert time.sleep is original_sleep

The assertion passes. Callers that look up gevent.time.sleep see the patch. A caller of standard-library time.sleep still gets the original function. Ruff infers the owner from the .time.sleep suffix in a string target, so it reports the wrong module here.

@astral-sh-bot

astral-sh-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

βœ… ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+529 -0 violations, +0 -0 fixes in 8 projects; 50 projects unchanged)

apache/airflow (+310 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview --select ALL

+ airflow-core/tests/unit/api_fastapi/auth/test_tokens.py:90:20: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_db_command.py:820:20: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_db_command.py:825:20: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_db_command.py:836:20: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_gunicorn_monitor.py:160:37: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_gunicorn_monitor.py:293:33: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:1234:8: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:1376:19: shared-clock-mock Mocking `asyncio.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:1377:19: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:1404:19: shared-clock-mock Mocking `asyncio.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:1405:19: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:1877:19: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:1878:19: shared-clock-mock Mocking `time.time` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:2711:30: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:2712:18: shared-clock-mock Mocking `time.time` may affect unrelated threads or tasks
+ airflow-core/tests/unit/models/test_dag.py:2050:29: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/models/test_revoked_token.py:75:23: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/models/test_revoked_token.py:95:23: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/security/test_kerberos.py:123:17: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/security/test_kerberos.py:246:17: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/security/test_kerberos.py:307:17: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/triggers/test_shared_stream.py:1159:25: shared-clock-mock Mocking `asyncio.sleep` may affect unrelated threads or tasks
+ airflow-ctl-tests/tests/airflowctl_tests/test_dag_run_wait.py:53:25: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ airflow-ctl-tests/tests/airflowctl_tests/test_dag_run_wait.py:70:25: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ airflow-ctl-tests/tests/airflowctl_tests/test_dag_run_wait.py:71:25: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ dev/breeze/tests/test_docker_command_utils.py:920:13: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ dev/breeze/tests/test_docker_command_utils.py:932:13: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ dev/breeze/tests/test_docker_command_utils.py:944:13: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ dev/breeze/tests/test_gh_workflow_utils.py:102:13: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
... 281 additional changes omitted for project

apache/superset (+90 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview --select ALL

+ superset-extensions-cli/tests/test_cli_build.py:266:13: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ superset-extensions-cli/tests/test_cli_dev.py:124:20: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:5714:17: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:5717:19: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:5777:17: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:5780:19: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:5840:19: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:5841:19: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:5890:19: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:5891:19: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
... 80 additional changes omitted for project

langchain-ai/langchain (+5 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview

+ libs/partners/openai/tests/unit_tests/test_chatgpt_oauth.py:725:25: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ libs/partners/openai/tests/unit_tests/test_chatgpt_oauth.py:752:25: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ libs/partners/openai/tests/unit_tests/test_chatgpt_oauth.py:774:25: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ libs/partners/openai/tests/unit_tests/test_chatgpt_oauth.py:777:25: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks
+ libs/partners/openai/tests/unit_tests/test_chatgpt_oauth.py:936:25: shared-clock-mock Mocking `time.monotonic` may affect unrelated threads or tasks

prefecthq/prefect (+66 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview

+ src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:396:12: shared-clock-mock Mocking `asyncio.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:433:12: shared-clock-mock Mocking `asyncio.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:481:12: shared-clock-mock Mocking `asyncio.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:515:12: shared-clock-mock Mocking `asyncio.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:555:12: shared-clock-mock Mocking `asyncio.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:863:19: shared-clock-mock Mocking `asyncio.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-azure/tests/test_aci_worker.py:1402:13: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-azure/tests/test_aci_worker.py:1418:25: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-azure/tests/test_aci_worker.py:1431:13: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-azure/tests/test_aci_worker.py:1448:13: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
... 56 additional changes omitted for project

pypa/cibuildwheel (+4 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview

+ unit_test/download_test.py:144:25: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ unit_test/download_test.py:168:25: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ unit_test/download_test.py:96:29: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ unit_test/extra_test.py:34:25: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks

python-poetry/poetry (+6 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview

+ tests/utils/test_authenticator.py:237:26: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ tests/utils/test_authenticator.py:262:26: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ tests/utils/test_authenticator.py:282:26: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ tests/utils/test_authenticator.py:326:26: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ tests/utils/test_cache.py:108:18: shared-clock-mock Mocking `time.time` may affect unrelated threads or tasks
+ tests/utils/test_cache.py:115:18: shared-clock-mock Mocking `time.time` may affect unrelated threads or tasks

reflex-dev/reflex (+8 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview

+ tests/units/assets/test_assets.py:652:25: shared-clock-mock Mocking `time.time` may affect unrelated threads or tasks
+ tests/units/reflex_bench/drivers/test_editor.py:120:25: shared-clock-mock Mocking `time.time_ns` may affect unrelated threads or tasks
+ tests/units/reflex_cli/utils/test_hosting.py:1361:18: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ tests/units/reflex_cli/utils/test_hosting.py:1440:18: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks
+ tests/units/reflex_workflow/engine/test_runner.py:4345:25: shared-clock-mock Mocking `asyncio.sleep` may affect unrelated threads or tasks
+ tests/units/reflex_workflow/engine/test_runner.py:4404:25: shared-clock-mock Mocking `asyncio.sleep` may affect unrelated threads or tasks
+ tests/units/reflex_workflow/engine/test_runner.py:4440:25: shared-clock-mock Mocking `asyncio.sleep` may affect unrelated threads or tasks
+ tests/units/test_app.py:5379:26: shared-clock-mock Mocking `time.sleep` may affect unrelated threads or tasks

... Truncated remaining completed project reports due to GitHub comment length restrictions

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
shared-clock-mock 529 529 0 0 0

@charliermarsh charliermarsh reopened this Oct 26, 2026
@charliermarsh charliermarsh added preview Related to preview-mode features rule Implementing or modifying a lint rule labels Oct 26, 2026 — with ChatGPT Codex Connector
@charliermarsh
charliermarsh marked this pull request as ready for review October 26, 2026 16:36
@astral-automations-bot

astral-automations-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

βœ… ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+601 -0 violations, +0 -0 fixes in 8 projects; 50 projects unchanged)

apache/airflow (+352 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview --select ALL

+ airflow-core/tests/unit/api_fastapi/auth/test_tokens.py:90:20: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_dag_processor_token_command.py:104:9: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_dag_processor_token_command.py:143:9: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_dag_processor_token_command.py:160:24: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_db_command.py:820:20: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_db_command.py:825:20: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_db_command.py:836:20: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_gunicorn_monitor.py:160:37: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/cli/commands/test_gunicorn_monitor.py:293:33: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:1408:8: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:1550:19: shared-clock-mock Changing `asyncio.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:1551:19: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:1578:19: shared-clock-mock Changing `asyncio.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:1579:19: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:2092:19: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:2093:19: shared-clock-mock Changing `time.time` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:2959:30: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/jobs/test_triggerer_job.py:2960:18: shared-clock-mock Changing `time.time` may affect unrelated threads or tasks
+ airflow-core/tests/unit/models/test_dag.py:2135:29: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/models/test_revoked_token.py:75:23: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/models/test_revoked_token.py:95:23: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ airflow-core/tests/unit/security/test_kerberos.py:123:17: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/security/test_kerberos.py:246:17: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/security/test_kerberos.py:307:17: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ airflow-core/tests/unit/triggers/test_shared_stream.py:1159:25: shared-clock-mock Changing `asyncio.sleep` may affect unrelated threads or tasks
+ airflow-ctl-tests/tests/airflowctl_tests/test_dag_run_wait.py:53:25: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ airflow-ctl-tests/tests/airflowctl_tests/test_dag_run_wait.py:70:25: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ airflow-ctl-tests/tests/airflowctl_tests/test_dag_run_wait.py:71:25: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ dev/breeze/tests/test_docker_command_utils.py:1080:13: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
... 323 additional changes omitted for project

apache/superset (+101 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview --select ALL

+ superset-extensions-cli/tests/test_cli_build.py:266:13: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ superset-extensions-cli/tests/test_cli_dev.py:124:20: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:6954:17: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:6957:19: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:7017:17: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:7020:19: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:7080:19: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:7081:19: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:7130:19: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ tests/integration_tests/dashboards/api_tests.py:7131:19: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
... 91 additional changes omitted for project

langchain-ai/langchain (+5 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview

+ libs/partners/openai/tests/unit_tests/test_chatgpt_oauth.py:725:25: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ libs/partners/openai/tests/unit_tests/test_chatgpt_oauth.py:752:25: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ libs/partners/openai/tests/unit_tests/test_chatgpt_oauth.py:774:25: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ libs/partners/openai/tests/unit_tests/test_chatgpt_oauth.py:777:25: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ libs/partners/openai/tests/unit_tests/test_chatgpt_oauth.py:936:25: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks

prefecthq/prefect (+70 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview

+ scripts/tests/test_update_uv_lock_integrations.py:30:19: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ scripts/tests/test_update_uv_lock_integrations.py:41:19: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:396:12: shared-clock-mock Changing `asyncio.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:433:12: shared-clock-mock Changing `asyncio.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:481:12: shared-clock-mock Changing `asyncio.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:515:12: shared-clock-mock Changing `asyncio.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:555:12: shared-clock-mock Changing `asyncio.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-aws/tests/observers/test_ecs_observer.py:863:19: shared-clock-mock Changing `asyncio.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-azure/tests/test_aci_worker.py:1402:13: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ src/integrations/prefect-azure/tests/test_aci_worker.py:1418:25: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
... 60 additional changes omitted for project

pypa/cibuildwheel (+4 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview

+ unit_test/download_test.py:144:25: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ unit_test/download_test.py:168:25: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ unit_test/download_test.py:96:29: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ unit_test/extra_test.py:34:25: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks

python-poetry/poetry (+6 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview

+ tests/utils/test_authenticator.py:237:26: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/utils/test_authenticator.py:262:26: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/utils/test_authenticator.py:282:26: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/utils/test_authenticator.py:326:26: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/utils/test_cache.py:108:18: shared-clock-mock Changing `time.time` may affect unrelated threads or tasks
+ tests/utils/test_cache.py:115:18: shared-clock-mock Changing `time.time` may affect unrelated threads or tasks

reflex-dev/reflex (+22 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --no-fix --output-format concise --preview

+ tests/units/assets/test_assets.py:652:25: shared-clock-mock Changing `time.time` may affect unrelated threads or tasks
+ tests/units/reflex_base/utils/test_log.py:1060:9: shared-clock-mock Changing `time.monotonic` may affect unrelated threads or tasks
+ tests/units/reflex_bench/drivers/test_editor.py:120:25: shared-clock-mock Changing `time.time_ns` may affect unrelated threads or tasks
+ tests/units/reflex_cli/utils/test_deploy.py:153:26: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/units/reflex_cli/utils/test_deploy.py:169:26: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/units/reflex_cli/utils/test_deploy.py:214:26: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/units/reflex_cli/utils/test_deploy.py:272:26: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/units/reflex_cli/utils/test_deploy.py:297:26: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/units/reflex_cli/utils/test_deploy.py:312:26: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
+ tests/units/reflex_cli/utils/test_deploy.py:326:26: shared-clock-mock Changing `time.sleep` may affect unrelated threads or tasks
... 12 additional changes omitted for project

... Truncated remaining completed project reports due to GitHub comment length restrictions

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
shared-clock-mock 601 601 0 0 0


Results for 3d2e962 Β· Workflow run

@charliermarsh
charliermarsh merged commit 9525a0c into main Oct 26, 2026
90 of 91 checks passed
@charliermarsh
charliermarsh deleted the charlie/shared-clock-mock branch October 26, 2026 18:15
rlichtenwalter added a commit to rlichtenwalter/dir2text that referenced this pull request Oct 30, 2026
This PR contains the following updates:

| Package | Type | Update | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|---|---|
| [DavidAnson/markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) | repository | minor | `v0.23.3` β†’ `v0.24.0` | ![age](https://developer.mend.io/api/mc/badges/age/github-tags/DavidAnson%2fmarkdownlint-cli2/v0.24.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/github-tags/DavidAnson%2fmarkdownlint-cli2/v0.23.3/v0.24.0?slim=true) |
| [ruff](https://docs.astral.sh/ruff) ([source](https://github.com/astral-sh/ruff), [changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)) | dependency-groups | patch | `==0.17.1` β†’ `==0.17.3` | ![age](https://developer.mend.io/api/mc/badges/age/pypi/ruff/0.17.3?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/ruff/0.17.1/0.17.3?slim=true) |

Note: The `pre-commit` manager in Renovate is not supported by the `pre-commit` maintainers or community. Please do not report any problems there, instead [create a Discussion in the Renovate repository](https://github.com/renovatebot/renovate/discussions/new) if you have any questions.

---

### Release Notes

<details>
<summary>DavidAnson/markdownlint-cli2</summary>

### [`v0.24.0`](DavidAnson/markdownlint-cli2@v0.23.3...v0.24.0)

[Compare Source](DavidAnson/markdownlint-cli2@v0.23.3...v0.24.0)

</details>

<details>
<summary>astral-sh/ruff (ruff)</summary>

### [`v0.17.3`](https://github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#0173)

[Compare Source](astral-sh/ruff@0.17.2...0.17.3)

Released on 2026-10-26.

##### Preview features

- \[`suspicious`] Add `shared-clock-mock` ([#&#8203;29074](astral-sh/ruff#29074))

##### Bug fixes

- \[`pyupgrade`] Avoid incorrect conversions to f-strings (`UP032`) ([#&#8203;25485](astral-sh/ruff#25485))

##### Performance

- Buffer stdout in `ruff format` ([#&#8203;29631](astral-sh/ruff#29631))
- Specialize ASCII identifier lexing ([#&#8203;29503](astral-sh/ruff#29503))
- Speed up identifier and keyword lexing ([#&#8203;29463](astral-sh/ruff#29463))

##### Documentation

- \[`flake8-bandit`] Describe what the rule actually checks for `httpx` (`S113`) ([#&#8203;27936](astral-sh/ruff#27936))

##### Contributors

- [@&#8203;itsvedantkumar](https://github.com/itsvedantkumar)
- [@&#8203;charliermarsh](https://github.com/charliermarsh)
- [@&#8203;anishgirianish](https://github.com/anishgirianish)

### [`v0.17.2`](https://github.com/astral-sh/ruff/blob/HEAD/CHANGELOG.md#0172)

[Compare Source](astral-sh/ruff@0.17.1...0.17.2)

Released on 2026-10-22.

##### Preview features

- \[`complexity`] Add `unnecessary-regular-expression-compile` ([#&#8203;25533](astral-sh/ruff#25533))

##### Bug fixes

- Avoid syntax errors for type variables with starred constraints (`UP040`, `UP046`, `UP047`, `RUF053`) ([#&#8203;28362](astral-sh/ruff#28362))
- \[`pydocstyle`] Treat backslash-escaped `*args` and `**kwargs` as documented (`D417`) ([#&#8203;29536](astral-sh/ruff#29536))
- \[`pylint`] Avoid false positive on starred elements (`PLE0643`) ([#&#8203;29483](astral-sh/ruff#29483))
- \[`pylint`] Mark fixes unsafe when deleting comments (`PLR5501`, `PLW0120`) ([#&#8203;29414](astral-sh/ruff#29414))
- \[`pyupgrade`] Mark fix unsafe when deleting comments (`UP035`) ([#&#8203;29413](astral-sh/ruff#29413))

##### Performance

- Avoid intermediate names in lint name resolution ([#&#8203;29506](astral-sh/ruff#29506))
- Prefilter bidirectional Unicode checks by UTF-8 leading bytes ([#&#8203;29561](astral-sh/ruff#29561))
- Share postfix parsing and reduce expression copies ([#&#8203;29480](astral-sh/ruff#29480))

##### Configuration

- \[`pylint`] Add a configurable allowlist for `magic-value-comparison` (`PLR2004`) ([#&#8203;18961](astral-sh/ruff#18961))

##### Documentation

- Clarify documentation and correct stale guidance ([#&#8203;29374](astral-sh/ruff#29374))
- \[`pyupgrade`] Remove mentions of variance related to fix safety (`UP040`, `UP047`) ([#&#8203;29592](astral-sh/ruff#29592))

##### Contributors

- [@&#8203;fixfon](https://github.com/fixfon)
- [@&#8203;MichaReiser](https://github.com/MichaReiser)
- [@&#8203;zaniebot](https://github.com/zaniebot)
- [@&#8203;FrancescoPezzella](https://github.com/FrancescoPezzella)
- [@&#8203;anishgirianish](https://github.com/anishgirianish)
- [@&#8203;rajveer3x](https://github.com/rajveer3x)
- [@&#8203;charliermarsh](https://github.com/charliermarsh)
- [@&#8203;LckyLike](https://github.com/LckyLke)
- [@&#8203;DaniBodor](https://github.com/DaniBodor)

</details>

---

### Configuration

πŸ“… **Schedule**: (in timezone America/Denver)

- Branch creation
  - Between 02:00 AM and 06:59 AM, only on Tuesday (`* 2-6 * * 2`)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

β™» **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

πŸ‘» **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNDguMyIsInVwZGF0ZWRJblZlciI6IjQ0LjE0OC4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZSJdfQ==-->

Reviewed-on: https://git.lichtenwalter.site/rlichten/dir2text/pulls/100

This branch was previously deployed

1 inactive deployment
automations β€” 3d2e9625 Deployed Oct 26, 2026 by charliermarsh via security-review / security review #95799
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Related to preview-mode features rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants