Deploy adaptive cost-stressed shock strategy

This commit is contained in:
Theodore Song
2026-08-21 16:53:57 -04:00
parent 6f77c2c3bd
commit a10c9a304c
11 changed files with 2856 additions and 90 deletions
+21
View File
@@ -0,0 +1,21 @@
import assert from "node:assert/strict";
import fs from "node:fs";
const index = fs.readFileSync(new URL("../index.html", import.meta.url), "utf8");
const worker = fs.readFileSync(new URL("../sw.js", import.meta.url), "utf8");
const cycleWorker = fs.readFileSync(new URL("../cycle-worker.js", import.meta.url), "utf8");
const build = Number(index.match(/const BUILD_VERSION = (\d+);/)?.[1]);
const cacheBuild = Number(worker.match(/polymarket-arena-build-(\d+)/)?.[1]);
assert.ok(Number.isInteger(build));
assert.equal(cacheBuild, build, "Service-worker cache must advance with the deployed build");
assert.match(worker, /keys\.filter\(key => key !== CACHE_NAME\)/);
assert.match(worker, /fetch\(event\.request\)\.then\(response =>/);
assert.match(worker, /\.catch\(\(\) => caches\.match\(event\.request\)\)/);
assert.doesNotMatch(worker, /caches\.match\(event\.request\)\.then\(cached => cached \|\| fetch/);
assert.match(worker, /"\/cycle-worker\.js"/);
assert.match(cycleWorker, /const INTERVAL_MS = 60000;/);
assert.match(index, /requires_live:true/);
assert.match(index, /runMode==="live"\|\|!next\.requires_live/);
console.log(`offline runtime verified for Build ${build}`);