From e5735f7ff2a8c4833a76d1e08b7520124efc1fd2 Mon Sep 17 00:00:00 2001 From: Deepak Jain Date: Wed, 27 May 2026 09:11:52 -0700 Subject: [PATCH] fix(policy): keep preset descriptions line-scoped Fixes #4312 Signed-off-by: Deepak Jain --- nemoclaw-blueprint/policies/presets/whatsapp.yaml | 2 +- src/lib/policy/index.ts | 2 +- test/policies.test.ts | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nemoclaw-blueprint/policies/presets/whatsapp.yaml b/nemoclaw-blueprint/policies/presets/whatsapp.yaml index 84b2ec56057..9119a926778 100644 --- a/nemoclaw-blueprint/policies/presets/whatsapp.yaml +++ b/nemoclaw-blueprint/policies/presets/whatsapp.yaml @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 preset: name: whatsapp - description: WhatsApp Web WebSocket and media access + description: "WhatsApp Web WebSocket and media access" network_policies: whatsapp: name: whatsapp diff --git a/src/lib/policy/index.ts b/src/lib/policy/index.ts index 871b9de13d0..2c1c46ef83b 100644 --- a/src/lib/policy/index.ts +++ b/src/lib/policy/index.ts @@ -61,7 +61,7 @@ function listPresets(): PresetInfo[] { .map((f: string) => { const content = fs.readFileSync(path.join(PRESETS_DIR, f), "utf-8"); const nameMatch = content.match(/^\s*name:\s*(.+)$/m); - const descMatch = content.match(/^\s*description:\s*"?([^"]*)"?$/m); + const descMatch = content.match(/^\s*description:\s*"?([^\n"]*)"?$/m); return { file: f, name: nameMatch ? nameMatch[1].trim() : f.replace(".yaml", ""), diff --git a/test/policies.test.ts b/test/policies.test.ts index 0751955e6b9..212627d936f 100644 --- a/test/policies.test.ts +++ b/test/policies.test.ts @@ -157,6 +157,12 @@ describe("policies", () => { } }); + it("does not include the WhatsApp preset YAML body in the description", () => { + const whatsapp = policies.listPresets().find((p) => p.name === "whatsapp"); + expect(whatsapp?.description).toBe("WhatsApp Web WebSocket and media access"); + expect(whatsapp?.description).not.toContain("network_policies:"); + }); + it("returns expected preset names", () => { const names = policies .listPresets()