YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
Remove empty deny block after notify cleanup (#3794)
Isaac Sanchez-Hawkinscbf4d0a54443
diff --git a/apps/screenpipe-app-tauri/lib/chat-utils.test.ts b/apps/screenpipe-app-tauri/lib/chat-utils.test.tsindex 10b79722a..3e650118c 100644--- a/apps/screenpipe-app-tauri/lib/chat-utils.test.ts+++ b/apps/screenpipe-app-tauri/lib/chat-utils.test.ts@@ -42,11 +42,19 @@ import { useChatStore } from "./stores/chat-store";describe("chat-utils", () => {beforeEach(() => {+ const storage = new Map<string, string>();+ vi.stubGlobal("localStorage", {+ clear: vi.fn(() => storage.clear()),+ getItem: vi.fn((key: string) => storage.get(key) ?? null),+ removeItem: vi.fn((key: string) => storage.delete(key)),+ setItem: vi.fn((key: string, value: string) => {+ storage.set(key, value);+ }),+ });emitMock.mockClear();showWindowMock.mockClear();getCurrentWindowMock.mockReset();getCurrentWindowMock.mockReturnValue({ label: "chat" });- localStorage.clear();useChatStore.setState({sessions: {},currentId: null,diff --git a/apps/screenpipe-app-tauri/lib/utils/notification-toggle.test.ts b/apps/screenpipe-app-tauri/lib/utils/notification-toggle.test.tsindex a78f9417a..802b4435b 100644--- a/apps/screenpipe-app-tauri/lib/utils/notification-toggle.test.ts+++ b/apps/screenpipe-app-tauri/lib/utils/notification-toggle.test.ts@@ -171,6 +171,17 @@ describe("toggleNotificationInContent — enable notifications", () => {expect(isNotificationsDenied(result)).toBe(false);});+ it("keeps compact YAML deny list items under deny when removing notify rule", () => {+ const input =+ "---\npermissions:\n deny:\n - Api(POST /search)\n - Api(POST /notify)\n---\n\n# My Pipe";+ const result = toggleNotificationInContent(input, true);+ expect(result).not.toContain("Api(POST /notify)");+ expect(result).toContain("permissions:");+ expect(result).toContain("deny:");+ expect(result).toContain(" - Api(POST /search)");+ expect(isNotificationsDenied(result)).toBe(false);+ });+it("preserves other frontmatter fields after cleanup", () => {const input ="---\nschedule: every 30m\nenabled: true\npermissions:\n deny:\n - Api(POST /notify)\n---\n\n# My Pipe";@@ -195,6 +206,18 @@ describe("toggleNotificationInContent — enable notifications", () => {expect(isNotificationsDenied(result)).toBe(false);});+ it("removes an empty deny block even when allow follows it", () => {+ const input =+ "---\npermissions:\n deny:\n - Api(POST /notify)\n allow:\n - Bash\n---\n\n# My Pipe";+ const result = toggleNotificationInContent(input, true);+ expect(result).toContain("permissions:");+ expect(result).toContain("allow:");+ expect(result).toContain("- Bash");+ expect(result).not.toContain("deny:");+ expect(result).not.toContain("Api(POST /notify)");+ expect(isNotificationsDenied(result)).toBe(false);+ });+it("no-ops when notifications already enabled (no deny rule)", () => {const input = "---\nschedule: every 30m\n---\n\n# My Pipe";const result = toggleNotificationInContent(input, true);diff --git a/apps/screenpipe-app-tauri/lib/utils/notification-toggle.ts b/apps/screenpipe-app-tauri/lib/utils/notification-toggle.tsindex eebc7808b..4a815b708 100644--- a/apps/screenpipe-app-tauri/lib/utils/notification-toggle.ts+++ b/apps/screenpipe-app-tauri/lib/utils/notification-toggle.ts@@ -139,14 +139,21 @@ function removeEmptyBlock(lines: string[], pattern: RegExp): string[] {const result: string[] = [];for (let i = 0; i < lines.length; i++) {if (pattern.test(lines[i].trim())) {+ const blockIndent = lines[i].match(/^\s*/)?.[0].length ?? 0;// Check if next non-empty line is indented (a child of this block)let nextIdx = i + 1;while (nextIdx < lines.length && lines[nextIdx].trim() === "") {nextIdx++;}+ const childIndent =+ nextIdx < lines.length+ ? lines[nextIdx].match(/^\s*/)?.[0].length ?? 0+ : -1;+ const isListItem =+ nextIdx < lines.length && lines[nextIdx].trim().startsWith("-");const hasChildren =- nextIdx < lines.length &&- (lines[nextIdx].startsWith(" ") || lines[nextIdx].trim().startsWith("-"));+ childIndent > blockIndent ||+ (isListItem && childIndent >= blockIndent);if (!hasChildren) {// Skip this empty block headercontinue;diff --git a/docs/mintlify/docs-mintlify-mig-tmp/connections.mdx b/docs/mintlify/docs-mintlify-mig-tmp/connections.mdxindex 656c6dc64..0034f3c92 100644--- a/docs/mintlify/docs-mintlify-mig-tmp/connections.mdx+++ b/docs/mintlify/docs-mintlify-mig-tmp/connections.mdx@@ -67,6 +67,7 @@ this takes you straight to where you need to be — no more hunting through docs| **Confluence** | access pages and spaces || **Airtable** | access bases and records || **Logseq** | sync with your Logseq graph |+| **Odoo** | query and update ERP, CRM, sales, and project records |### CRM & sales| app | description |