From 43594af3c81cdd4a7aa5400ac9a6272c3fb4c379 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Wed, 2 Sep 2026 02:31:32 +0700 Subject: [PATCH] fix: CI biome errors + enhanced GUILD_CREATE/READY voice_states diagnostic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - live-speaker.ts: unused var [id] in clearAllSpeakers → [_] - migrate.ts: useTemplate string concat → template literal - streamWatchReceiver: remove unused watchKey param from closeCurrentSegment - videoRecorder: log all raw WS event types + READY sessions.voice + broadcaster_user_ids --- services/backend/src/modules/voice/live-speaker.ts | 2 +- .../src/modules/voice-recording/streamWatchReceiver.ts | 9 +++------ .../src/modules/voice-recording/videoRecorder.ts | 7 ++++++- services/discord-gateway/src/shared/database/migrate.ts | 3 +-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/services/backend/src/modules/voice/live-speaker.ts b/services/backend/src/modules/voice/live-speaker.ts index bac290b9..0009ca6b 100644 --- a/services/backend/src/modules/voice/live-speaker.ts +++ b/services/backend/src/modules/voice/live-speaker.ts @@ -99,7 +99,7 @@ export function getSpeakingSpeakers(): LiveSpeaker[] { * snapshot doesn't carry ghost speakers. */ export function clearAllSpeakers(): void { - for (const [id, s] of speakers) { + for (const [, s] of speakers) { s.speaking = false; } purgeStale(); diff --git a/services/discord-gateway/src/modules/voice-recording/streamWatchReceiver.ts b/services/discord-gateway/src/modules/voice-recording/streamWatchReceiver.ts index aecca9a8..132bbe9b 100644 --- a/services/discord-gateway/src/modules/voice-recording/streamWatchReceiver.ts +++ b/services/discord-gateway/src/modules/voice-recording/streamWatchReceiver.ts @@ -122,7 +122,7 @@ const _silenceInterval = setInterval(() => { ); // Fire-and-forget: close + finalize the segment. - void closeCurrentSegment(watch, watchKey); + void closeCurrentSegment(watch); } }, 2_000); // Prevent the interval from keeping the process alive. @@ -655,10 +655,7 @@ async function openOutput( * ready for a new segment (silence ended → packets resume). * Mirrors voice recording's finalizeSegment + uploadRecordingSegment flow. */ -async function closeCurrentSegment( - watch: WatchState, - watchKey: string, -): Promise { +async function closeCurrentSegment(watch: WatchState): Promise { if (!watch.out || watch.out.destroyed || watch.closing) return; // Mark closing FIRST (synchronously) so the UDP handler stops writing. watch.closing = true; @@ -835,7 +832,7 @@ function closeWatch(watch: WatchState): void { } // Finalize any open segment (mux to MP4 + DB + upload). if (watch.out && !watch.out.destroyed) { - void closeCurrentSegment(watch, `${watch.guildId}:${watch.uid}`); + void closeCurrentSegment(watch); } } diff --git a/services/discord-gateway/src/modules/voice-recording/videoRecorder.ts b/services/discord-gateway/src/modules/voice-recording/videoRecorder.ts index f040d280..264a82e2 100644 --- a/services/discord-gateway/src/modules/voice-recording/videoRecorder.ts +++ b/services/discord-gateway/src/modules/voice-recording/videoRecorder.ts @@ -140,7 +140,12 @@ export function setVideoRecorderClient(client: Client | undefined) { : -1, broadcasterUserIds: dAny.broadcaster_user_ids, sessionVoice: Array.isArray(dAny.sessions) - ? (dAny.sessions as Array<{ voice?: unknown; session_id?: unknown }>) + ? ( + dAny.sessions as Array<{ + voice?: unknown; + session_id?: unknown; + }> + ) .map((s) => s.voice) .filter(Boolean) .slice(0, 5) diff --git a/services/discord-gateway/src/shared/database/migrate.ts b/services/discord-gateway/src/shared/database/migrate.ts index d9738854..985d25d2 100644 --- a/services/discord-gateway/src/shared/database/migrate.ts +++ b/services/discord-gateway/src/shared/database/migrate.ts @@ -194,8 +194,7 @@ async function seedDrizzleHistory(client: PoolClient): Promise { // recorded). Seed up to the last journal `when` so Drizzle skips them // instead of re-running already-applied DDL and crashing. This is the // recovery that broke the gateway's infinite-restart loop. - const journalTag = - (await getFirstMigrationTag()) + `@${lastMigrationWhen}-reconciled`; + const journalTag = `${await getFirstMigrationTag()}@${lastMigrationWhen}-reconciled`; await client.query( `INSERT INTO "__drizzle_migrations" (hash, created_at) VALUES ($1, $2)`, [journalTag, lastMigrationWhen],