From ce7620a1b664823a847bba2fd8dcc904b22c92d3 Mon Sep 17 00:00:00 2001 From: ajithakdev Date: Sat, 21 Nov 2026 04:15:55 +0530 Subject: [PATCH 1/8] feat(worker): serve /ping as a static asset so pings cost no Worker requests About 35 of a test's 150 requests are pings. Static assets are free and unlimited on the Workers free plan, and an A/B test against production showed the same ping times. Downloads stay on the Worker: served as static assets they added about 180 ms to each request's first byte. STATE records the request budget, the next step (bigger upload chunks) and the backends that were researched and rejected. --- CHANGELOG.md | 3 +++ docs/STATE.md | 6 ++++++ services/worker/public/_headers | 5 +++++ services/worker/public/ping | 1 + services/worker/src/index.test.ts | 11 ++++++++++- services/worker/src/index.ts | 2 +- services/worker/wrangler.toml | 7 ++++++- 7 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 services/worker/public/_headers create mode 100644 services/worker/public/ping diff --git a/CHANGELOG.md b/CHANGELOG.md index ea26ab5..6ebf80b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to MeterX are documented here. The format follows [Keep a Ch ## [Unreleased] +### Changed +- The worker serves `/ping` as a static asset, which Cloudflare does not count against the free plan's 100,000 requests a day. About 35 of a test's 150 requests are pings, so the same quota now covers about 30% more tests, with no extension update. An A/B test on 2026-11-21 showed the same ping times. Downloads stay on the Worker: as static assets, each request waited about 180 ms longer for its first byte + ## [2027.0.2] - 2026-10-31 ### Changed diff --git a/docs/STATE.md b/docs/STATE.md index 9506200..091dfe5 100644 --- a/docs/STATE.md +++ b/docs/STATE.md @@ -4,6 +4,12 @@ Last updated: 2026-10-31, on `main` after the 2027.0.2 worker release. Update this file at the end of each work session. Keep it short. Delete entries once they are done and merged. +## Decision 2026-11-21: 2-week promotion test + +Feature and UI work is frozen (bug fixes only) until about 2026-12-06. The pitch becomes "log your speed and prove it to your ISP". Plan and decision rule: see the MeterX section of `~/.claude/launch-log.md`. Under about 100 active installs by then means maintenance mode. + +Backend before promotion (branch `feat/static-test-files`): the free Worker plan allows 100,000 requests a day and a test makes about 150 (roughly 1 `/ip`, 35 pings, 10 to 20 downloads, 96 uploads), so about 660 tests a day for everyone. Done on the branch: `/ping` is a static asset (free, unlimited; same latency in a production A/B). Tried and rejected: downloads as static assets (about 180 ms more time to first byte per request, so lower results). Next: bigger upload chunks in `uploadChunkBytes` (about 1 s per chunk instead of 0.25 s, so about 24 upload requests), checked in a browser A/B for accuracy; then a 429 fallback to `speed.cloudflare.com/__down` and `__up`. Rejected as backends: M-Lab (4 automated tests a day, publishes IPs), Ookla, fast.com, volunteer LibreSpeed servers, Oracle Always Free (stopping idle reclaim needs Pay As You Go, which has no hard spending cap). + ## In progress (2026-10-27) 2027.0.1 is released and on every free store: Firefox live, Edge in review, Opera awaiting moderation (new entry, slug `meterx-by-ajithakdev-2`). Store steps and every field's text are in `docs/STORE-CHECKLIST.md` and `docs/STORE-LISTINGS.md`; `npm run package` builds `release/upload//`. Main has a `protect-main` ruleset, so merges need the owner's admin bypass. 2027.0.2 (2026-10-31) shipped PR #100: the worker's CPU per request is under the free plan's 10 ms limit (preview p50 4.5 ms, p90 8.0 ms), deployed as worker version `f924181d`; no extension change, so stores stay on 2027.0.1. An A/B test against the old worker showed the same speeds, but ping during download about 55 ms higher (weak signal, 10 of 13 pairs on a 480 ms link); recheck the bufferbloat grades on a low-latency line. MeterX has never been promoted; a launch plan (dev.to article, Reddit, AlternativeTo, awesome-selfhosted, the video, a rating prompt) was proposed on 2026-10-27 and not started. diff --git a/services/worker/public/_headers b/services/worker/public/_headers new file mode 100644 index 0000000..35846a5 --- /dev/null +++ b/services/worker/public/_headers @@ -0,0 +1,5 @@ +# /ping is a static asset: free, unlimited, never counted as a Worker request. +/ping + Access-Control-Allow-Origin: * + Timing-Allow-Origin: * + Content-Type: text/plain diff --git a/services/worker/public/ping b/services/worker/public/ping new file mode 100644 index 0000000..303af67 --- /dev/null +++ b/services/worker/public/ping @@ -0,0 +1 @@ +Pong! \ No newline at end of file diff --git a/services/worker/src/index.test.ts b/services/worker/src/index.test.ts index 3b7dbc0..c2f0718 100644 --- a/services/worker/src/index.test.ts +++ b/services/worker/src/index.test.ts @@ -1,6 +1,7 @@ import { describe, it, expect } from 'vitest'; import worker, { type Env } from './index'; import { ALLOWED_SIZES_MB, MAX_UPLOAD_BYTES, VERSION } from '@meterx/shared'; +import { readFileSync } from 'node:fs'; const EXT = 'chrome-extension://abcdefghijklmnop'; const call = (path: string, init: RequestInit = {}, env: Env = {}) => @@ -52,7 +53,7 @@ describe('worker', () => { it('answers 429 when the rate limiter says no, but never for /health', async () => { const env: Env = { RATE_LIMITER: { limit: async () => ({ success: false }) } as unknown as RateLimit }; - expect((await call('/ping', {}, env)).status).toBe(429); + expect((await call('/ip', {}, env)).status).toBe(429); expect((await call('/health', {}, env)).status).toBe(200); }); @@ -60,3 +61,11 @@ describe('worker', () => { expect((await call('/nope')).status).toBe(404); }); }); + +describe('/ping static asset', () => { + it('answers Pong! with open CORS and timing headers', () => { + expect(readFileSync(new URL('../public/ping', import.meta.url), 'utf8')).toBe('Pong!'); + const rules = readFileSync(new URL('../public/_headers', import.meta.url), 'utf8'); + expect(rules).toMatch(/\n\/ping\n {2}Access-Control-Allow-Origin: \*\n {2}Timing-Allow-Origin: \*/); + }); +}); diff --git a/services/worker/src/index.ts b/services/worker/src/index.ts index 0ae5b8b..10d5701 100644 --- a/services/worker/src/index.ts +++ b/services/worker/src/index.ts @@ -1,6 +1,7 @@ /** * MeterX Cloudflare Worker: edge speed test server. * Streams generated bytes, drains uploads, stores nothing. + * /ping is a static asset in public/ (see wrangler.toml), so it never reaches this code. * @author ajithakdev (https://github.com/ajithakdev) * @license AGPL-3.0 */ @@ -119,7 +120,6 @@ export default { const dl = pathname.match(/^\/test-file\/([^/]+)$/); if (dl && method === 'GET') return handleDownload(request, dl[1]); if (pathname === '/upload' && method === 'POST') return handleUpload(request); - if (pathname === '/ping' && (method === 'HEAD' || method === 'GET')) return text(request, method === 'HEAD' ? null : 'Pong!'); if (pathname === '/health' && method === 'GET') return handleHealth(request); if (pathname === '/ip' && method === 'GET') return handleIp(request); diff --git a/services/worker/wrangler.toml b/services/worker/wrangler.toml index 4cf148e..14ba619 100644 --- a/services/worker/wrangler.toml +++ b/services/worker/wrangler.toml @@ -2,8 +2,13 @@ name = "meterx-speedtest" main = "src/index.ts" compatibility_date = "2025-03-14" +# /ping is a static asset (public/ping): free, unlimited, never a Worker request, same latency in an A/B test. +# Downloads stay on the Worker: static assets added about 180 ms to each request's first byte (2026-11-21). +[assets] +directory = "./public" + # Per-IP limit so one script can't use up the free plan's daily request quota (#79). -# One test makes about 150 requests; 400 per minute leaves room for shared (CGNAT) IPs. +# One test makes about 150 requests (about 115 now that pings are static); 400 per minute leaves room for shared (CGNAT) IPs. # Counts are per Cloudflare location and approximate. [[ratelimits]] name = "RATE_LIMITER" From 67296dcc16064272a87b5fe25f0de7e7b8d54b5c Mon Sep 17 00:00:00 2001 From: ajithakdev Date: Sat, 21 Nov 2026 04:25:36 +0530 Subject: [PATCH 2/8] feat(extension): size upload bodies from each stream's last request Bodies aim at about 1 s per request instead of 0.25 s, so a test makes about 24 upload requests instead of about 96. Each step grows at most 4x, so a slow uplink behind a fast downlink still completes bodies (#60). --- CHANGELOG.md | 1 + apps/extension/src/background/measure.test.ts | 17 ++++++++++++- apps/extension/src/background/measure.ts | 15 +++++++++++- apps/extension/src/background/runner.ts | 24 ++++++++++++------- 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ebf80b..a71b406 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to MeterX are documented here. The format follows [Keep a Ch ## [Unreleased] ### Changed +- Upload streams resize each body from how long the last one took, aiming at about 1 s per request (growing at most 4x a step, so slow uplinks still finish bodies, #60). A test now makes about 24 upload requests instead of about 96, so the free server quota covers several times more tests - The worker serves `/ping` as a static asset, which Cloudflare does not count against the free plan's 100,000 requests a day. About 35 of a test's 150 requests are pings, so the same quota now covers about 30% more tests, with no extension update. An A/B test on 2026-11-21 showed the same ping times. Downloads stay on the Worker: as static assets, each request waited about 180 ms longer for its first byte ## [2027.0.2] - 2026-10-31 diff --git a/apps/extension/src/background/measure.test.ts b/apps/extension/src/background/measure.test.ts index c1d743c..f43e325 100644 --- a/apps/extension/src/background/measure.test.ts +++ b/apps/extension/src/background/measure.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect } from 'vitest'; -import { toMbps, bytesAtTime, steadyMbps, median, latencyStats, gradeBufferbloat, uploadChunkBytes, backoffMs } from './measure'; +import { toMbps, bytesAtTime, steadyMbps, median, latencyStats, gradeBufferbloat, uploadChunkBytes, nextUploadChunk, backoffMs } from './measure'; const opts = { rampMs: 1000, tailMs: 500, durationMs: 8000 }; @@ -78,6 +78,21 @@ describe('uploadChunkBytes', () => { }); }); +describe('nextUploadChunk', () => { + it('sizes the next body to take about 1 s', () => { + expect(nextUploadChunk(1_000_000, 250)).toBe(4_000_000); + expect(nextUploadChunk(2_000_000, 2000)).toBe(1_000_000); + }); + it('grows at most 4x per request, so a slow uplink still completes bodies (#60)', () => { + expect(nextUploadChunk(300_000, 10)).toBe(1_200_000); + expect(nextUploadChunk(300_000, 0)).toBe(1_200_000); + }); + it('stays within the min and max body sizes', () => { + expect(nextUploadChunk(256 * 1024, 5000)).toBe(256 * 1024); + expect(nextUploadChunk(8 * 1024 * 1024, 100)).toBe(8 * 1024 * 1024); + }); +}); + describe('backoffMs', () => { it('doubles and caps', () => { expect([1, 2, 3, 4, 10].map(backoffMs)).toEqual([250, 500, 1000, 2000, 2000]); diff --git a/apps/extension/src/background/measure.ts b/apps/extension/src/background/measure.ts index 17792aa..70b8d3e 100644 --- a/apps/extension/src/background/measure.ts +++ b/apps/extension/src/background/measure.ts @@ -56,7 +56,7 @@ export function latencyStats(latencies: number[], attempts: number): { ping: num const KB = 1024; const MIN_UPLOAD_CHUNK = 256 * KB; -const MAX_UPLOAD_CHUNK = 8 * 1024 * KB; +export const MAX_UPLOAD_CHUNK = 8 * 1024 * KB; /** * Upload body size so each stream finishes about 4 requests a second. @@ -70,6 +70,19 @@ export function uploadChunkBytes(downloadMbps: number | undefined, streams: numb return Math.min(MAX_UPLOAD_CHUNK, Math.max(MIN_UPLOAD_CHUNK, target)); } +const UPLOAD_TARGET_MS = 1000; + +/** + * Next body size for one upload stream, from how long its last body took: aims at about + * 1 s per request, so a test spends about 24 Worker requests on uploads instead of about 96. + * Grows at most 4x per step, so a slow uplink behind a fast downlink still completes bodies (#60). + */ +export function nextUploadChunk(lastBytes: number, lastMs: number): number { + const ideal = lastMs > 0 ? (lastBytes * UPLOAD_TARGET_MS) / lastMs : lastBytes * 4; + const next = Math.round(Math.min(ideal, lastBytes * 4)); + return Math.min(MAX_UPLOAD_CHUNK, Math.max(MIN_UPLOAD_CHUNK, next)); +} + /** Delay before retrying a failed transfer request: 250 ms, doubling, capped at 2 s (#65). */ export function backoffMs(failures: number): number { return Math.min(2000, 250 * 2 ** Math.max(0, failures - 1)); diff --git a/apps/extension/src/background/runner.ts b/apps/extension/src/background/runner.ts index d1c425a..1b95eac 100644 --- a/apps/extension/src/background/runner.ts +++ b/apps/extension/src/background/runner.ts @@ -10,7 +10,7 @@ import type { IpInfo, TestProgress, TestResults } from '@meterx/shared'; import { type ByteSample, backoffMs, bytesAtTime, gradeBufferbloat, latencyStats, - median, steadyMbps, toMbps, uploadChunkBytes, + median, nextUploadChunk, steadyMbps, toMbps, uploadChunkBytes, MAX_UPLOAD_CHUNK, } from './measure'; const DOWNLOAD_PATH = '/test-file/25MB.bin'; @@ -76,7 +76,7 @@ function startLoadedProbe(baseUrl: string, signal: AbortSignal): () => Promise void) => Promise, + one: (signal: AbortSignal, credit: (bytes: number) => void, stream: number) => Promise, onLive: (mbps: number) => void, ): Promise { const phase = new AbortController(); @@ -100,11 +100,11 @@ async function runStreams( } }; - const loop = async () => { + const loop = async (stream: number) => { let failures = 0; while (!both.aborted) { try { - await one(both, credit); + await one(both, credit, stream); failures = 0; } catch (e) { if (both.aborted) break; @@ -115,7 +115,7 @@ async function runStreams( }; try { - await Promise.all(Array.from({ length: streams }, loop)); + await Promise.all(Array.from({ length: streams }, (_, i) => loop(i))); } finally { clearTimeout(timer); } @@ -199,18 +199,24 @@ export async function runTest(baseUrl: string, signal: AbortSignal, report: Repo report({ phase: 'download', downloadSpeed: results.downloadSpeed }); report({ phase: 'upload', status: 'Testing upload' }); - const payload = new Uint8Array(uploadChunkBytes(results.downloadSpeed, UPLOAD_STREAMS)); + const payload = new Uint8Array(MAX_UPLOAD_CHUNK); + const firstChunk = uploadChunkBytes(results.downloadSpeed, UPLOAD_STREAMS); + // Each stream resizes its body from its own last request (see nextUploadChunk). + const chunkOf: number[] = Array(UPLOAD_STREAMS).fill(firstChunk); stopProbe = startLoadedProbe(baseUrl, signal); try { - results.uploadSpeed = await runStreams(signal, UPLOAD_STREAMS, async (s, credit) => { + results.uploadSpeed = await runStreams(signal, UPLOAD_STREAMS, async (s, credit, stream) => { + const body = payload.subarray(0, chunkOf[stream]); + const t0 = performance.now(); const res = await fetch(bust(`${baseUrl}/upload`, 'u'), { method: 'POST', cache: 'no-store', signal: s, - headers: { 'Content-Type': 'application/octet-stream' }, body: payload, + headers: { 'Content-Type': 'application/octet-stream' }, body, }); if (!res.ok) throw new HttpError(res.status); await res.arrayBuffer(); // fetch() has no upload progress, so bytes count when each body completes. - credit(payload.byteLength); + credit(body.byteLength); + chunkOf[stream] = nextUploadChunk(body.byteLength, performance.now() - t0); }, mbps => report({ phase: 'upload', uploadSpeed: mbps })); } finally { results.loadedPingUp = await stopProbe(); From 27b8f49e795c668125fb752287c3dcaf44eb67a6 Mon Sep 17 00:00:00 2001 From: ajithakdev Date: Sat, 21 Nov 2026 04:37:05 +0530 Subject: [PATCH 3/8] fix(extension): start uploads small so lopsided lines measure correctly The first upload body was sized from the download speed. On a line with 124 Mbps down and about 4 Mbps up it could not finish inside the 8 s window, so upload read about 1.3 Mbps or failed with 'No data reached the server'. Every stream now starts at 256 KB and grows from its own last request. Node A/B of runTest on that line: main failed 2 of 3 runs, the branch read 3.1 to 3.6 Mbps (curl: 3.6 to 4.2). --- CHANGELOG.md | 5 ++++- apps/extension/src/background/measure.test.ts | 16 +--------------- apps/extension/src/background/measure.ts | 15 ++------------- apps/extension/src/background/runner.ts | 7 +++---- docs/CODEMAP.md | 2 +- docs/STATE.md | 2 +- 6 files changed, 12 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a71b406..4aeeb4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,10 @@ All notable changes to MeterX are documented here. The format follows [Keep a Ch ## [Unreleased] ### Changed -- Upload streams resize each body from how long the last one took, aiming at about 1 s per request (growing at most 4x a step, so slow uplinks still finish bodies, #60). A test now makes about 24 upload requests instead of about 96, so the free server quota covers several times more tests +- Upload streams resize each body from how long the last one took, aiming at about 1 s per request, so a test makes far fewer server requests and the free quota covers several times more tests + +### Fixed +- Upload read far too low, or failed with "No data reached the server", on lines with a much slower upload than download (for example Jio 5G: 124 Mbps down, about 4 up). The first upload body was sized from the download speed and could not finish in time; every stream now starts at 256 KB and grows from what it measures (#60) - The worker serves `/ping` as a static asset, which Cloudflare does not count against the free plan's 100,000 requests a day. About 35 of a test's 150 requests are pings, so the same quota now covers about 30% more tests, with no extension update. An A/B test on 2026-11-21 showed the same ping times. Downloads stay on the Worker: as static assets, each request waited about 180 ms longer for its first byte ## [2027.0.2] - 2026-10-31 diff --git a/apps/extension/src/background/measure.test.ts b/apps/extension/src/background/measure.test.ts index f43e325..b35cd2c 100644 --- a/apps/extension/src/background/measure.test.ts +++ b/apps/extension/src/background/measure.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect } from 'vitest'; -import { toMbps, bytesAtTime, steadyMbps, median, latencyStats, gradeBufferbloat, uploadChunkBytes, nextUploadChunk, backoffMs } from './measure'; +import { toMbps, bytesAtTime, steadyMbps, median, latencyStats, gradeBufferbloat, nextUploadChunk, backoffMs } from './measure'; const opts = { rampMs: 1000, tailMs: 500, durationMs: 8000 }; @@ -64,20 +64,6 @@ describe('gradeBufferbloat', () => { }); }); -describe('uploadChunkBytes', () => { - it('uses small bodies on slow links so requests finish (#60)', () => { - expect(uploadChunkBytes(10, 3)).toBe(256 * 1024); - expect(uploadChunkBytes(undefined, 3)).toBe(256 * 1024); - }); - it('caps bodies on fast links', () => { - expect(uploadChunkBytes(5000, 3)).toBe(8 * 1024 * 1024); - }); - it('targets about 4 completions per second per stream', () => { - // 300 Mbps over 3 streams = 12.5 MB/s per stream, quarter of that per body. - expect(uploadChunkBytes(300, 3)).toBe(3_125_000); - }); -}); - describe('nextUploadChunk', () => { it('sizes the next body to take about 1 s', () => { expect(nextUploadChunk(1_000_000, 250)).toBe(4_000_000); diff --git a/apps/extension/src/background/measure.ts b/apps/extension/src/background/measure.ts index 70b8d3e..4574754 100644 --- a/apps/extension/src/background/measure.ts +++ b/apps/extension/src/background/measure.ts @@ -55,21 +55,10 @@ export function latencyStats(latencies: number[], attempts: number): { ping: num const KB = 1024; -const MIN_UPLOAD_CHUNK = 256 * KB; +/** Every upload stream starts here and grows from what it measures, so lopsided lines (fast down, slow up) still finish bodies (#60). */ +export const MIN_UPLOAD_CHUNK = 256 * KB; export const MAX_UPLOAD_CHUNK = 8 * 1024 * KB; -/** - * Upload body size so each stream finishes about 4 requests a second. - * Bytes only count when a request completes, so fixed 5 MB bodies read - * 0 Mbps on slow uplinks (#60). Sized from the download speed, which is - * known by then and is usually the higher of the two. - */ -export function uploadChunkBytes(downloadMbps: number | undefined, streams: number): number { - const perStreamBytesPerSec = ((downloadMbps || 0) * 1e6) / 8 / Math.max(1, streams); - const target = Math.round(perStreamBytesPerSec / 4); - return Math.min(MAX_UPLOAD_CHUNK, Math.max(MIN_UPLOAD_CHUNK, target)); -} - const UPLOAD_TARGET_MS = 1000; /** diff --git a/apps/extension/src/background/runner.ts b/apps/extension/src/background/runner.ts index 1b95eac..7a4cdd5 100644 --- a/apps/extension/src/background/runner.ts +++ b/apps/extension/src/background/runner.ts @@ -10,7 +10,7 @@ import type { IpInfo, TestProgress, TestResults } from '@meterx/shared'; import { type ByteSample, backoffMs, bytesAtTime, gradeBufferbloat, latencyStats, - median, nextUploadChunk, steadyMbps, toMbps, uploadChunkBytes, MAX_UPLOAD_CHUNK, + median, nextUploadChunk, steadyMbps, toMbps, MAX_UPLOAD_CHUNK, MIN_UPLOAD_CHUNK, } from './measure'; const DOWNLOAD_PATH = '/test-file/25MB.bin'; @@ -200,9 +200,8 @@ export async function runTest(baseUrl: string, signal: AbortSignal, report: Repo report({ phase: 'upload', status: 'Testing upload' }); const payload = new Uint8Array(MAX_UPLOAD_CHUNK); - const firstChunk = uploadChunkBytes(results.downloadSpeed, UPLOAD_STREAMS); - // Each stream resizes its body from its own last request (see nextUploadChunk). - const chunkOf: number[] = Array(UPLOAD_STREAMS).fill(firstChunk); + // Each stream starts small and resizes its body from its own last request (see nextUploadChunk). + const chunkOf: number[] = Array(UPLOAD_STREAMS).fill(MIN_UPLOAD_CHUNK); stopProbe = startLoadedProbe(baseUrl, signal); try { results.uploadSpeed = await runStreams(signal, UPLOAD_STREAMS, async (s, credit, stream) => { diff --git a/docs/CODEMAP.md b/docs/CODEMAP.md index 84ade45..f4a4270 100644 --- a/docs/CODEMAP.md +++ b/docs/CODEMAP.md @@ -37,7 +37,7 @@ Generated by `node scripts/codemap.mjs`; regenerate after moving or adding files | --- | --- | --- | | `apps/extension/build.mjs` (41) | - | | | `apps/extension/src/background/index.ts` (120) | - | MeterX service worker: runs tests, saves history, schedules, notifies. | -| `apps/extension/src/background/measure.ts` (77) | `ByteSample`, `toMbps`, `bytesAtTime`, `steadyMbps`, `latencyStats`, `uploadChunkBytes` | Pure measurement math. No I/O, so it is unit tested (measure.test.ts). | +| `apps/extension/src/background/measure.ts` (77) | `ByteSample`, `toMbps`, `bytesAtTime`, `steadyMbps`, `latencyStats`, `nextUploadChunk` | Pure measurement math. No I/O, so it is unit tested (measure.test.ts). | | `apps/extension/src/background/runner.ts` (227) | `Reporter`, `CancelledError`, `HttpError`, `runTest` | One speed test: connect, idle latency, download, upload. | | `apps/extension/src/lib/browser.ts` (55) | `validateServerUrl`, `normalizeServerUrl`, `getServerUrl`, `panelSupported`, `openPanel` | Settings and cross-browser helpers used by the service worker and the pages. | | `apps/extension/src/lib/export-data.ts` (28) | `triggerDownload`, `exportCsv`, `exportJson` | CSV and JSON downloads. The files themselves are built by @meterx/reports. | diff --git a/docs/STATE.md b/docs/STATE.md index 091dfe5..c591040 100644 --- a/docs/STATE.md +++ b/docs/STATE.md @@ -8,7 +8,7 @@ Update this file at the end of each work session. Keep it short. Delete entries Feature and UI work is frozen (bug fixes only) until about 2026-12-06. The pitch becomes "log your speed and prove it to your ISP". Plan and decision rule: see the MeterX section of `~/.claude/launch-log.md`. Under about 100 active installs by then means maintenance mode. -Backend before promotion (branch `feat/static-test-files`): the free Worker plan allows 100,000 requests a day and a test makes about 150 (roughly 1 `/ip`, 35 pings, 10 to 20 downloads, 96 uploads), so about 660 tests a day for everyone. Done on the branch: `/ping` is a static asset (free, unlimited; same latency in a production A/B). Tried and rejected: downloads as static assets (about 180 ms more time to first byte per request, so lower results). Next: bigger upload chunks in `uploadChunkBytes` (about 1 s per chunk instead of 0.25 s, so about 24 upload requests), checked in a browser A/B for accuracy; then a 429 fallback to `speed.cloudflare.com/__down` and `__up`. Rejected as backends: M-Lab (4 automated tests a day, publishes IPs), Ookla, fast.com, volunteer LibreSpeed servers, Oracle Always Free (stopping idle reclaim needs Pay As You Go, which has no hard spending cap). +Backend before promotion (branch `feat/static-test-files`): the free Worker plan allows 100,000 requests a day and a test makes about 150 (roughly 1 `/ip`, 35 pings, 10 to 20 downloads, 96 uploads), so about 660 tests a day for everyone. Done on the branch: `/ping` is a static asset (free, unlimited; same latency in a production A/B). Tried and rejected: downloads as static assets (about 180 ms more time to first byte per request, so lower results). Also done: upload bodies start at 256 KB and each stream resizes from its last request toward about 1 s (`nextUploadChunk`). This also fixed uploads on lopsided lines: on Jio (124 down, about 4 up) `main` failed 2 of 3 runs with "No data reached the server", the branch read 3.1 to 3.6 Mbps against curl's 3.6 to 4.2 (Node A/B of `runTest`, 2026-11-21). Not tested yet: request count and accuracy on a fast symmetric line. Deferred: a 429 fallback to `speed.cloudflare.com` (needs a new host permission and has no published terms; add only if traffic nears the quota). Next feature (2027.1.0): opt-in outage monitor, probes of the static `/ping` every 30 s, sleep and closed browser shown as not monitored, PDF and CSV outage report. Rejected as backends: M-Lab (4 automated tests a day, publishes IPs), Ookla, fast.com, volunteer LibreSpeed servers, Oracle Always Free (stopping idle reclaim needs Pay As You Go, which has no hard spending cap). ## In progress (2026-10-27) From ec7d85ec696b00209105f011fb3391e2bffd1bd8 Mon Sep 17 00:00:00 2001 From: ajithakdev Date: Sat, 21 Nov 2026 04:54:56 +0530 Subject: [PATCH 4/8] fix: move the default test server to meterx-api.ajithakdev.com without HTTP/3 Chrome uploads over HTTP/3 (QUIC) to workers.dev stalled on Jio until the test gave up. workers.dev always advertises HTTP/3 and a Worker cannot clear Alt-Svc, so the worker now also answers on a custom domain in the ajithakdev.com zone, which has HTTP/3 off. In Chromium on that line with QUIC disabled, uploads read 3.0 to 3.8 Mbps (curl 3.6 to 4.2). workers.dev stays on for older versions. --- CHANGELOG.md | 1 + RESOURCES-AND-GUIDE.md | 4 ++-- apps/extension/static/manifest.json | 2 +- apps/site/static/_headers | 2 +- docs/STORE-CHECKLIST.md | 4 ++-- docs/STORE-LISTINGS.md | 4 ++-- packages/shared/src/index.ts | 2 +- services/worker/wrangler.toml | 5 +++++ 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4aeeb4b..31c22be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to MeterX are documented here. The format follows [Keep a Ch - Upload streams resize each body from how long the last one took, aiming at about 1 s per request, so a test makes far fewer server requests and the free quota covers several times more tests ### Fixed +- Chrome and Edge uploads stalled on some networks (seen on Jio): Chrome used HTTP/3 to the test server, and uploads over it hung until the test gave up. The default test server is now `meterx-api.ajithakdev.com`, served without HTTP/3. The extension asks for access to the new address once; the old `workers.dev` address keeps working for older versions - Upload read far too low, or failed with "No data reached the server", on lines with a much slower upload than download (for example Jio 5G: 124 Mbps down, about 4 up). The first upload body was sized from the download speed and could not finish in time; every stream now starts at 256 KB and grows from what it measures (#60) - The worker serves `/ping` as a static asset, which Cloudflare does not count against the free plan's 100,000 requests a day. About 35 of a test's 150 requests are pings, so the same quota now covers about 30% more tests, with no extension update. An A/B test on 2026-11-21 showed the same ping times. Downloads stay on the Worker: as static assets, each request waited about 180 ms longer for its first byte diff --git a/RESOURCES-AND-GUIDE.md b/RESOURCES-AND-GUIDE.md index f72d8f0..4354522 100644 --- a/RESOURCES-AND-GUIDE.md +++ b/RESOURCES-AND-GUIDE.md @@ -8,7 +8,7 @@ Every link for MeterX, what it is for, and how to run, package and release it. P - Code: https://github.com/ajithakdev/meterx (was `meterx-server`; GitHub redirects the old URL) - `npm run build`, `npm test`, `npm run lint` from the root; `npm run package` writes the store uploads to `release/`. - Releases are weekly on Sunday: tag, GitHub release, `wrangler deploy` for the worker, store uploads, site deploy. -- Default test server: https://meterx-speedtest.meterx-ajithakdev.workers.dev +- Default test server: https://meterx-api.ajithakdev.com ## Links and what each one is for @@ -24,7 +24,7 @@ Every link for MeterX, what it is for, and how to run, package and release it. P | https://addons.mozilla.org/firefox/addon/meterx-by-ajithakdev/ | Firefox listing (add-on id `meterx@ajithakdev`), 2027.0.1 live since 2026-10-27 | | https://microsoftedge.microsoft.com/addons/detail/glkpolbkpachomgmmhdkmjnghejbhlfc | Microsoft Edge listing (2027.0.1 in review from 2026-10-27) | | Opera Add-ons | Not public yet: 2027.0.1 awaiting moderation (slug `meterx-by-ajithakdev-2`). Add the link to `apps/site/src/stores.ts` and the README once it's public | -| https://meterx-speedtest.meterx-ajithakdev.workers.dev | Default test server (Cloudflare Worker) | +| https://meterx-api.ajithakdev.com | Default test server (Cloudflare Worker) | ### Behind the scenes diff --git a/apps/extension/static/manifest.json b/apps/extension/static/manifest.json index 834b872..e9fe456 100644 --- a/apps/extension/static/manifest.json +++ b/apps/extension/static/manifest.json @@ -10,7 +10,7 @@ "sidePanel" ], "host_permissions": [ - "https://meterx-speedtest.meterx-ajithakdev.workers.dev/*" + "https://meterx-api.ajithakdev.com/*" ], "optional_host_permissions": [ "https://*/*", diff --git a/apps/site/static/_headers b/apps/site/static/_headers index 646050e..24e4d56 100644 --- a/apps/site/static/_headers +++ b/apps/site/static/_headers @@ -2,7 +2,7 @@ X-Content-Type-Options: nosniff Referrer-Policy: strict-origin-when-cross-origin Permissions-Policy: camera=(), microphone=(), geolocation=(), interest-cohort=() - Content-Security-Policy: default-src 'self'; connect-src 'self' https://meterx-speedtest.meterx-ajithakdev.workers.dev https://api.github.com; img-src 'self' data: https://avatars.githubusercontent.com; style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self'; frame-ancestors 'self'; base-uri 'none'; form-action 'none' + Content-Security-Policy: default-src 'self'; connect-src 'self' https://meterx-api.ajithakdev.com https://api.github.com; img-src 'self' data: https://avatars.githubusercontent.com; style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self'; frame-ancestors 'self'; base-uri 'none'; form-action 'none' Strict-Transport-Security: max-age=31536000 /fonts/* diff --git a/docs/STORE-CHECKLIST.md b/docs/STORE-CHECKLIST.md index d7cbb21..37e4281 100644 --- a/docs/STORE-CHECKLIST.md +++ b/docs/STORE-CHECKLIST.md @@ -54,7 +54,7 @@ In each browser: | Secure transport | Default server is https. Plain http only for localhost, 127.0.0.1 and `.local` | `validateServerUrl` unchanged or still tested | | Data and privacy | No personal data collected. Results stay in browser storage. The test server sees the IP address, as any server does, and keeps no logs. Shares put the result in the link itself | Privacy policy at `https://meterx.ajithakdev.com/privacy/` still matches what the code does | | Listing is accurate | Description lists every feature, including scheduled tests and notifications | Screenshots show the current UI, not an old version | -| Works for the reviewer | No account needed. The worker must be up | `curl https://meterx-speedtest.meterx-ajithakdev.workers.dev/health` returns the new version | +| Works for the reviewer | No account needed. The worker must be up | `curl https://meterx-api.ajithakdev.com/health` returns the new version | | Name and trademarks | "MeterX by ajithakdev". No store or browser name in the extension name | Never add "for Chrome", "Opera" or "Edge" to the name | ## 4. Microsoft Edge Add-ons @@ -110,7 +110,7 @@ MeterX is an internet speed test. No account or login is needed. To test: click the toolbar icon and press Run test. The test takes about 20 seconds and measures download, upload, ping, jitter, packet loss and latency under load against -our test server (https://meterx-speedtest.meterx-ajithakdev.workers.dev), which +our test server (https://meterx-api.ajithakdev.com), which streams bytes and stores nothing. Open the side panel from the popup to see history and exports (PDF, CSV, JSON). diff --git a/docs/STORE-LISTINGS.md b/docs/STORE-LISTINGS.md index b120567..0b09931 100644 --- a/docs/STORE-LISTINGS.md +++ b/docs/STORE-LISTINGS.md @@ -121,7 +121,7 @@ Privacy tab: | alarms | Runs scheduled tests every 30 minutes, every 2 hours or once a day, only if you turn a schedule on in settings. Off by default. | | notifications | Shows a notice when a scheduled test finds that connection quality has dropped to Poor, only if you turn it on in settings. Off by default. | | sidePanel | Opens the history view (past results, trend chart, plan comparison and exports) in the side panel. | -| Host permission | `https://meterx-speedtest.meterx-ajithakdev.workers.dev/*` is MeterX's own test server: the extension downloads and uploads test data to it to measure speed, and reads its timing headers. The optional `https://*/*`, localhost, 127.0.0.1 and `.local` patterns are requested at runtime only when you enter your own test server in settings, and only for that one server. | +| Host permission | `https://meterx-api.ajithakdev.com/*` is MeterX's own test server: the extension downloads and uploads test data to it to measure speed, and reads its timing headers. The optional `https://*/*`, localhost, 127.0.0.1 and `.local` patterns are requested at runtime only when you enter your own test server in settings, and only for that one server. | | Remote code | No, I am not using remote code. Leave the justification empty. | | Data usage | Tick nothing. MeterX collects none of the listed data: results stay in the browser, and the test server stores nothing. | | Privacy policy URL | `https://meterx.ajithakdev.com/privacy/` | @@ -190,7 +190,7 @@ Compatibility: Firefox only. Leave Firefox for Android unticked until it is test Notes to reviewer (used for 2027.0.1): ```text -No account needed. Click the toolbar icon and press Run test; it takes about 20 seconds. Tests run against our own server (meterx-speedtest.meterx-ajithakdev.workers.dev), which streams test data and stores nothing. The sidebar, opened from the popup, shows history and exports. +No account needed. Click the toolbar icon and press Run test; it takes about 20 seconds. Tests run against our own server (meterx-api.ajithakdev.com), which streams test data and stores nothing. The sidebar, opened from the popup, shows history and exports. Build: Linux, Node 24, npm 11. From the root of the source zip, run "npm ci && npm run package". It writes release/meterx--firefox.zip, identical to this upload. All dependencies come from npm via package-lock.json. The code is bundled with esbuild, not minified. diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 2807fef..0c7671b 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -17,7 +17,7 @@ export const TEST_FILE_RE = /^(1|5|10|25)MB\.bin$/; export const MAX_UPLOAD_BYTES = 16 * 1024 * 1024; /** The default test server. Also listed in the extension's manifest host_permissions and the site's CSP; change all three together. */ -export const WORKER_URL = 'https://meterx-speedtest.meterx-ajithakdev.workers.dev'; +export const WORKER_URL = 'https://meterx-api.ajithakdev.com'; /** The product site, which runs a short in-page test against the worker. */ export const SITE_ORIGIN = 'https://meterx.ajithakdev.com'; diff --git a/services/worker/wrangler.toml b/services/worker/wrangler.toml index 14ba619..c63a354 100644 --- a/services/worker/wrangler.toml +++ b/services/worker/wrangler.toml @@ -2,6 +2,11 @@ name = "meterx-speedtest" main = "src/index.ts" compatibility_date = "2025-03-14" +# Default test server. The zone has HTTP/3 off: Chrome uploads over QUIC stalled on Jio (2026-11-21). +# workers.dev stays on so installs from before 2027.0.3 keep working. +routes = [{ pattern = "meterx-api.ajithakdev.com", custom_domain = true }] +workers_dev = true + # /ping is a static asset (public/ping): free, unlimited, never a Worker request, same latency in an A/B test. # Downloads stay on the Worker: static assets added about 180 ms to each request's first byte (2026-11-21). [assets] From 1cae3a7a2b6ab714b9f51aa190c9dc5ff5e214e8 Mon Sep 17 00:00:00 2001 From: ajithakdev Date: Sat, 21 Nov 2026 21:10:15 +0530 Subject: [PATCH 5/8] docs: record HTTP/3 off and the fast-line upload gap (#104) --- docs/KNOWN-ISSUES.md | 1 + docs/STATE.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/KNOWN-ISSUES.md b/docs/KNOWN-ISSUES.md index e1d5057..822ef1a 100644 --- a/docs/KNOWN-ISSUES.md +++ b/docs/KNOWN-ISSUES.md @@ -8,6 +8,7 @@ The 33 issues from the 2026-10-22 code scan were checked against `main` on 2026- | Issue | Severity | Summary | | --- | --- | --- | +| #104 | Med | Upload reads about half of the real speed on fast lines (curl 55 to 66 Mbps, extension 14 to 45); also on `main` | | #97 | Med | Results from private windows are saved to history (Firefox policy: must not store private-browsing data) | | #68 | Low | The settings page's Test button and Save don't normalize a custom server URL with a trailing slash | | #21 | Low | The background listens for a `run-test` shortcut, but the manifest declares no `commands` | diff --git a/docs/STATE.md b/docs/STATE.md index c591040..bfe7496 100644 --- a/docs/STATE.md +++ b/docs/STATE.md @@ -8,7 +8,7 @@ Update this file at the end of each work session. Keep it short. Delete entries Feature and UI work is frozen (bug fixes only) until about 2026-12-06. The pitch becomes "log your speed and prove it to your ISP". Plan and decision rule: see the MeterX section of `~/.claude/launch-log.md`. Under about 100 active installs by then means maintenance mode. -Backend before promotion (branch `feat/static-test-files`): the free Worker plan allows 100,000 requests a day and a test makes about 150 (roughly 1 `/ip`, 35 pings, 10 to 20 downloads, 96 uploads), so about 660 tests a day for everyone. Done on the branch: `/ping` is a static asset (free, unlimited; same latency in a production A/B). Tried and rejected: downloads as static assets (about 180 ms more time to first byte per request, so lower results). Also done: upload bodies start at 256 KB and each stream resizes from its last request toward about 1 s (`nextUploadChunk`). This also fixed uploads on lopsided lines: on Jio (124 down, about 4 up) `main` failed 2 of 3 runs with "No data reached the server", the branch read 3.1 to 3.6 Mbps against curl's 3.6 to 4.2 (Node A/B of `runTest`, 2026-11-21). Not tested yet: request count and accuracy on a fast symmetric line. Deferred: a 429 fallback to `speed.cloudflare.com` (needs a new host permission and has no published terms; add only if traffic nears the quota). Next feature (2027.1.0): opt-in outage monitor, probes of the static `/ping` every 30 s, sleep and closed browser shown as not monitored, PDF and CSV outage report. Rejected as backends: M-Lab (4 automated tests a day, publishes IPs), Ookla, fast.com, volunteer LibreSpeed servers, Oracle Always Free (stopping idle reclaim needs Pay As You Go, which has no hard spending cap). +Backend before promotion (branch `feat/static-test-files`): the free Worker plan allows 100,000 requests a day and a test makes about 150 (roughly 1 `/ip`, 35 pings, 10 to 20 downloads, 96 uploads), so about 660 tests a day for everyone. Done on the branch: `/ping` is a static asset (free, unlimited; same latency in a production A/B). Tried and rejected: downloads as static assets (about 180 ms more time to first byte per request, so lower results). Also done: upload bodies start at 256 KB and each stream resizes from its last request toward about 1 s (`nextUploadChunk`). This also fixed uploads on lopsided lines: on Jio (124 down, about 4 up) `main` failed 2 of 3 runs with "No data reached the server", the branch read 3.1 to 3.6 Mbps against curl's 3.6 to 4.2 (Node A/B of `runTest`, 2026-11-21). HTTP/3 is off for the `ajithakdev.com` zone (2026-11-21, so no `alt-svc: h3`). With QUIC allowed in headless Chromium, the branch's extension finished 3 of 3 tests with no errors. On a faster line (about 64 down, curl 55 to 66 up) both `main` and the branch under-read upload (#104; branch median 33, `main` 26), so the branch is no regression. Not tested yet: request count per test. Deferred: a 429 fallback to `speed.cloudflare.com` (needs a new host permission and has no published terms; add only if traffic nears the quota). Next feature (2027.1.0): opt-in outage monitor, probes of the static `/ping` every 30 s, sleep and closed browser shown as not monitored, PDF and CSV outage report. Rejected as backends: M-Lab (4 automated tests a day, publishes IPs), Ookla, fast.com, volunteer LibreSpeed servers, Oracle Always Free (stopping idle reclaim needs Pay As You Go, which has no hard spending cap). ## In progress (2026-10-27) From b729142dcbd8fe736ee805b8c01f5ae6a2414d9c Mon Sep 17 00:00:00 2001 From: ajithakdev Date: Sat, 21 Nov 2026 21:46:52 +0530 Subject: [PATCH 6/8] fix(extension): upload over HTTP/3 first and fall back to HTTP/2 when a request stalls (#104) --- CHANGELOG.md | 1 + CLAUDE.md | 2 +- RESOURCES-AND-GUIDE.md | 3 +- apps/extension/src/background/runner.ts | 48 ++++++++++++++++++------- apps/extension/static/manifest.json | 3 +- docs/KNOWN-ISSUES.md | 2 +- docs/STATE.md | 2 +- docs/STORE-LISTINGS.md | 2 +- packages/shared/src/index.ts | 2 ++ 9 files changed, 47 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31c22be..e68a1a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to MeterX are documented here. The format follows [Keep a Ch ### Fixed - Chrome and Edge uploads stalled on some networks (seen on Jio): Chrome used HTTP/3 to the test server, and uploads over it hung until the test gave up. The default test server is now `meterx-api.ajithakdev.com`, served without HTTP/3. The extension asks for access to the new address once; the old `workers.dev` address keeps working for older versions +- Upload read about half of the real speed in Chrome on fast lines (BSNL 60/60: 14 to 29 Mbps against curl's 55 to 66), because Chrome sends uploads over HTTP/2 slowly. Uploads now go to the worker's `workers.dev` address over HTTP/3 and read 53 to 66 Mbps on the same line. If any upload request there fails or stays open over 3 s, as on Jio, the upload phase starts again on `meterx-api.ajithakdev.com` (#104) - Upload read far too low, or failed with "No data reached the server", on lines with a much slower upload than download (for example Jio 5G: 124 Mbps down, about 4 up). The first upload body was sized from the download speed and could not finish in time; every stream now starts at 256 KB and grows from what it measures (#60) - The worker serves `/ping` as a static asset, which Cloudflare does not count against the free plan's 100,000 requests a day. About 35 of a test's 150 requests are pings, so the same quota now covers about 30% more tests, with no extension update. An A/B test on 2026-11-21 showed the same ping times. Downloads stay on the Worker: as static assets, each request waited about 180 ms longer for its first byte diff --git a/CLAUDE.md b/CLAUDE.md index f1fcf9a..8a717d0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -60,6 +60,6 @@ Custom server URLs need a runtime host-permission grant (`optional_host_permissi - The version lives only in the root `package.json`. `@meterx/shared` exports it as `VERSION` (used by `/health`, the exports and the settings footer), and `build.mjs` stamps it into `dist/manifest.json`, so it must be 1 to 4 dot-separated numbers. Bump that one line to release. - `manifest.json` description must stay within the store's 132-character limit. -- Store packages: Chromium stores share one zip; Firefox gets a converted manifest (sidebar, background script, id `meterx@ajithakdev`). The default worker URL is `WORKER_URL` in shared, and also sits in `host_permissions` in the extension's `static/manifest.json` and the site's `static/_headers` CSP; change all three together. +- Store packages: Chromium stores share one zip; Firefox gets a converted manifest (sidebar, background script, id `meterx@ajithakdev`). The default worker URL is `WORKER_URL` in shared, and also sits in `host_permissions` in the extension's `static/manifest.json` and the site's `static/_headers` CSP; change all three together. `WORKER_H3_URL` (the same worker on workers.dev, which keeps HTTP/3) is where uploads go first; it is in `host_permissions` too, and the site never uploads so its CSP leaves it out. - Nothing deploys on merge. The worker (`wrangler deploy`), the site (Pages direct upload, not git-connected) and the stores are released by hand on Sunday, so docs-only merges are just merges. - License is AGPL-3.0; see `TRADEMARK.md` before touching branding. diff --git a/RESOURCES-AND-GUIDE.md b/RESOURCES-AND-GUIDE.md index 4354522..9463994 100644 --- a/RESOURCES-AND-GUIDE.md +++ b/RESOURCES-AND-GUIDE.md @@ -24,7 +24,8 @@ Every link for MeterX, what it is for, and how to run, package and release it. P | https://addons.mozilla.org/firefox/addon/meterx-by-ajithakdev/ | Firefox listing (add-on id `meterx@ajithakdev`), 2027.0.1 live since 2026-10-27 | | https://microsoftedge.microsoft.com/addons/detail/glkpolbkpachomgmmhdkmjnghejbhlfc | Microsoft Edge listing (2027.0.1 in review from 2026-10-27) | | Opera Add-ons | Not public yet: 2027.0.1 awaiting moderation (slug `meterx-by-ajithakdev-2`). Add the link to `apps/site/src/stores.ts` and the README once it's public | -| https://meterx-api.ajithakdev.com | Default test server (Cloudflare Worker) | +| https://meterx-api.ajithakdev.com | Default test server (Cloudflare Worker), HTTP/2 only | +| https://meterx-speedtest.meterx-ajithakdev.workers.dev | Same worker with HTTP/3: uploads go here first and fall back to meterx-api if a request stalls | ### Behind the scenes diff --git a/apps/extension/src/background/runner.ts b/apps/extension/src/background/runner.ts index 7a4cdd5..f4fc4c5 100644 --- a/apps/extension/src/background/runner.ts +++ b/apps/extension/src/background/runner.ts @@ -7,7 +7,7 @@ /// -import type { IpInfo, TestProgress, TestResults } from '@meterx/shared'; +import { WORKER_H3_URL, WORKER_URL, type IpInfo, type TestProgress, type TestResults } from '@meterx/shared'; import { type ByteSample, backoffMs, bytesAtTime, gradeBufferbloat, latencyStats, median, nextUploadChunk, steadyMbps, toMbps, MAX_UPLOAD_CHUNK, MIN_UPLOAD_CHUNK, @@ -16,6 +16,8 @@ import { const DOWNLOAD_PATH = '/test-file/25MB.bin'; const DOWNLOAD_STREAMS = 4; const UPLOAD_STREAMS = 3; +/** Bodies aim at about 1 s, so a request still open after 3 s has stalled. A line under about 0.7 Mbps up also trips it, harmlessly. */ +const UPLOAD_STALL_MS = 3000; // Multi-stream, fixed-duration phases (the M-Lab / Ookla approach). // The worker and Express rate limits are sized for this burst; raise them if you add streams. const MEASURE_DURATION_MS = 8000; @@ -200,23 +202,45 @@ export async function runTest(baseUrl: string, signal: AbortSignal, report: Repo report({ phase: 'upload', status: 'Testing upload' }); const payload = new Uint8Array(MAX_UPLOAD_CHUNK); - // Each stream starts small and resizes its body from its own last request (see nextUploadChunk). - const chunkOf: number[] = Array(UPLOAD_STREAMS).fill(MIN_UPLOAD_CHUNK); - stopProbe = startLoadedProbe(baseUrl, signal); - try { - results.uploadSpeed = await runStreams(signal, UPLOAD_STREAMS, async (s, credit, stream) => { + const upload = (base: string, stallMs?: number) => { + // Each stream starts small and resizes its body from its own last request (see nextUploadChunk). + const chunkOf: number[] = Array(UPLOAD_STREAMS).fill(MIN_UPLOAD_CHUNK); + const stalled = new AbortController(); + return runStreams(AbortSignal.any([signal, stalled.signal]), UPLOAD_STREAMS, async (s, credit, stream) => { const body = payload.subarray(0, chunkOf[stream]); const t0 = performance.now(); - const res = await fetch(bust(`${baseUrl}/upload`, 'u'), { - method: 'POST', cache: 'no-store', signal: s, - headers: { 'Content-Type': 'application/octet-stream' }, body, - }); - if (!res.ok) throw new HttpError(res.status); - await res.arrayBuffer(); + try { + const res = await fetch(bust(`${base}/upload`, 'u'), { + method: 'POST', cache: 'no-store', + signal: stallMs ? AbortSignal.any([s, AbortSignal.timeout(stallMs)]) : s, + headers: { 'Content-Type': 'application/octet-stream' }, body, + }); + if (!res.ok) throw new HttpError(res.status); + await res.arrayBuffer(); + } catch (e) { + if (stallMs && !s.aborted) stalled.abort(); + throw e; + } // fetch() has no upload progress, so bytes count when each body completes. credit(body.byteLength); chunkOf[stream] = nextUploadChunk(body.byteLength, performance.now() - t0); }, mbps => report({ phase: 'upload', uploadSpeed: mbps })); + }; + stopProbe = startLoadedProbe(baseUrl, signal); + try { + // Chrome uploads over HTTP/2 read about half of a fast line, and over HTTP/3 they stall on some + // networks (Jio). The default server's uploads try its HTTP/3 address first; if any request there + // fails or takes over UPLOAD_STALL_MS, the phase starts again on the HTTP/2 address (#104). + if (baseUrl === WORKER_URL) { + try { + results.uploadSpeed = await upload(WORKER_H3_URL, UPLOAD_STALL_MS); + } catch (e) { + if (signal.aborted) throw e; + results.uploadSpeed = await upload(baseUrl); + } + } else { + results.uploadSpeed = await upload(baseUrl); + } } finally { results.loadedPingUp = await stopProbe(); } diff --git a/apps/extension/static/manifest.json b/apps/extension/static/manifest.json index e9fe456..d0d5e7b 100644 --- a/apps/extension/static/manifest.json +++ b/apps/extension/static/manifest.json @@ -10,7 +10,8 @@ "sidePanel" ], "host_permissions": [ - "https://meterx-api.ajithakdev.com/*" + "https://meterx-api.ajithakdev.com/*", + "https://meterx-speedtest.meterx-ajithakdev.workers.dev/*" ], "optional_host_permissions": [ "https://*/*", diff --git a/docs/KNOWN-ISSUES.md b/docs/KNOWN-ISSUES.md index 822ef1a..3d6a33b 100644 --- a/docs/KNOWN-ISSUES.md +++ b/docs/KNOWN-ISSUES.md @@ -8,7 +8,7 @@ The 33 issues from the 2026-10-22 code scan were checked against `main` on 2026- | Issue | Severity | Summary | | --- | --- | --- | -| #104 | Med | Upload reads about half of the real speed on fast lines (curl 55 to 66 Mbps, extension 14 to 45); also on `main` | +| #104 | Low | Chrome uploads over HTTP/2 read about half of a fast line. Fixed for the default server by uploading over HTTP/3 first (PR #105); still applies after a fallback and to custom servers | | #97 | Med | Results from private windows are saved to history (Firefox policy: must not store private-browsing data) | | #68 | Low | The settings page's Test button and Save don't normalize a custom server URL with a trailing slash | | #21 | Low | The background listens for a `run-test` shortcut, but the manifest declares no `commands` | diff --git a/docs/STATE.md b/docs/STATE.md index bfe7496..d8c517d 100644 --- a/docs/STATE.md +++ b/docs/STATE.md @@ -8,7 +8,7 @@ Update this file at the end of each work session. Keep it short. Delete entries Feature and UI work is frozen (bug fixes only) until about 2026-12-06. The pitch becomes "log your speed and prove it to your ISP". Plan and decision rule: see the MeterX section of `~/.claude/launch-log.md`. Under about 100 active installs by then means maintenance mode. -Backend before promotion (branch `feat/static-test-files`): the free Worker plan allows 100,000 requests a day and a test makes about 150 (roughly 1 `/ip`, 35 pings, 10 to 20 downloads, 96 uploads), so about 660 tests a day for everyone. Done on the branch: `/ping` is a static asset (free, unlimited; same latency in a production A/B). Tried and rejected: downloads as static assets (about 180 ms more time to first byte per request, so lower results). Also done: upload bodies start at 256 KB and each stream resizes from its last request toward about 1 s (`nextUploadChunk`). This also fixed uploads on lopsided lines: on Jio (124 down, about 4 up) `main` failed 2 of 3 runs with "No data reached the server", the branch read 3.1 to 3.6 Mbps against curl's 3.6 to 4.2 (Node A/B of `runTest`, 2026-11-21). HTTP/3 is off for the `ajithakdev.com` zone (2026-11-21, so no `alt-svc: h3`). With QUIC allowed in headless Chromium, the branch's extension finished 3 of 3 tests with no errors. On a faster line (about 64 down, curl 55 to 66 up) both `main` and the branch under-read upload (#104; branch median 33, `main` 26), so the branch is no regression. Not tested yet: request count per test. Deferred: a 429 fallback to `speed.cloudflare.com` (needs a new host permission and has no published terms; add only if traffic nears the quota). Next feature (2027.1.0): opt-in outage monitor, probes of the static `/ping` every 30 s, sleep and closed browser shown as not monitored, PDF and CSV outage report. Rejected as backends: M-Lab (4 automated tests a day, publishes IPs), Ookla, fast.com, volunteer LibreSpeed servers, Oracle Always Free (stopping idle reclaim needs Pay As You Go, which has no hard spending cap). +Backend before promotion (branch `feat/static-test-files`): the free Worker plan allows 100,000 requests a day and a test makes about 150 (roughly 1 `/ip`, 35 pings, 10 to 20 downloads, 96 uploads), so about 660 tests a day for everyone. Done on the branch: `/ping` is a static asset (free, unlimited; same latency in a production A/B). Tried and rejected: downloads as static assets (about 180 ms more time to first byte per request, so lower results). Also done: upload bodies start at 256 KB and each stream resizes from its last request toward about 1 s (`nextUploadChunk`). This also fixed uploads on lopsided lines: on Jio (124 down, about 4 up) `main` failed 2 of 3 runs with "No data reached the server", the branch read 3.1 to 3.6 Mbps against curl's 3.6 to 4.2 (Node A/B of `runTest`, 2026-11-21). HTTP/3 is off for the `ajithakdev.com` zone (2026-11-21, so no `alt-svc: h3`). With QUIC allowed in headless Chromium, the branch's extension finished 3 of 3 tests with no errors. On BSNL FTTH 60/60, Chrome's HTTP/2 uploads read about half (median 20 to 29 against curl's 55 to 66, worse the longer the connection lives; curl's HTTP/2 does not slow down), while HTTP/3 to `workers.dev` read 54 to 66. So uploads now go to `WORKER_H3_URL` first, and any request there that fails or passes 3 s restarts the phase on `meterx-api` (#104). Headless Chromium: 65.9, 57.9, 52.6 Mbps up; with workers.dev uploads forced to hang, every test fell back and finished, about 3 s longer. A test makes about 70 requests (1 `/ip`, about 37 pings, 5 to 6 downloads, about 27 uploads), all on the same worker and quota. Not yet re-tested on Jio with the fallback. Deferred: a 429 fallback to `speed.cloudflare.com` (needs a new host permission and has no published terms; add only if traffic nears the quota). Next feature (2027.1.0): opt-in outage monitor, probes of the static `/ping` every 30 s, sleep and closed browser shown as not monitored, PDF and CSV outage report. Rejected as backends: M-Lab (4 automated tests a day, publishes IPs), Ookla, fast.com, volunteer LibreSpeed servers, Oracle Always Free (stopping idle reclaim needs Pay As You Go, which has no hard spending cap). ## In progress (2026-10-27) diff --git a/docs/STORE-LISTINGS.md b/docs/STORE-LISTINGS.md index 0b09931..32304e0 100644 --- a/docs/STORE-LISTINGS.md +++ b/docs/STORE-LISTINGS.md @@ -121,7 +121,7 @@ Privacy tab: | alarms | Runs scheduled tests every 30 minutes, every 2 hours or once a day, only if you turn a schedule on in settings. Off by default. | | notifications | Shows a notice when a scheduled test finds that connection quality has dropped to Poor, only if you turn it on in settings. Off by default. | | sidePanel | Opens the history view (past results, trend chart, plan comparison and exports) in the side panel. | -| Host permission | `https://meterx-api.ajithakdev.com/*` is MeterX's own test server: the extension downloads and uploads test data to it to measure speed, and reads its timing headers. The optional `https://*/*`, localhost, 127.0.0.1 and `.local` patterns are requested at runtime only when you enter your own test server in settings, and only for that one server. | +| Host permission | `https://meterx-api.ajithakdev.com/*` and `https://meterx-speedtest.meterx-ajithakdev.workers.dev/*` are MeterX's own test server (one Cloudflare Worker at two addresses; uploads use the second, which supports HTTP/3): the extension downloads and uploads test data to it to measure speed, and reads its timing headers. The optional `https://*/*`, localhost, 127.0.0.1 and `.local` patterns are requested at runtime only when you enter your own test server in settings, and only for that one server. | | Remote code | No, I am not using remote code. Leave the justification empty. | | Data usage | Tick nothing. MeterX collects none of the listed data: results stay in the browser, and the test server stores nothing. | | Privacy policy URL | `https://meterx.ajithakdev.com/privacy/` | diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 0c7671b..14a193b 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -18,6 +18,8 @@ export const MAX_UPLOAD_BYTES = 16 * 1024 * 1024; /** The default test server. Also listed in the extension's manifest host_permissions and the site's CSP; change all three together. */ export const WORKER_URL = 'https://meterx-api.ajithakdev.com'; +/** The same worker on workers.dev, which keeps HTTP/3. The extension uploads there first (runner.ts) and lists it in host_permissions. */ +export const WORKER_H3_URL = 'https://meterx-speedtest.meterx-ajithakdev.workers.dev'; /** The product site, which runs a short in-page test against the worker. */ export const SITE_ORIGIN = 'https://meterx.ajithakdev.com'; From 06b89dfe83bbc7c236cfb9d04964e36862174560 Mon Sep 17 00:00:00 2001 From: ajithakdev Date: Sat, 21 Nov 2026 22:26:18 +0530 Subject: [PATCH 7/8] docs: record #97 and #68 fixes in STATE --- docs/STATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/STATE.md b/docs/STATE.md index d8c517d..fff0b84 100644 --- a/docs/STATE.md +++ b/docs/STATE.md @@ -1,6 +1,6 @@ # MeterX working state -Last updated: 2026-10-31, on `main` after the 2027.0.2 worker release. +Last updated: 2026-11-21, on `feat/static-test-files` (PR #105). Update this file at the end of each work session. Keep it short. Delete entries once they are done and merged. @@ -18,7 +18,7 @@ Next: 1. Store reviews: Edge and Opera 2027.0.1 submitted 2026-10-27 (Firefox approved the same day). Delete the old never-published Opera entry (slug `meterx-by-ajithakdev`) if it still exists. Chrome Web Store needs a paid developer fee, so it waits for the owner's call. 2. Opera listing link into `apps/site/src/stores.ts` and the README once it is public. 3. SEO one-time setup in `docs/SEO.md` (Search Console sitemap, Bing), portfolio entry. -4. Milestone 2027.1.0 (Sunday): #97 private-window history, #99 Firefox for Android, #68 settings URL, #21 shortcut. In the same release, add "appearance" to the settings list on the site privacy page (`apps/site/static/privacy/index.html`) and bump its date; the AMO copy already has it. +4. #97 (private-window history, detected with `windows.getCurrent`) and #68 (settings URL trailing slash) are fixed on `main` (2026-11-21) and ship in the next release. Still open for 2027.1.0: #99 Firefox for Android, #21 keyboard shortcuts (a feature). In the same release, add "appearance" to the settings list on the site privacy page (`apps/site/static/privacy/index.html`) and bump its date; the AMO copy already has it. 5. Issues triaged 2026-10-27: the scan's 31 fixed bugs and 7 shipped features are closed with evidence; 48 open, status comments on the partial ones (#13, #19, #54, #95). ## Releases From f018ce8dee08d72ea712d13631f861d435508407 Mon Sep 17 00:00:00 2001 From: ajithakdev Date: Wed, 25 Nov 2026 01:50:44 +0530 Subject: [PATCH 8/8] fix(extension): only a stream's first HTTP/3 upload can trigger the fallback, and test it A single slow request later in the phase (a Wi-Fi dip on a fast line) used to throw away the HTTP/3 run and restart on HTTP/2, the path that under-reads. runner.test.ts covers stall, error, slow-later-request and cancel with a fake clock and fetch; the slow-later-request case fails on the old rule. --- CHANGELOG.md | 2 +- RESOURCES-AND-GUIDE.md | 2 +- apps/extension/src/background/runner.test.ts | 89 ++++++++++++++++++++ apps/extension/src/background/runner.ts | 8 +- 4 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 apps/extension/src/background/runner.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dd3daf..345f4b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ All notable changes to MeterX are documented here. The format follows [Keep a Ch ### Fixed - Tests run from a private or incognito window are no longer saved to history; the result still shows (#97) - Chrome and Edge uploads stalled on some networks (seen on Jio): Chrome used HTTP/3 to the test server, and uploads over it hung until the test gave up. The default test server is now `meterx-api.ajithakdev.com`, served without HTTP/3. The extension asks for access to the new address once; the old `workers.dev` address keeps working for older versions -- Upload read about half of the real speed in Chrome on fast lines (BSNL 60/60: 14 to 29 Mbps against curl's 55 to 66), because Chrome sends uploads over HTTP/2 slowly. Uploads now go to the worker's `workers.dev` address over HTTP/3 and read 53 to 66 Mbps on the same line. If any upload request there fails or stays open over 3 s, as on Jio, the upload phase starts again on `meterx-api.ajithakdev.com` (#104) +- Upload read about half of the real speed in Chrome on fast lines (BSNL 60/60: 14 to 29 Mbps against curl's 55 to 66), because Chrome sends uploads over HTTP/2 slowly. Uploads now go to the worker's `workers.dev` address over HTTP/3 and read 53 to 66 Mbps on the same line. If an upload request there fails, or a stream's first upload stays open over 3 s as on Jio, the upload phase starts again on `meterx-api.ajithakdev.com` (#104) - Upload read far too low, or failed with "No data reached the server", on lines with a much slower upload than download (for example Jio 5G: 124 Mbps down, about 4 up). The first upload body was sized from the download speed and could not finish in time; every stream now starts at 256 KB and grows from what it measures (#60) - The worker serves `/ping` as a static asset, which Cloudflare does not count against the free plan's 100,000 requests a day. About 35 of a test's 150 requests are pings, so the same quota now covers about 30% more tests, with no extension update. An A/B test on 2026-11-21 showed the same ping times. Downloads stay on the Worker: as static assets, each request waited about 180 ms longer for its first byte - A custom server URL typed with a trailing slash (`https://host/`) failed every test with 404s; Settings now tidies it before testing and saving (#68) diff --git a/RESOURCES-AND-GUIDE.md b/RESOURCES-AND-GUIDE.md index 9463994..3a41de8 100644 --- a/RESOURCES-AND-GUIDE.md +++ b/RESOURCES-AND-GUIDE.md @@ -25,7 +25,7 @@ Every link for MeterX, what it is for, and how to run, package and release it. P | https://microsoftedge.microsoft.com/addons/detail/glkpolbkpachomgmmhdkmjnghejbhlfc | Microsoft Edge listing (2027.0.1 in review from 2026-10-27) | | Opera Add-ons | Not public yet: 2027.0.1 awaiting moderation (slug `meterx-by-ajithakdev-2`). Add the link to `apps/site/src/stores.ts` and the README once it's public | | https://meterx-api.ajithakdev.com | Default test server (Cloudflare Worker), HTTP/2 only | -| https://meterx-speedtest.meterx-ajithakdev.workers.dev | Same worker with HTTP/3: uploads go here first and fall back to meterx-api if a request stalls | +| https://meterx-speedtest.meterx-ajithakdev.workers.dev | Same worker with HTTP/3: uploads go here first and fall back to meterx-api if a request fails or the first one stalls | ### Behind the scenes diff --git a/apps/extension/src/background/runner.test.ts b/apps/extension/src/background/runner.test.ts new file mode 100644 index 0000000..e1a7624 --- /dev/null +++ b/apps/extension/src/background/runner.test.ts @@ -0,0 +1,89 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { WORKER_H3_URL, WORKER_URL } from '@meterx/shared'; +import { CancelledError, runTest } from './runner'; + +// Fake clock and fetch: every request settles after a fake delay, so a whole test runs in milliseconds. +type UploadDelay = (h3: boolean, n: number) => number | 'hang' | 429; + +function mockServer(uploadDelay: UploadDelay) { + const uploads = { h3: 0, h2: 0 }; + vi.stubGlobal('fetch', vi.fn((url: string, init: RequestInit = {}) => { + let ms = 50; + let status = 200; + let body: BodyInit | null = null; + if (url.includes('/upload')) { + const h3 = url.startsWith(WORKER_H3_URL); + const d = uploadDelay(h3, h3 ? ++uploads.h3 : ++uploads.h2); + if (d === 429) status = 429; + else ms = d === 'hang' ? -1 : d; + } else if (url.includes('/test-file')) body = new Uint8Array(64 * 1024); + else if (url.includes('/ip')) body = '{}'; + const signal = init.signal; + return new Promise((resolve, reject) => { + if (signal?.aborted) return reject(signal.reason); + const abort = () => { clearTimeout(t); reject(signal!.reason); }; + const t = ms < 0 ? undefined : setTimeout(() => { + signal?.removeEventListener('abort', abort); + resolve(new Response(body, { status })); + }, ms); + signal?.addEventListener('abort', abort, { once: true }); + }); + })); + return uploads; +} + +beforeEach(() => { + vi.useFakeTimers(); + vi.spyOn(performance, 'now').mockImplementation(() => Date.now()); + vi.spyOn(AbortSignal, 'timeout').mockImplementation(ms => { + const c = new AbortController(); + setTimeout(() => c.abort(new DOMException('timed out', 'TimeoutError')), ms); + return c.signal; + }); +}); + +afterEach(() => { + vi.useRealTimers(); + vi.restoreAllMocks(); + vi.unstubAllGlobals(); +}); + +async function run(signal = new AbortController().signal) { + const result = runTest(WORKER_URL, signal, () => {}); + result.catch(() => {}); // awaited below; stops an unhandled-rejection warning while time advances + await vi.advanceTimersByTimeAsync(40_000); + return result; +} + +describe('upload over HTTP/3 with HTTP/2 fallback (#104)', () => { + it('falls back to the HTTP/2 address when the first HTTP/3 body stalls', async () => { + const uploads = mockServer(h3 => (h3 ? 'hang' : 200)); + const r = await run(); + expect(uploads.h2).toBeGreaterThan(0); + expect(r.uploadSpeed).toBeGreaterThan(0); + }); + + it('stays on HTTP/3 when a later request is slow', async () => { + const uploads = mockServer((h3, n) => (h3 && n > 3 ? 5000 : 200)); + const r = await run(); + expect(uploads.h2).toBe(0); + expect(r.uploadSpeed).toBeGreaterThan(0); + }); + + it('falls back when HTTP/3 answers with an error', async () => { + const uploads = mockServer(h3 => (h3 ? 429 : 200)); + const r = await run(); + expect(uploads.h2).toBeGreaterThan(0); + expect(r.uploadSpeed).toBeGreaterThan(0); + }); + + it('a cancel during the HTTP/3 attempt does not fall back', async () => { + const ctrl = new AbortController(); + const uploads = mockServer(h3 => { + if (h3) setTimeout(() => ctrl.abort(), 500); + return h3 ? 'hang' : 200; + }); + await expect(run(ctrl.signal)).rejects.toBeInstanceOf(CancelledError); + expect(uploads.h2).toBe(0); + }); +}); diff --git a/apps/extension/src/background/runner.ts b/apps/extension/src/background/runner.ts index f4fc4c5..37c2099 100644 --- a/apps/extension/src/background/runner.ts +++ b/apps/extension/src/background/runner.ts @@ -16,7 +16,7 @@ import { const DOWNLOAD_PATH = '/test-file/25MB.bin'; const DOWNLOAD_STREAMS = 4; const UPLOAD_STREAMS = 3; -/** Bodies aim at about 1 s, so a request still open after 3 s has stalled. A line under about 0.7 Mbps up also trips it, harmlessly. */ +/** A stream whose first upload is still open after 3 s has stalled (HTTP/3 on Jio). Later requests have no limit, so a brief dip can't trigger it; a stream under about 0.7 Mbps up does, harmlessly. */ const UPLOAD_STALL_MS = 3000; // Multi-stream, fixed-duration phases (the M-Lab / Ookla approach). // The worker and Express rate limits are sized for this burst; raise them if you add streams. @@ -206,13 +206,14 @@ export async function runTest(baseUrl: string, signal: AbortSignal, report: Repo // Each stream starts small and resizes its body from its own last request (see nextUploadChunk). const chunkOf: number[] = Array(UPLOAD_STREAMS).fill(MIN_UPLOAD_CHUNK); const stalled = new AbortController(); + const settled: boolean[] = Array(UPLOAD_STREAMS).fill(false); return runStreams(AbortSignal.any([signal, stalled.signal]), UPLOAD_STREAMS, async (s, credit, stream) => { const body = payload.subarray(0, chunkOf[stream]); const t0 = performance.now(); try { const res = await fetch(bust(`${base}/upload`, 'u'), { method: 'POST', cache: 'no-store', - signal: stallMs ? AbortSignal.any([s, AbortSignal.timeout(stallMs)]) : s, + signal: stallMs && !settled[stream] ? AbortSignal.any([s, AbortSignal.timeout(stallMs)]) : s, headers: { 'Content-Type': 'application/octet-stream' }, body, }); if (!res.ok) throw new HttpError(res.status); @@ -223,6 +224,7 @@ export async function runTest(baseUrl: string, signal: AbortSignal, report: Repo } // fetch() has no upload progress, so bytes count when each body completes. credit(body.byteLength); + settled[stream] = true; chunkOf[stream] = nextUploadChunk(body.byteLength, performance.now() - t0); }, mbps => report({ phase: 'upload', uploadSpeed: mbps })); }; @@ -230,7 +232,7 @@ export async function runTest(baseUrl: string, signal: AbortSignal, report: Repo try { // Chrome uploads over HTTP/2 read about half of a fast line, and over HTTP/3 they stall on some // networks (Jio). The default server's uploads try its HTTP/3 address first; if any request there - // fails or takes over UPLOAD_STALL_MS, the phase starts again on the HTTP/2 address (#104). + // fails or a stream's first body takes over UPLOAD_STALL_MS, the phase starts again on the HTTP/2 address (#104). if (baseUrl === WORKER_URL) { try { results.uploadSpeed = await upload(WORKER_H3_URL, UPLOAD_STALL_MS);