Skip to content

Upgrade Ruff to 0.16.0 and make Workers CI reliable - #2

Merged
adewale merged 2 commits into
mainfrom
agent/upgrade-ruff-0.16
Oct 9, 2026
Merged

adewale merged 2 commits into
mainfrom
agent/upgrade-ruff-0.16

Conversation

@adewale

@adewale adewale commented Jul 26, 2026 •

Copy link
Copy Markdown
Owner

What and why

Adopt Ruff 0.16.0 and fix the integration suite's underlying failures. These also occur without the Ruff changes: unavailable external echo services and Workers/dependency drift broke the existing tests.

Changes

  • Pin Ruff and ruff-pre-commit to 0.16.0, apply its default-rule fixes, and run Ruff in CI.
  • Keep httpbin as the interactive examples' default, but add an ECHO_URL override for the HTTP header demonstrations.
  • Exercise httpx, js.fetch, requests and urllib3 against a real loopback HTTP echo server in CI. Assert that both requests reach the server and validate their actual headers; this is not a mocked response.
  • Check echo HTTP errors explicitly so service failures cannot masquerade as a platform header bug.
  • Remove typing-only webtypy from runtime dependencies, pin workers-py to 1.17.7 and CI's uv to 0.12.3, and explicitly use Python 3.13.
  • Import FastAPI inside the request handler, where the entropy required by current telemetry initialization is available. Existing routes are unchanged.
  • Terminate the entire Worker process group between tests and detect startup process exits.

Validation

  • Linux Docker, Python 3.13, workers-py 1.17.7, Wrangler 4.149.0: uv run pytest -vv -s — 2 passed, 3 skipped, 1 xfailed.
  • uv run ruff check . and staged diff whitespace checks pass.
  • Before the fixes, Worker startup and external HTTP calls failed. Afterward, FastAPI and both synchronous HTTP libraries pass, with all four HTTP clients reaching the local echo server.
  • The xfail still confirms the intentional httpx User-Agent platform bug; the new local-request assertions run before that expected failure.
  • Three existing R2 deployment-only tests remain skipped. No production deployment was performed.

Risk

Moderate: the Worker development toolchain changes. The loopback integration server removes an external uptime dependency without suppressing the intended platform bug reproduction. GitHub's clean Linux CI run is the final merge gate.

@adewale adewale changed the title Upgrade Ruff to 0.16.0 Upgrade Ruff to 0.16.0 and make Workers CI reliable Oct 9, 2026
@adewale
adewale marked this pull request as ready for review October 9, 2026 10:40
@adewale
adewale merged commit 17e2a28 into main Oct 9, 2026
1 check passed
adewale pushed a commit that referenced this pull request Oct 10, 2026
…udit-fixes

Conflicts resolved by asking whether main already does what this PR did:

- Ruff pin (pyproject.toml, uv.lock, .pre-commit-config.yaml): main's
  0.16.0 supersedes this PR's 0.15.2. Took main's.
- ci.yml: main already runs `uv run ruff check .` in its test job. The
  PR's separate `lint` job is dropped; its remaining hooks (ruff format,
  codespell, file hygiene) run as one step in main's test job with
  SKIP=ruff, so each check runs exactly once. Main's uv 0.12.3 pin and
  UV_PYTHON stay; the PR's warm-every-directory install loop stays.
- 2-fastapi-r2-streaming: main fixed the FastAPI >=0.142 startup failure
  by importing the app inside the request handler (src/app.py), so the
  PR's fastapi<0.142 pin there is dropped. The PR's word-pattern /seed
  data moves into src/app.py.
- 4-r2-large-binary-roundtrip: main did not change its module-level
  FastAPI import, so the fastapi<0.142 pin is kept on top of main's
  dependency list (webtypy removed, workers-py pinned).
- 5-sync-http-libraries and test_5: main's ECHO_URL Worker variable and
  header_echo_server fixture supersede the PR's request-controlled
  ?echo= override, its loopback validation, tests/echo_server.py and the
  live httpbin.org call (main removed httpbin from CI on purpose). Took
  main's entry.py, README and test_5; deleted tests/echo_server.py.
- test_3: main's echo-server assertions plus the PR's strict xfail
  marker and PlatformBugReproduced.
- tests/conftest.py: main's ECHO_URL wiring and process-group teardown;
  the PR's output-drain thread and early-exit error for startup.
- LESSONS_LEARNED.md: main's entries 7 and 8 kept; the PR's entries are
  renumbered 9 and 10.
- Lockfiles regenerated with `uv lock` (uv 0.12.3), not hand-merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012eisRQmQvg4TphwztxhQGJ
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