Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

ci: committed weights metadata matches its weights file; name the VM list timeout; mark two contract timing bounds

garrytan47a1e74b235b
diff --git a/scripts/ci-ubicloud.ts b/scripts/ci-ubicloud.ts
index 2760a4d060..db8fc4f685 100755
--- a/scripts/ci-ubicloud.ts
+++ b/scripts/ci-ubicloud.ts
@@ -105,6 +105,7 @@ const COMMITTED_WEIGHTS = join(ROOT, "scripts/ubicloud/weights.json");
const LOCAL_WEIGHTS = join(ROOT, ".context/ci-ubicloud/weights.json");
const ALL_LANES = ["gitleaks", "verify", "serial", "slow", "unit", "pg-arms", "e2e"] as const;
const BATCH_TIMEOUT_MS = 20 * 60 * 1000;
+const VM_LIST_TIMEOUT_MS = 120_000;
// Test timeouts and the mined shard weights are calibrated on this location's VMs.
const GATE_LOCATION = "eu-central-h1";
// Items this heavy are the run's long poles: spread them one per VM so two of
@@ -678,7 +679,7 @@ async function main() {
* is 0; a --keep run reports its live VMs as left=<n> kept=1.
*/
async function leftover(owner: string, names: string[], kept: boolean): Promise<boolean> {
- const list = await runner(["cli", "vm", "list", "-N", "-f", "location,name"], { timeoutMs: 120_000 });
+ const list = await runner(["cli", "vm", "list", "-N", "-f", "location,name"], { timeoutMs: VM_LIST_TIMEOUT_MS });
const listed = list.code === 0 ? new Set(list.stdout.split("\n").map((line) => line.trim().split(/\s+/)[1]).filter(Boolean)) : null;
const left = listed ? names.filter((name) => listed.has(name)).length : "unknown";
const others = listed ? [...listed].filter((name) => name!.startsWith(`ubirun-${owner}-`) && !names.includes(name!)).length : "unknown";
diff --git a/scripts/test-weights.metadata.json b/scripts/test-weights.metadata.json
index f2e5402aa9..73fb53ac96 100644
--- a/scripts/test-weights.metadata.json
+++ b/scripts/test-weights.metadata.json
@@ -29,6 +29,6 @@
"12c54c8503a105e0319a0296aeac78a6b858304c"
],
"measuredFiles": 4359,
- "totalFiles": 4359,
+ "totalFiles": 4361,
"mergeExisting": false
}
diff --git a/test/cli-exit-drain.test.ts b/test/cli-exit-drain.test.ts
index 1e3fb62e36..410fee5ba5 100644
--- a/test/cli-exit-drain.test.ts
+++ b/test/cli-exit-drain.test.ts
@@ -82,6 +82,7 @@ describe('exit seam waits for delivery, not a fixed grace (real Bun pipes)', ()
const run = await runHarness({ HARNESS_STDOUT_BYTES: '100', HARNESS_STDERR_BYTES: '100', HARNESS_EXIT_CODE: '3' }, 500);
expect(run.code).toBe(3);
expect({ stdout: run.stdout, stderr: run.stderr, streams: run.streams }).toEqual({ stdout: 100, stderr: 100, streams: run.streams });
+ // gstack-timing-ok: the contract is that a read after exit never waits for the drain grace; half the grace is the headroom
expect(run.durationMs).toBeLessThan(GRACE_MS / 2 + 500);
}, 40_000);
diff --git a/test/persistence-crash-robot.test.ts b/test/persistence-crash-robot.test.ts
index 1c5a66eb90..25c9c75ce4 100644
--- a/test/persistence-crash-robot.test.ts
+++ b/test/persistence-crash-robot.test.ts
@@ -743,6 +743,7 @@ describe('every robot run covers a fixed schedule list (reuse of a passed run is
expect(error?.message).toBe('worker crashed');
// The other lane's run finishes after the failure; it must not start the next job.
release();
+ // gstack-timing-ok: an absence check (the released lane must not start a job); there is no event to await
await Bun.sleep(100);
expect(spawned).toEqual([`${first}:count`, `${second}:count`]);
} finally { rmSync(scratch, { recursive: true, force: true }); }
diff --git a/test/scripts/mine-shard-weights.test.ts b/test/scripts/mine-shard-weights.test.ts
index 22d7afc9ef..95c6667030 100644
--- a/test/scripts/mine-shard-weights.test.ts
+++ b/test/scripts/mine-shard-weights.test.ts
@@ -524,3 +524,16 @@ describe('medianWeights', () => {
expect(medianWeights([]).size).toBe(0);
});
});
+
+describe('committed shard weights', () => {
+ it.each([
+ ['scripts/test-weights.json', 'scripts/test-weights.metadata.json', 'unit', 'milliseconds'],
+ ['scripts/serial-weights.json', 'scripts/serial-weights.metadata.json', 'serial', 'seconds'],
+ ])('%s matches the metadata the miner wrote beside it', (weightsPath, metadataPath, lane, unit) => {
+ const root = join(import.meta.dir, '..', '..');
+ const weights = JSON.parse(readFileSync(join(root, weightsPath), 'utf8')) as Record<string, number>;
+ const metadata = JSON.parse(readFileSync(join(root, metadataPath), 'utf8'));
+ expect(metadata).toMatchObject({ lane, unit, totalFiles: Object.keys(weights).length });
+ expect(metadata.runs?.length ?? 1).toBe(metadata.commits?.length ?? 1);
+ });
+});