Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(pregate): ship-policy.json keeps min_gstack_version at 1.91.377.0 or newer while pregate.json declares run_profiles (gives .gstack/ship-policy.json its test lane)

garrytan43ffa0b296a8
diff --git a/test/scripts/pregate-remote-gate.test.ts b/test/scripts/pregate-remote-gate.test.ts
index b775d0ae65..a736a5a321 100644
--- a/test/scripts/pregate-remote-gate.test.ts
+++ b/test/scripts/pregate-remote-gate.test.ts
@@ -24,10 +24,14 @@
* VM cleanup: the gate's UBICLOUD: left= line (UBI_LEFT_FILE) must say 0, or
* the run is PREGATE_REMOTE_INFRA (exit 4, no receipt), never a test result;
* a missing line counts as not confirmed.
+ * Policy floor: .gstack/pregate.json's run_profiles and remote_gate_runs are read
+ * only by gstack 1.91.377.0 and newer, so .gstack/ship-policy.json must declare
+ * at least that min_gstack_version while they exist; an older gstack would
+ * otherwise refuse the policy as invalid instead of naming the upgrade.
*/
import { afterEach, beforeEach, describe, expect, it } from 'bun:test';
import { spawnSync } from 'node:child_process';
-import { chmodSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
+import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
@@ -336,3 +340,16 @@ describe('pregate-remote-gate.sh --list', () => {
expect(spawnSync('test', ['-e', join(repo, '.git', 'list-ran')]).status).not.toBe(0);
});
});
+
+describe('.gstack policy floor', () => {
+ it('ship-policy.json declares min_gstack_version 1.91.377.0 or newer while pregate.json declares run_profiles or remote_gate_runs', () => {
+ const root = join(import.meta.dir, '..', '..');
+ const pregate = JSON.parse(readFileSync(join(root, '.gstack/pregate.json'), 'utf8'));
+ const ship = JSON.parse(readFileSync(join(root, '.gstack/ship-policy.json'), 'utf8'));
+ if (!('run_profiles' in pregate) && !('remote_gate_runs' in pregate)) return;
+ const floor = String(ship.min_gstack_version ?? '');
+ expect(floor).toMatch(/^\d+\.\d+\.\d+(\.\d+)?$/);
+ const [a, b, c] = floor.split('.').map(Number);
+ expect(a * 1e8 + b * 1e4 + c).toBeGreaterThanOrEqual(1 * 1e8 + 91 * 1e4 + 377);
+ });
+});