mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
b15121ffc8
* 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
59 lines
2.0 KiB
TypeScript
59 lines
2.0 KiB
TypeScript
import { spawnSync } from 'node:child_process';
|
|
import path from 'node:path';
|
|
import { deepButtonFixtureEvidence } from './deep-button.ts';
|
|
|
|
export class BenchmarkControlError extends Error {
|
|
readonly command?: string;
|
|
|
|
constructor(message: string, command?: string) {
|
|
super(message);
|
|
this.command = command;
|
|
}
|
|
}
|
|
|
|
export function runDeepButtonControls(repoRoot: string) {
|
|
const evidence = deepButtonFixtureEvidence();
|
|
const script = path.join(repoRoot, 'scripts', 'ios-snapshot-benchmark', 'deep-button.ts');
|
|
const invalid = runControl(repoRoot, script, 'invalid-shallow');
|
|
assertInvalidControl(invalid, evidence.invalidShallowRule.assertion);
|
|
const safe = runControl(repoRoot, script, 'safe-full');
|
|
assertSafeControl(safe);
|
|
return {
|
|
...evidence,
|
|
invalidShallowRule: { ...evidence.invalidShallowRule, exitCode: invalid.status ?? -1 },
|
|
safeFullRule: { ...evidence.safeFullRule, exitCode: safe.status ?? -1 },
|
|
};
|
|
}
|
|
|
|
function runControl(
|
|
repoRoot: string,
|
|
script: string,
|
|
rule: 'invalid-shallow' | 'safe-full',
|
|
): { status: number | null; stderr: string } {
|
|
const result = spawnSync(
|
|
process.execPath,
|
|
['--experimental-strip-types', script, '--rule', rule],
|
|
{ cwd: repoRoot, encoding: 'utf8', timeout: 30_000 },
|
|
);
|
|
return { status: result.status, stderr: result.stderr ?? '' };
|
|
}
|
|
|
|
function assertInvalidControl(
|
|
result: { status: number | null; stderr: string },
|
|
assertion: string,
|
|
): void {
|
|
if (result.status === 1 && result.stderr.trim() === assertion) return;
|
|
throw new BenchmarkControlError(
|
|
`Invalid-shallow control did not produce the required red assertion (exit ${String(result.status)}).`,
|
|
'pnpm bench:ios-snapshot:deep-button -- --rule invalid-shallow',
|
|
);
|
|
}
|
|
|
|
function assertSafeControl(result: { status: number | null; stderr: string }): void {
|
|
if (result.status === 0) return;
|
|
throw new BenchmarkControlError(
|
|
`Safe-full control failed: ${result.stderr.trim() || `exit ${String(result.status)}`}`,
|
|
'pnpm bench:ios-snapshot:deep-button -- --rule safe-full',
|
|
);
|
|
}
|