Skip to content

test(client): accelerate service lifecycle tests - #41879

Merged
kitlangton merged 3 commits into
v2from
speed-client-tests
Aug 12, 2026
Merged

test(client): accelerate service lifecycle tests#41879
kitlangton merged 3 commits into
v2from
speed-client-tests

Conversation

@kitlangton

@kitlangton kitlangton commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What

Reduce Client service lifecycle test time by exercising the same polling, probe, contender, backoff, eviction, and stop behavior with an accelerated private timing policy.

The focused lifecycle suite improves from 72.556s to a 4.529s median, saving 68.03s (93.8%) per run.

How

  • Add a private identity-keyed timing policy shared by the Effect and Promise service implementations.
  • Keep one source of unchanged production defaults: 1s polling, 2s HTTP requests, 5s initial contender spacing, 30s maximum backoff, 120 Effect attempts / 120s Promise deadline, and 50ms stop polling.
  • Apply partial accelerated overrides only to fresh test option objects through a WeakMap; public EnsureOptions and package exports are unchanged.
  • Scale fixture delays while preserving their ordering relative to contender spacing, so slow winners, failed losers, lock probes, and incompatible-owner races remain real subprocess tests.
  • Synchronize tests through actual health requests, contender starts, and repeated stop attempts instead of fixed sleeps.
  • Await detached replacement process exits before temporary-directory cleanup.

Scope

This does not replace subprocesses, mock lifecycle operations, reduce retry counts, or alter production service timing. The private timing module is compiled into dist but is not exposed through package exports or public service declarations.

Testing

  • Baseline: hyperfine --warmup 1 --runs 3 'bun run test test/service.test.ts test/promise-service.test.ts': 72.556s ± 0.031s
  • After simplify: hyperfine --warmup 1 --runs 9 'bun run test test/service.test.ts test/promise-service.test.ts': 4.529s median, 4.468s–5.253s
  • bun run test test/service.test.ts test/promise-service.test.ts --rerun-each 10: 190 pass
  • Eight lifecycle suites run concurrently in four processes: 152 pass
  • Hanging eviction cases repeated 10 times per implementation: 20 pass
  • bun run test: 52 pass
  • bun typecheck
  • bun run build
  • Workspace typecheck: 39 packages pass
  • Focused Oxlint: 0 errors
  • Prettier and git diff --check

@kitlangton
kitlangton merged commit 0df3070 into v2 Aug 12, 2026
11 of 14 checks passed
@kitlangton
kitlangton deleted the speed-client-tests branch August 12, 2026 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant