Skip to content

feat(qss-stress): toxiproxy harness, precise wire-fault hooks, jest config#3219

Open
holmesworcester wants to merge 1 commit into
7.1.0from
feat/qss-toxiproxy-tooling
Open

feat(qss-stress): toxiproxy harness, precise wire-fault hooks, jest config#3219
holmesworcester wants to merge 1 commit into
7.1.0from
feat/qss-toxiproxy-tooling

Conversation

@holmesworcester

Copy link
Copy Markdown
Collaborator

Summary

Lands the QSS stress tooling on 7.1.0 — the toxiproxy harness, wire-fault hook, jest config, and helper scripts. Scenario specs (the proofs-of-concept used during the QSS investigation) are intentionally left out of this PR and will land separately on top.

What's in

Harness:

  • harness.tsbootQssHarness() / bootMemberHarness() boot the QSS path of the Nest app behind toxiproxy. Per-test proxy isolation: every call allocates a unique proxy name and free local port and tears it down on shutdown, so multiple stress runs can execute in parallel under jest's --maxWorkers without colliding.
  • precise-faults.tsinstallWireFaultHooks() monkey-patches qssClient.sendMessage to inject precise per-message faults (drop / delay / error / busy-wait pause) keyed by WebsocketEvents type. Helpers: scheduleOutageAfter, oneShot, busyWaitPause. Use it when network-level toxiproxy chaos is too coarse and a bug needs message-type granularity.
  • toxiproxy.ts — tiny zero-dep client for the toxiproxy admin API with retry-with-backoff for transient 503/timeout/ECONNRESET. The admin API is single-threaded; under concurrent load it returns transient errors that are safe to retry. Also splits rawRequest from request and surfaces HTTP status on errors.
  • docker-compose.yml — toxiproxy sidecar (host networking on Linux).
  • README.md — usage and configuration.

Test plumbing:

  • packages/backend/jest.stress.config.js — dedicated jest config for the stress harness (ts-jest ESM, type-diagnostics off, longer timeout, scoped testRegex).
  • packages/backend/package.jsontest-stress-qss script + testPathIgnorePatterns so *.stress.spec.ts is excluded from default test/test-ci.

Scripts:

  • Root package.jsonstart:qss:toxi / stop:qss:toxi convenience wrappers around docker compose for the toxiproxy sidecar.

Not in this PR

Scenario specs (scenarios/*.stress.spec.ts), the chaos profile catalog (fuzz.ts), invariant probes (invariants.ts), and FINDINGS.md are part of the investigation work and will land in follow-ups.

Test plan

  • npm run start:qss (existing)
  • npm run start:qss:toxi brings up the toxiproxy sidecar
  • cd packages/backend && npm run test-stress-qss — currently a no-op since no *.stress.spec.ts exist on this branch yet; should run jest cleanly with no test files matched
  • npm run test / npm run test-ci does not pick up anything under src/nest/qss/stress/ (excluded via testPathIgnorePatterns)
  • npm run stop:qss:toxi

…onfig

Brings the QSS stress tooling onto 7.1.0. Scenario specs land separately.

- harness.ts — bootQssHarness/bootMemberHarness with per-test toxiproxy
  isolation (unique proxy name + free local port per call).
- toxiproxy.ts — zero-dep client for the toxiproxy admin API with
  retry-with-backoff for transient 503/timeout/ECONNRESET (admin API is
  single-threaded and returns transient errors under concurrent load).
- precise-faults.ts — installWireFaultHooks() monkey-patches
  qssClient.sendMessage for per-message faults (drop / delay / error /
  busy-wait pause) keyed by WebsocketEvents.
- docker-compose.yml — toxiproxy sidecar.
- jest.stress.config.js + test-stress-qss script + testPathIgnorePatterns
  exclusion so *.stress.spec.ts never runs in default test/test-ci.
- start:qss:toxi / stop:qss:toxi root scripts.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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