feat(qss-stress): consolidate harness — precise faults, parallel proxies, retry#15
Closed
holmesworcester wants to merge 1 commit into
Closed
feat(qss-stress): consolidate harness — precise faults, parallel proxies, retry#15holmesworcester wants to merge 1 commit into
holmesworcester wants to merge 1 commit into
Conversation
…ies, retry Wraps up the QSS stress harness with the last pieces from the investigation work and the parallelism / robustness improvements that weren't part of the earlier per-peer-chaos / leave-switch / pause-primitive merges. Infra additions: - precise-faults.ts — installWireFaultHooks() 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 the bug needs message-type granularity. - harness.ts — per-test proxy isolation: every bootQssHarness() / bootMemberHarness() call allocates a unique proxy name and a free local port, and deletes the proxy on shutdown. Lets multiple stress runs execute in parallel under jest's --maxWorkers without colliding on a shared 'qss' proxy. - toxiproxy.ts — retry-with-backoff for transient 503/timeout/ECONNRESET on the toxiproxy admin API. 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. Scenarios: - scenarios/flap-stalls-create.stress.spec.ts — rapid proxy enable/disable flaps during preCreate and duringAuthSync. Surfaces stalls in the sign-in / auth-conn state machines under churn. - scenarios/wire-fault-acks.stress.spec.ts — per-message ack-handling sweep using installWireFaultHooks. Demonstrates wire-fault hook usage. Scripts: - Root: start:qss:toxi / stop:qss:toxi convenience wrappers around docker compose for the toxiproxy sidecar. - Backend: test-stress-qss script for running the dedicated jest config. testPathIgnorePatterns excludes stress/ from default test/test-ci so CI is unaffected.
Owner
Author
|
Superseded by TryQuiet/quiet#3219, which lands just the toxiproxy tooling (harness, precise-faults, toxiproxy client, jest config, scripts) on 7.1.0. The scenario specs / fuzz catalog / invariants / FINDINGS will land separately. Closing this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wraps up the QSS stress harness with the last pieces from the investigation work plus the parallelism / robustness improvements that weren't part of the earlier per-peer-chaos / leave-switch / pause-primitive merges.
What's in
Infra:
precise-faults.ts—installWireFaultHooks()monkey-patchesqssClient.sendMessageto inject precise per-message faults (drop / delay / error / busy-wait pause) keyed byWebsocketEventstype. Helpers:scheduleOutageAfter,oneShot,busyWaitPause. Use it when network-level toxiproxy chaos is too coarse and the bug needs message-type granularity.harness.ts— per-test proxy isolation. EverybootQssHarness()/bootMemberHarness()call allocates a unique proxy name and a free local port, and deletes the proxy on shutdown. Lets multiple stress runs execute in parallel under jest's--maxWorkerswithout colliding on a sharedqssproxy.toxiproxy.ts— retry-with-backoff for transient 503/timeout/ECONNRESET on the toxiproxy admin API. The admin API is single-threaded; under concurrent load it returns transient errors that are safe to retry. Also splitsrawRequestfromrequestand surfaces HTTP status on errors.Scenarios:
scenarios/flap-stalls-create.stress.spec.ts— rapid proxy enable/disable flaps duringpreCreateandduringAuthSync. Surfaces stalls in the sign-in / auth-conn state machines under churn.scenarios/wire-fault-acks.stress.spec.ts— per-message ack-handling sweep usinginstallWireFaultHooks. Demonstrates wire-fault hook usage.Scripts:
start:qss:toxi/stop:qss:toxiconvenience wrappers arounddocker composefor the toxiproxy sidecar.test-stress-qssscript for running the dedicated jest config.testPathIgnorePatternsexcludesstress/from defaulttest/test-ciso CI is unaffected.Test plan
docker compose uptoxiproxy sidecarnpm run start:qss(existing)cd packages/backend && npm run test-stress-qss— verify the suite runs end-to-end against a real QSS servernpm run test/test-cidoes not pick up*.stress.spec.ts(excluded viatestPathIgnorePatterns)