← Back to Pull requests

Move runtime and Python tests out of src/workerd/server/tests #8567

Closed
unknown closed this pull request without merging on Nov 18, 2026 03:54 UTC
View on GitHub
unknown unknown commented on Nov 18, 2026 01:27 UTC
Author

src/workerd/server/tests is meant for tests of workerd-only features: the server's own code, config extensions, the inspector, async traces, containers and the like. Some tests of runtime code that downstream builds also ship ended up there too. That makes the path a poor guide to what a test covers.

This moves them next to the code they test, in two commits:

1. Runtime tests to src/workerd/api/tests:
- weakref: WeakRef and FinalizationRegistry across requests. This was a Node driver around a workerd serve process and is now a plain wd-test (weakref-test.wd-test). Each case calls its own target worker through a service binding, so every call is a new request into that target. The target now holds a strong reference to the WeakRef's object until the gc request drops it. V8 may collect a WeakRef's target at any GC once the job that created it ends, and the driver version passed only because no GC ran between its requests.
- socket-close: closing a socket with a pipe close in flight
- wrapped-binding-serialization: RPC serialization of wrapped bindings
- unsafe-eval, unsafe-module: the workerd:unsafe APIs

Nothing under src/workerd/api uses server-harness.mjs. The UDP tests (udp-connect, udp-connect-ts-streams, udp-datagram-drop) stay in src/workerd/server/tests: a worker has no API for sending UDP, so they send datagrams from Node to the server's UDP listener, which makes them tests of the server. The commit also brings the subdirectory list in src/workerd/server/AGENTS.md up to date.
2. The Python Workers tests to src/pyodide/tests, next to the Pyodide runtime they exercise. The vendored-package tests generated embed paths with a ../ count that was a constant tied to the old directory's depth, plus a level argument for subpackages. vendored_py_wd_test now derives the count from the package path, and level is gone. The 7 src/cloudflare/internal/test packages that load py_wd_test.bzl, and the Pyodide AGENTS.md, point at the new path.

Apart from the weakref rewrite, no test changes what it does, and target names are unchanged under the new packages.

Testing

On bazelflare:

  • weakref-test passes in all variants, including @gc-stress.

  • The other moved runtime tests, the three UDP tests and server-harness-test pass.

  • //src/pyodide/... and //src/cloudflare/internal/test/... pass: 302 targets, including every Python variant, the vendored-package tests and the ESLint checks.

  • bazel build --nobuild //... analyzes the whole repo without errors.

  • tools/cross/format.py --check is clean.
  • Edgeworker's docs mention the old Python path in two places (docs/python_workers.md and a comment in src/edgeworker/tests/python/snapshots/BUILD). Nothing there loads from it, so this doesn't break its build.

    🤖 Generated with Claude Code

    Diff: 362 lines (+271 / -91) across 4 files Reviewer: ryanking13 Review duration: 147m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.43) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 362 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.353
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #8567"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.6% (MEDIUM) · Higher = larger blast radius
    42.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.4% · Safe to merge
    18.4%