fix: add completed/interrupted guard in session upsert (out-of-order event defense)
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 46s

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
wangdl 2026-06-08 21:14:58 +08:00
parent 22ed18404f
commit c6f254f864

View File

@ -80,6 +80,11 @@ export class LearningSessionRepository {
});
if (existing) {
// Guard: don't update completed/interrupted sessions (defense against out-of-order events)
if (existing.status === 'completed' || existing.status === 'interrupted') {
return existing;
}
const update: any = {
lastEventAt: new Date(Number(data.timestampMs)),
};