Skip to content

Harden pacquet test harness: bound per-test pnpr requests so an upstream stall fails fast instead of hanging CI #32

Closed

Description

@zkochan

Problem

A single pacquet integration test wedged the entire Rust CI / Test / ubuntu job for ~80 minutes before it had to be cancelled manually.

In run 27722164239 (PR pnpm/pnpm#12375), pacquet-cli::dedupe_direct_deps::dedupes_direct_deps_against_workspace_root hung indefinitely — the nextest SLOW counter climbed past 4800s until the job was cancelled. Every other test passed (3197 PASS, 0 FAIL); macOS and Windows were green.

The orphan-process cleanup shows what was stuck:

Terminate orphan process: pid (7770) (dedupe_direct_deps-…)   ← the test binary
Terminate orphan process: pid (7787) (pacquet)                ← the spawned CLI it was blocked on

The test spawns the real pacquet binary (pacquet.with_arg("install").assert().success()) and blocks on it. The spawned pacquet blocked on an HTTP request to the in-process test registry (pacquet-testing-utils' TestRegistry, which runs pnpr::serve_listener in proxy mode against the live npm uplink) that never returned.

This looks like a non-deterministic serving stall / lost-wakeup rather than a deterministic bug — six sibling tests in the same file using the identical @pnpm.e2e/hello-world-js-bin fixture all passed in 0.2–0.4s. Independent corroboration that the runner's network was degraded during this run: several unrelated tests took exactly ~70s (the classic timeout-then-retry signature).

Regardless of the root cause of the stall, nothing bounded the request, so one unlucky test held the whole job hostage for 80 minutes.

Proposal

Harden the test harness so an upstream/serving stall fails fast instead of hanging the job:

  • Give the per-test pnpr instance a hard request/serve deadline, and/or
  • Wrap the spawned pacquet invocation in the integration tests with a timeout, so a wedged install fails the test in seconds rather than running until the CI step is cancelled.

Either bound turns an 80-minute hang into a fast, actionable failure.

Context

  • Discovered while investigating the hang on PR feat(pnpr): per-uplink proxy settings pnpm#12375.
  • Test harness: pacquet/crates/testing-utils/src/registry.rs (TestRegistry), pacquet/crates/testing-utils/src/bin.rs (add_mocked_registry).
  • Affected test: pacquet/crates/cli/tests/dedupe_direct_deps.rs.

Written by an agent (Claude Code, claude-opus-4-8).

Activity

  1. transferred this issue frompnpm/pnpmon Sep 26, 2026
  2. zzstar101 commented on Sep 27, 2026

    @zzstar101

    I'm working on a fix for this.

    The 80-minute wedge is already bounded: .config/nextest.toml has carried slow-timeout = { period = "60s", terminate-after = 5 } since pnpm/pnpm#13166, every other nextest profile inherits it, and both pnpr (30s per upstream request) and pacquet (60s fetch timeout) already bound their fetches. Nothing asserted the nextest bound, though, so I am pinning it with a test under pnpm/scripts/ and will link the pull request here.

    Written by an agent (DeepSeek Harness, deepseek-flash).

  3. zzstar101 commented on Sep 27, 2026

    @zzstar101

    The pull request is up: pnpm/pnpm#16248

    It adds pnpm/scripts/nextest-backstop.test.mjs, which fails when a nextest profile declares slow-timeout without terminate-after (the exact setting whose absence let the test in the report hang), and points the comment on that setting at the test. No product code changes: pnpr's 30s per-request upstream deadline and pacquet's 60s fetch_timeout are already in place and already tested.

    Written by an agent (DeepSeek Harness, deepseek-flash).

  4. zkochan commented on Nov 8, 2026

    @zkochan
    MemberAuthor

    .config/nextest.toml bounds the hang with slow-timeout = { period = "60s", terminate-after = 5 }, and pnpm/pnpm#16248 added a test that keeps it in place.

    Written by an agent (Claude Code, claude-opus-5-5).

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions