Files
Michał Pierzchała b15121ffc8 test(ios): establish snapshot convergence baselines and permanent evidence (#2204)
* test(ios): add snapshot convergence evidence harness

* fix(ios): satisfy benchmark CI guards

* fix(ios): constrain benchmark proxy routes

* fix(ios-benchmark): enforce cell admission evidence

* fix(ios-benchmark): protect benchmark state ownership

* fix(ios-benchmark): use proxy port flag

* fix(ios-benchmark): let proxy choose an ephemeral port

* test(ios-benchmark): keep CLI process seam local

* fix(ios-benchmark): parse proxy startup envelope

* fix(ios-benchmark): bind proxy lease to simulator

* fix(ios-benchmark): keep fresh proxy CLI sessions isolated

* fix(ios-benchmark): preserve async timeout evidence

* docs(ios-benchmark): retain exact-head evidence

* test(ios): reveal offscreen alert fixture controls

* test(ios): reset alert between relaunch samples

* test(ios): admit native alert snapshots

* docs(ios): publish snapshot convergence corpus

* chore(ios): format benchmark evidence

* fix(ios-benchmark): admit proxy fixture anchors

* docs(ios): republish exact-head benchmark corpus

* fix(size): make publish asset evidence hermetic

* style(size): format package evidence test

* test(size): update publish preparation contracts

* fix: retire stale utils layering zone

* test: pin shared publish asset owner

* test: verify preserved size reporter closure

* fix: move mutation ownership to snapshot module

* test(ios): add snapshot convergence evidence harness

* fix(ios): satisfy benchmark CI guards

* fix(ios): constrain benchmark proxy routes

* fix(ios-benchmark): enforce cell admission evidence

* fix(ios-benchmark): protect benchmark state ownership

* fix(ios-benchmark): use proxy port flag

* fix(ios-benchmark): let proxy choose an ephemeral port

* test(ios-benchmark): keep CLI process seam local

* fix(ios-benchmark): parse proxy startup envelope

* fix(ios-benchmark): bind proxy lease to simulator

* fix(ios-benchmark): keep fresh proxy CLI sessions isolated

* fix(ios-benchmark): preserve async timeout evidence

* docs(ios-benchmark): retain exact-head evidence

* test(ios): reveal offscreen alert fixture controls

* test(ios): reset alert between relaunch samples

* test(ios): admit native alert snapshots

* docs(ios): publish snapshot convergence corpus

* chore(ios): format benchmark evidence

* fix(ios-benchmark): admit proxy fixture anchors

* docs(ios): republish exact-head benchmark corpus

* fix(size): make publish asset evidence hermetic

* test(size): update publish preparation contracts

* fix: keep git-state gates out of mutation sandboxes
2026-09-01 21:39:05 +02:00

52 lines
1.5 KiB
TypeScript

import assert from 'node:assert/strict';
import { test } from 'vitest';
import { buildMeasurement, markOutliers, summarize } from './statistics.ts';
import type { RawSample } from './types.ts';
function sample(index: number, wallClockMs: number, ok = true): RawSample {
return {
index,
startedAt: '2026-01-01T00:00:00.000Z',
finishedAt: '2026-01-01T00:00:00.001Z',
operation: 'snapshot',
wallClockMs,
targetGeneration: 1,
firstTree: ok ? 'readable' : 'not-observed',
ok,
outlier: false,
...(ok ? {} : { failure: { category: 'timeout' as const } }),
};
}
test('summarizes successful values and uses the Tukey outlier rule', () => {
const values = [10, 11, 12, 13, 100];
assert.deepEqual(summarize(values, 1), {
n: 5,
min: 10,
median: 12,
p95: 100,
max: 100,
outlierCount: 1,
outlierRule: 'tukey-1.5-iqr',
});
assert.equal(
markOutliers(values.map((value, index) => sample(index + 1, value))).at(-1)?.outlier,
true,
);
});
test('keeps failures out of timing summaries and counts typed categories', () => {
const measurement = buildMeasurement({
transport: 'local',
execution: 'fresh-process-cli',
state: 'cold',
screen: 'quiet',
sampleMinimum: 10,
operation: 'open-foreground',
samples: [sample(1, 10), sample(2, 20, false)],
});
assert.equal(measurement.failures, 1);
assert.deepEqual(measurement.failureCategories, { timeout: 1 });
assert.equal(measurement.wallClockMs?.n, 1);
});