style(gateway,backend): clear all biome warnings (no warnings left behind)

Address every remaining biome lint/format warning across both services
so the codebase ships warning-free:

- textCacheStore: drop unused deleteExpiredQdrantPoints import; hash
  image cache key (sha256[:32]) so long/base64 URLs no longer blow the
  text_analysis_cache PK B-tree 8191-byte index (was aborting the media
  analysis lock INSERT).
- bootstrap: drop unused unhandledRejection promise param.
- moderationOrchestrator: drop unused  destructure at L197.
- mediaDownloader / textBatchProcessor / transmitter: replace non-null
  assertions with proper null guards (stickerName ?? '', urlImages.get
  guard, backpressureQueue.shift guard).
- backend utils: throw lastError ?? fallback instead of lastError!.
- message-capture: remove unused  (retentionDb),  (moderationActionsDb,
  reviewsDb); simplify renderDiscordMentions guard to optional chain.
- transmitter: remove dead write-only  field + its assignments.

No behavior change beyond the cache-key hashing (now deterministic
fixed-length) and the intentional null-safety guards.
This commit is contained in:
asepharyana
2026-08-15 23:18:33 +07:00
parent c590a8be27
commit 416c690ebc
11 changed files with 12 additions and 17 deletions
@@ -450,7 +450,7 @@ export async function downloadMediaCandidate(
if (candidate.customEmojiId || candidate.stickerName) {
const vck = candidate.customEmojiId
? makeCustomEmojiCacheKey(candidate.customEmojiId)
: makeStickerCacheKey(candidate.stickerName!);
: makeStickerCacheKey(candidate.stickerName ?? "");
const cached = await getCachedMediaAnalysis(vck);
if (cached) {
const existing = mediaAnalysisMap.get(targetId) ?? [];
@@ -194,7 +194,7 @@ export async function runModerationAnalysis(
if (embeddings && embeddings.length === texts.length) {
// index-aligned with semanticCandidates
for (let i = 0; i < semanticCandidates.length; i++) {
const { target, cacheKey } = semanticCandidates[i];
const { cacheKey } = semanticCandidates[i];
embeddingsByKey.set(cacheKey, embeddings[i]);
}
@@ -249,7 +249,8 @@ export async function runTextOnlyBatch(
if (pics.length === 0) return { id: msg.id, lines: [] as string[] };
const lines = await Promise.all(
pics.map(async (url) => {
const img = urlImages.get(url)!;
const img = urlImages.get(url);
if (!img) return null;
try {
const { data: resizedBuffer, mimeType: resizedMime } =
await resizeImageForVision(img.data, maxDim);
@@ -3,7 +3,6 @@ import { createChildLogger } from "@/shared/logger/index";
import { executeAll, executeGet } from "../../shared/database/drizzle.js";
import { findBestEmbeddingMatch } from "./embeddingClient.js";
import {
deleteExpiredQdrantPoints,
deleteQdrantPoint,
deleteQdrantPointsByContentHash,
isQdrantConfigured,