feat: ship Wave 5-6 multi-surface hygiene, optimization, and bug fixes

This commit is contained in:
Yun Chan 2026-11-14 11:51:41 +09:00
parent 01ef3293cf
commit 66b6b45ba9
399 changed files with 17828 additions and 11330 deletions

View file

@ -363,21 +363,28 @@ async function markMeetingQueued(item: DurableQueueItem): Promise<DurableQueueIt
}
async function processItemCore(item: DurableQueueItem): Promise<AudioPipelineResult> {
if (!(await FileSystem.exists(item.path))) {
throw new AudioPipelineError('file-read', 'Queued audio file is missing');
}
const controller = new AbortController();
runningControllers.set(item.id, controller);
let current: DurableQueueItem = {
...item,
status: 'running' as const,
attempts: item.attempts + 1,
lastErrorCode: null,
lastErrorMessage: null,
updatedAtMs: Date.now(),
};
await replaceItem(current);
let current: DurableQueueItem = item;
try {
if (discardedItems.has(item.id)) {
throw new AudioPipelineError('cancelled', 'Queued audio processing was cancelled');
}
if (!(await FileSystem.exists(item.path))) {
throw new AudioPipelineError('file-read', 'Queued audio file is missing');
}
if (discardedItems.has(item.id) || controller.signal.aborted) {
throw new AudioPipelineError('cancelled', 'Queued audio processing was cancelled');
}
current = {
...item,
status: 'running' as const,
attempts: item.attempts + 1,
lastErrorCode: null,
lastErrorMessage: null,
updatedAtMs: Date.now(),
};
await replaceItem(current);
current = await markMeetingQueued(current);
const result = await processAudioInput(queueInput(current), {
expectedUserId: current.userId,
@ -393,6 +400,9 @@ async function processItemCore(item: DurableQueueItem): Promise<AudioPipelineRes
emit({ type: 'changed', item: current });
},
});
if (discardedItems.has(current.id) || controller.signal.aborted) {
throw new AudioPipelineError('cancelled', 'Queued audio processing was cancelled');
}
try {
await removeOwnedFile(current.path);
await removeItem(current);
@ -531,7 +541,9 @@ export async function discardQueuedAudio(userId: string, itemId: string): Promis
runningControllers.get(item.id)?.abort();
await removeOwnedFile(item.path);
await removeItem(item);
if (!runningControllers.has(item.id)) discardedItems.delete(item.id);
if (!runningControllers.has(item.id) && !runningItemPromises.has(item.id)) {
discardedItems.delete(item.id);
}
}
export async function clearQueuedAudioForUser(userId: string): Promise<void> {
@ -548,7 +560,9 @@ export async function clearQueuedAudioForUser(userId: string): Promise<void> {
} catch (error) {
firstRemovalError ??= error;
}
if (!runningControllers.has(item.id)) discardedItems.delete(item.id);
if (!runningControllers.has(item.id) && !runningItemPromises.has(item.id)) {
discardedItems.delete(item.id);
}
}
await mutateQueue(items => items.filter(item => !removedIds.has(item.id)));
if (firstRemovalError !== null) throw firstRemovalError;