Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): preserve usage-limit recovery across empty wake runs #22775

Closedjuliusmarmingewants to merge 8 commits intomain fromfix/issue-16815opened View on GitHub

Showing 12 changed files with 115 additions and 0 deletions (loading 10).

x
0 of 12 viewed, 12 left
102 additions and 0 deletionsapps/server/scripts/usage-limit-web-evidence-record.mjsAdded
View file
@@ -0,0 +1,102 @@
+// Records one seeded usage-limit evidence thread (see usage-limit-web-evidence-seed.ts) at 1440 light.
+// node usage-limit-web-evidence-record.mjs <pairingUrl> <row> <outDir> <label> <action> [seconds]
+// action: watch (observe only) | resume (click the composer's "Resume thread" if present) |
+// arm (click the banner's "Resume at reset").
+// Writes <row>-<label>.webm plus a .captions.json of UTC-stamped steps. Usage limits are SYNTHETIC.
+import * as NodeModule from "node:module";
+import * as NodeFS from "node:fs";
+import * as NodePath from "node:path";
+​
+const [pairingUrl, row, outDir, label, action = "watch", seconds = "20"] = process.argv.slice(2);
+if (!pairingUrl || !row || !outDir || !label) throw new Error("missing arguments");
+const require = NodeModule.createRequire(
+ NodePath.resolve(import.meta.dirname, "../../web/package.json"),
+);
+const { chromium } = require("playwright");
+const manifest = process.env.SEED_HOME
+ ? JSON.parse(NodeFS.readFileSync(`${process.env.SEED_HOME}/fixture-${row}.json`, "utf8"))
+ : null;
+const captions = [];
+const start = Date.now();
+const caption = (text) => {
+ const entry = {
+ t: (Date.now() - start) / 1000,
+ utc: new Date().toISOString(),
+ resetAt: manifest?.resetAt ?? null,
+ text,
+ };
+ captions.push(entry);
+ console.log(JSON.stringify(entry));
+};