From f53dc7acbf9b2e335c73e65ce0069b8914d1bd39 Mon Sep 17 00:00:00 2001 From: Lann Martin Date: Fri, 7 Aug 2026 18:22:10 -0400 Subject: [PATCH] js: caller-owned report keys in the page runner; only passthrough MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Designing the three browser adoptions completed the key space: one suite runs as several targets (tls: plain and delegated compositions) and one target runs several suites (webcrypto: main and signing corpora), so neither is unique on its own — the report key belongs to the caller, defaulting to the target. The worker also forwards runCases' only filter, which it already accepted everywhere else. --- js/viewer/browser-worker.mjs | 2 ++ js/viewer/page-runner.mjs | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/js/viewer/browser-worker.mjs b/js/viewer/browser-worker.mjs index d2e8ef2..a0f7765 100644 --- a/js/viewer/browser-worker.mjs +++ b/js/viewer/browser-worker.mjs @@ -39,6 +39,7 @@ self.onmessage = async ({ data }) => { contextUrl, env = [], missing = [], + only, shard, caseTimeoutMs, } = data; @@ -67,6 +68,7 @@ self.onmessage = async ({ data }) => { Context, tagsOf, missing, + only, shard, caseTimeoutMs, emit: (event, index) => self.postMessage({ kind: "event", index, event }), diff --git a/js/viewer/page-runner.mjs b/js/viewer/page-runner.mjs index 021a24a..f525a2f 100644 --- a/js/viewer/page-runner.mjs +++ b/js/viewer/page-runner.mjs @@ -45,21 +45,23 @@ function runShard(workerUrl, config, shard, onRow) { } /** - * Run every configured suite and report, keyed by `target` — the one - * identity unique per run (several targets may run one suite, e.g. a - * plain and a delegated composition of the same corpus). `suites` - * entries carry the browser-worker run message minus `shard` + * Run every configured suite and report, keyed by each entry's `key` + * (default: its `target`). Neither `suite` nor `target` is unique on + * its own across consumers — one suite may run as several targets (a + * plain and a delegated composition), and one target may run several + * suites (a main and a signing corpus) — so the caller owns the key. + * `suites` entries carry the browser-worker run message minus `shard` * (moduleUrl, coreUrls, importsUrl, contextUrl?, env?, missing?, - * caseTimeoutMs?) plus `suite` (the results identity in the envelope) - * and `target`. `jobs` defaults to the capped hardware parallelism; - * pass 1 for sequential corpora. + * only?, caseTimeoutMs?) plus `suite` (the results identity in the + * envelope) and `target`. `jobs` defaults to the capped hardware + * parallelism; pass 1 for sequential corpora. */ export async function runSuitesInPage({ workerUrl, suites, jobs }) { const pool = jobs ?? workerCount(navigator.hardwareConcurrency ?? 4); let rows = 0; try { const out = {}; - for (const { suite, target, ...config } of suites) { + for (const { suite, target, key = target, ...config } of suites) { beat(`suite ${suite}: ${pool} workers`); const shards = await Promise.all( Array.from({ length: pool }, (_, index) => @@ -71,7 +73,7 @@ export async function runSuitesInPage({ workerUrl, suites, jobs }) { ); const events = shards.flatMap((s) => s.events); events.sort((a, b) => a.index - b.index); - out[target] = { + out[key] = { lines: [ JSON.stringify(envelope(target, suite)), ...events.map((e) => JSON.stringify(e.event)),