import assert from "node:assert/strict"; import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../.."); const reportPath = path.join(repoRoot, "release/soak-reports/editing.json"); const report = JSON.parse(fs.readFileSync(reportPath, "utf8")); assert.equal(report.schemaVersion, 1); assert.equal(report.status, "READY"); assert.equal(report.profile, "FORMAL"); assert.equal(report.requiredDurationMs, 1_800_000); assert.ok(report.configuredDurationMs >= report.requiredDurationMs); assert.ok(report.actualDurationMs >= report.requiredDurationMs); assert.ok(report.cycles > 100); assert.equal(report.autosaves, report.cycles); assert.ok(report.reopens >= 20); assert.ok(report.finalRevision >= report.initialRevision + report.cycles * 2); assert.match(report.finalSha256, /^[a-f0-9]{64}$/); assert.ok(report.finalBytes > 0); assert.ok(report.finalSnapshotCount <= report.limits.maxSnapshots); assert.equal(report.downloadCount, 1); assert.deepEqual(report.pageErrors, []); assert.equal(report.failure, null); assert.ok(report.observed.heapGrowthBytes <= report.limits.maxHeapGrowthBytes); assert.ok(report.observed.storageGrowthBytes <= report.limits.maxStorageGrowthBytes); assert.ok(report.resourceSamples.length >= report.reopens + 1); assert.equal(report.resourceSamples[0].label, "baseline"); assert.equal(report.resourceSamples.at(-1).label, "final"); process.stdout.write(`editing-soak-report-ok durationMs=${report.actualDurationMs} cycles=${report.cycles} autosaves=${report.autosaves} reopens=${report.reopens} revision=${report.finalRevision} sha256=${report.finalSha256} heapGrowth=${report.observed.heapGrowthBytes} storageGrowth=${report.observed.storageGrowthBytes}\n`);