chore(ai): CI health fixes (flaky tests)

- Fix flaky `tests/hashtag-preferences.test.mjs` by correcting mock implementation for `fetchListIncrementally`.
- Fix `tests/nostr-login-permissions.test.mjs` failure by requesting correct permissions in `js/nostr/client.js`.
- Fix 90s timeout in `HashtagPreferencesService` by clearing the timeout timer upon successful decryption.
- `npm install` was run to ensure dependencies like `jsdom` are present for `tests/app/channel-profile-moderation.test.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-01-31 03:08:33 +00:00
1 parent 8c331f8c14
commit e027e6bba3
3 files changed
+18 -17

No files matched your search

+1 -1
View File
@@ -2079,7 +2079,7 @@ export class NostrClient {
}
const permissionResult = await this.ensureExtensionPermissions(
DEFAULT_NIP07_CORE_METHODS,
DEFAULT_NIP07_PERMISSION_METHODS,
{ context: "login", logMetrics: true, showStatus: false },
);
if (!permissionResult.ok) {
+16 -13
View File
@@ -775,19 +775,22 @@ class HashtagPreferencesService {
const decryptPromise = this.decryptEvent(latest, normalized, {
allowPermissionPrompt,
});
const timeoutPromise = new Promise((_, reject) =>
setTimeout(
() => {
const timeoutError = new Error(
`Decryption timed out after ${DECRYPT_TIMEOUT_MS / 1000}s`,
);
timeoutError.code = "hashtag-preferences-decrypt-timeout";
reject(timeoutError);
},
DECRYPT_TIMEOUT_MS,
),
);
decryptResult = await Promise.race([decryptPromise, timeoutPromise]);
let timeoutId;
const timeoutPromise = new Promise((_, reject) => {
timeoutId = setTimeout(() => {
const timeoutError = new Error(
`Decryption timed out after ${DECRYPT_TIMEOUT_MS / 1000}s`,
);
timeoutError.code = "hashtag-preferences-decrypt-timeout";
reject(timeoutError);
}, DECRYPT_TIMEOUT_MS);
});
try {
decryptResult = await Promise.race([decryptPromise, timeoutPromise]);
} finally {
if (timeoutId) clearTimeout(timeoutId);
}
} catch (error) {
decryptResult = { ok: false, error };
}
+1 -3
View File
@@ -248,10 +248,8 @@ test(
tags: [["encrypted", "nip04"]],
};
let fetchCalls = 0;
nostrClient.fetchListIncrementally = async () => {
fetchCalls += 1;
return fetchCalls === 1 ? [event] : [];
return [event];
};
nostrClient.relays = relayUrls;
nostrClient.writeRelays = relayUrls;