M6-T2: window-protocol load harness (local-guarded, extensively tested)#29
Merged
Conversation
M6-T2 first slice — the load harness itself. BUILD only; running is a separate gated step against a LOCAL stack (hard guard refuses the prod ref / non-localhost). - scripts/load/lib/hmac-chain.mjs: synthetic-client heartbeat HMAC chain, byte-matched to public.window_beat (msg = "seq|prev|activity" keyed by challenge; prev chains to the previous beat's hmac, window_id for beat 1). Pure, node:crypto only. - scripts/load/lib/metrics.mjs: pure latency percentiles (nearest-rank), throughput, successful-writes/s, and (op,code) error taxonomy. - scripts/load/harness.mjs: driver. assertSafeTarget() hard-refuses prod ref prmsonskzrubqsazmpwd or any non-localhost host (unless LOAD_ALLOW_NONLOCAL=1, and prod-ref still refused). Seeds auth.users -> publishers -> devices (auth_user_id is NOT NULL) via GoTrue admin + service-role inserts, mints device JWTs, runs concurrent virtual users through open -> honest beats (>=600ms spacing) -> close at full dwell, summarizes. NOT run here. - test/load-harness.test.mjs: +7 hermetic cases — HMAC vectors LOCKED to the server contract (drift would 400 every real beat) + metrics math. - docs/ops/load-test-plan.md: methodology, safety guard, ceiling math (~15k writes/s @ ~50k devs), RL tuning, Cloudflare-DO migration trigger, gated run instructions. Not shipped to npm. DEPENDS-ON M5 for running against anything shared. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Builds the M6-T2 load harness for the hot path (
window_open → window_beat×N → close_window) and validates it end-to-end against a local stack. Prod untouched — a hard guard refuses the prod ref / non-localhost.What's here
scripts/load/lib/hmac-chain.mjs— synthetic-client heartbeat HMAC chain, byte-matched topublic.window_beat(msg="seq|prev|activity"keyed by challenge;prevchains to the previous beat's hmac,window_idfor beat 1). Pure, node:crypto only.scripts/load/lib/metrics.mjs— pure latency percentiles (nearest-rank), throughput, successful-writes/s,(op,code)error taxonomy.scripts/load/harness.mjs— driver.assertSafeTarget()hard-refuses prod refprmsonskzrubqsazmpwdor any non-localhost host. Seedsauth.users → publishers → devices(auth_user_id NOT NULL) via GoTrue admin + service-role inserts, mints device JWTs, runs concurrent virtual users at honest cadence (≥600ms beat spacing, full 5s dwell).test/load-harness.test.mjs— +7 hermetic cases; HMAC vectors locked to the server contract (drift → every real beat 400s).docs/ops/load-test-plan.md— methodology, safety guard, ceiling math (~15k writes/s @ ~50k devs), RL tuning, Cloudflare-DO migration trigger, gated run instructions.Test evidence (local stack)
window_open'sorder by random()as the slowest op — a real finding). All 506 honest windows credited (HMAC chain + anti-batch + dwell correct under concurrency).LOAD_ALLOW_NONLOCAL=1.node --test test/*.test.mjs→ 248/248 (+7).Not shipped to npm. Running against anything shared still DEPENDS-ON M5 (prod is single-owner until the first charge reconciles).
🤖 Generated with Claude Code