From 3f3ebcf5f6525529f0940e68ccba8a9a0cb4cda6 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Mon, 26 Jan 2026 12:44:42 +0100 Subject: [PATCH] Fix duplicate client tag in spell encoding (#215) The client tag was being added twice to spells: 1. Unconditionally in encodeSpell() in spell-conversion.ts 2. Conditionally in publish-spell.ts based on user settings Removed the unconditional addition in encodeSpell() so the client tag is only added once by publish-spell.ts when the user setting is enabled. Co-authored-by: Claude --- src/lib/spell-conversion.test.ts | 3 ++- src/lib/spell-conversion.ts | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/lib/spell-conversion.test.ts b/src/lib/spell-conversion.test.ts index ca12c9a..0e6d745 100644 --- a/src/lib/spell-conversion.test.ts +++ b/src/lib/spell-conversion.test.ts @@ -12,7 +12,8 @@ describe("Spell Conversion", () => { }); expect(result.tags).toContainEqual(["cmd", "REQ"]); - expect(result.tags).toContainEqual(GRIMOIRE_CLIENT_TAG); + // Note: Client tag is NOT added by encodeSpell - it's added by publish-spell.ts + // based on user settings to avoid duplicate tags expect(result.tags).toContainEqual(["k", "1"]); expect(result.tags).toContainEqual(["k", "3"]); expect(result.tags).toContainEqual(["k", "7"]); diff --git a/src/lib/spell-conversion.ts b/src/lib/spell-conversion.ts index aefb9a6..7ce0af6 100644 --- a/src/lib/spell-conversion.ts +++ b/src/lib/spell-conversion.ts @@ -6,7 +6,6 @@ import type { SpellEvent, } from "@/types/spell"; import type { NostrFilter } from "@/types/nostr"; -import { GRIMOIRE_CLIENT_TAG } from "@/constants/app"; /** * Simple tokenization that doesn't expand shell variables @@ -115,10 +114,8 @@ export function encodeSpell(options: CreateSpellOptions): EncodedSpell { } // Start with required tags - const tags: [string, string, ...string[]][] = [ - ["cmd", cmdType], - GRIMOIRE_CLIENT_TAG, - ]; + // Note: Client tag is added by publish-spell.ts based on user settings + const tags: [string, string, ...string[]][] = [["cmd", cmdType]]; // Add name tag if provided if (name && name.trim().length > 0) {