From 903f63c88f46b268b92b34cff0c543335ebf9ab0 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 19 Jan 2026 03:02:23 +0000 Subject: [PATCH] chore(ai): CI health fixes (flaky tests) - Fix `tests/moderation-service.test.mjs` failing with `nostr-extension-missing` by injecting dependency. - Fix circular dependency in `js/nostr/commentEvents.js` causing `tests/nip71-base-event-tags.test.mjs` to fail. - Update `package-lock.json` via `npm audit fix`. --- js/nostr/commentEvents.js | 2 +- js/services/moderationService.js | 4 +++- package-lock.json | 12 ++++++------ tests/moderation-service.test.mjs | 6 ++++++ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/js/nostr/commentEvents.js b/js/nostr/commentEvents.js index 8e59a997..2e64ca2a 100644 --- a/js/nostr/commentEvents.js +++ b/js/nostr/commentEvents.js @@ -12,7 +12,7 @@ import { LRUCache } from "../utils/lruCache.js"; import { CACHE_POLICIES } from "./cachePolicies.js"; import { isSessionActor } from "./sessionActor.js"; import { queueSignEvent } from "./signRequestQueue.js"; -import { getActiveSigner } from "../nostrClientFacade.js"; +import { getActiveSigner } from "../nostrClientRegistry.js"; const COMMENT_EVENT_SCHEMA = getNostrEventSchema(NOTE_TYPES.VIDEO_COMMENT); const CACHE_POLICY = CACHE_POLICIES[NOTE_TYPES.VIDEO_COMMENT]; diff --git a/js/services/moderationService.js b/js/services/moderationService.js index a28d912d..5bed0f89 100644 --- a/js/services/moderationService.js +++ b/js/services/moderationService.js @@ -505,10 +505,12 @@ export class ModerationService { userBlocks: userBlockManager = null, accessControl: accessControlService = null, userLogger: userChannel = null, + requestExtensionPermissions: permissionRequester = null, } = {}) { this.nostrClient = client; this.log = normalizeLogger(log); this.userLogger = normalizeUserLogger(userChannel); + this.requestExtensionPermissions = permissionRequester || requestDefaultExtensionPermissions; this.viewerPubkey = ""; this.viewerIsSessionActor = false; @@ -1561,7 +1563,7 @@ export class ModerationService { } if (signer?.type === "extension") { - const permissionResult = await requestDefaultExtensionPermissions([ + const permissionResult = await this.requestExtensionPermissions([ "sign_event", "get_public_key", ]); diff --git a/package-lock.json b/package-lock.json index d9858251..a29401bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2024,9 +2024,9 @@ } }, "node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", "dev": true, "license": "ISC", "dependencies": { @@ -2479,9 +2479,9 @@ "license": "MIT" }, "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", "dev": true, "license": "MIT", "dependencies": { diff --git a/tests/moderation-service.test.mjs b/tests/moderation-service.test.mjs index e629081c..c5fb2757 100644 --- a/tests/moderation-service.test.mjs +++ b/tests/moderation-service.test.mjs @@ -387,12 +387,18 @@ test("viewer mute list publishes and updates aggregation", async (t) => { relays: ["wss://relay.example"], ensurePool: async () => {}, ensureExtensionPermissions: async () => ({ ok: true }), + ensureActiveSignerForPubkey: async (pubkey) => ({ + type: "extension", + signEvent: async (e) => ({ ...e, id: "0".repeat(64), pubkey }), + canSign: () => true, + }), }; const service = new ModerationService({ logger: () => {}, nostrClient, userLogger: noopUserLogger, + requestExtensionPermissions: async () => ({ ok: true }), }); const previousNostr = globalThis.window.nostr;