Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(cli): dispatch-shape and thin-client goldens gain the trust command (67 handleCliOnly cases)

garrytanff1e99279e00
diff --git a/test/cli-dispatch-phase.test.ts b/test/cli-dispatch-phase.test.ts
index 2415f2ca3c..0464d12aff 100644
--- a/test/cli-dispatch-phase.test.ts
+++ b/test/cli-dispatch-phase.test.ts
@@ -89,7 +89,7 @@ describe('CLI dispatch shape (master AST)', () => {
const shape = await expectNormalizerStable(extractCliDispatch, astNormalizer);
expect(shape.sets.CLI_ONLY).toEqual([...CLI_ONLY].sort());
expect(shape.sets.THIN_CLIENT_REFUSED_COMMANDS).toEqual([...THIN_CLIENT_REFUSED_COMMANDS].sort());
- expect(shape.switchCases.length).toBe(66);
+ expect(shape.switchCases.length).toBe(67);
expect(Object.keys(shape.commands).length).toBeGreaterThanOrEqual(shape.sets.CLI_ONLY.length);
});
diff --git a/test/cli-thin-client-refusal-matrix.test.ts b/test/cli-thin-client-refusal-matrix.test.ts
index 1b15b0095a..6017098142 100644
--- a/test/cli-thin-client-refusal-matrix.test.ts
+++ b/test/cli-thin-client-refusal-matrix.test.ts
@@ -12,7 +12,7 @@
* against a remote brain), routes a host-bound subcommand, changes a hint or
* exit code, or moves a check across the connectEngine terminator.
* Why new: test/cli-dispatch-thin-client.test.ts asserts refusal for a
- * hand-picked subset by substring; nothing pins all 66 cases or the full
+ * hand-picked subset by substring; nothing pins all 67 cases or the full
* text. Seam: none.
*
* Nothing leaves the machine: issuer and MCP URLs point at 127.0.0.1:1
@@ -104,8 +104,8 @@ describe('A16b thin-client refusal matrix', () => {
routing = await run(ROUTING_ROWS);
}, 300_000);
- test('the matrix covers all 66 handleCliOnly cases', () => {
- expect(CASES.length).toBe(66);
+ test('the matrix covers all 67 handleCliOnly cases', () => {
+ expect(CASES.length).toBe(67);
});
test('every handleCliOnly case, run bare on a thin client, matches the golden', () => {
diff --git a/test/fixtures/goldens/cli/dispatch-phase.json b/test/fixtures/goldens/cli/dispatch-phase.json
index 0ee78e6658..79d8c00257 100644
--- a/test/fixtures/goldens/cli/dispatch-phase.json
+++ b/test/fixtures/goldens/cli/dispatch-phase.json
@@ -1911,6 +1911,13 @@
"thinClient": "refuse",
"thinClientRoutedSubcommands": []
},
+ "trust": {
+ "hasSwitchCase": true,
+ "phase": "post-connect",
+ "preConnectRules": [],
+ "thinClient": "refuse",
+ "thinClientRoutedSubcommands": []
+ },
"upgrade": {
"hasSwitchCase": false,
"phase": "pre-connect",
diff --git a/test/fixtures/goldens/cli/literal-imports.json b/test/fixtures/goldens/cli/literal-imports.json
index 80faecb20b..3b11ae8891 100644
--- a/test/fixtures/goldens/cli/literal-imports.json
+++ b/test/fixtures/goldens/cli/literal-imports.json
@@ -200,6 +200,11 @@
"transcripts": [
"./commands/transcripts.ts"
],
+ "trust": [
+ "./core/eligibility/explain.ts",
+ "./core/eligibility/scan.ts",
+ "./core/trust/backfill.ts"
+ ],
"waiting": [
"./commands/loops.ts"
],
diff --git a/test/fixtures/goldens/cli/membership-sets.json b/test/fixtures/goldens/cli/membership-sets.json
index 93d10ace47..e30920b936 100644
--- a/test/fixtures/goldens/cli/membership-sets.json
+++ b/test/fixtures/goldens/cli/membership-sets.json
@@ -70,6 +70,7 @@
"refusedWithoutHint": [
"edge-proposals",
"feedback",
+ "trust",
"watch"
],
"selfHelpNotInCliOnly": [],
@@ -201,6 +202,7 @@
"takes",
"think",
"transcripts",
+ "trust",
"upgrade",
"waiting",
"watch",
@@ -295,6 +297,7 @@
"takes",
"think",
"transcripts",
+ "trust",
"upgrade",
"waiting",
"watch",
@@ -336,6 +339,7 @@
"sources",
"think",
"transcripts",
+ "trust",
"waiting",
"watch",
"whoknows"
@@ -345,6 +349,7 @@
"hook",
"post-upgrade",
"self-upgrade",
+ "trust",
"upgrade"
],
"THIN_CLIENT_REFUSED_COMMANDS": [
@@ -386,6 +391,7 @@
"sync",
"takes",
"transcripts",
+ "trust",
"watch"
],
"THIN_CLIENT_REFUSE_HINTS": [
diff --git a/test/fixtures/goldens/cli/thin-client-cases.json b/test/fixtures/goldens/cli/thin-client-cases.json
index 7de2970c10..312f16d7d2 100644
--- a/test/fixtures/goldens/cli/thin-client-cases.json
+++ b/test/fixtures/goldens/cli/thin-client-cases.json
@@ -737,6 +737,16 @@
],
"stdout": []
},
+ {
+ "argv": "trust",
+ "exitCode": 1,
+ "stderr": [
+ "Error [requires_local_engine]: `gbrain trust` requires a local engine. This install is a thin client of http://127.0.0.1:1/mcp.",
+ "Fix: gbrain trust",
+ "Docs: https://github.com/garrytan/gbrain/blob/master/docs/guides/error-codes.md#requires_local_engine"
+ ],
+ "stdout": []
+ },
{
"argv": "watch",
"exitCode": 1,