fix(auction): harden lifecycle and durable bid storage

Serialize lifecycle changes and make cancellation, deadlines, and match side effects recoverable and idempotent.

Archive accepted bids durably, quarantine invalid payloads, and preserve compatibility with empty round IDs. Synchronize HTTP polling and socket state with scoped resync events.

Add cancellation cleanup index migration and regression coverage. Validated with 744 API tests, 65 Redis integration tests, and 28 Mongo integration tests.
This commit is contained in:
dahyeon committed 2026-11-09 23:24:11 +09:00
1 parent f2eec479d9
commit f649490cd2
55 files changed
+5374 -522

No files matched your search

@@ -240,10 +240,15 @@ export class TournamentResultService {
public async cancelPolling(
matchOrId: MatchDocument | mongoose.Types.ObjectId,
session?: mongoose.ClientSession,
): Promise<void> {
const match = await this.loadMatch(matchOrId);
const match =
matchOrId instanceof mongoose.Types.ObjectId
? await this.loadMatch(matchOrId, session)
: matchOrId;
match.resultPollState = undefined;
await match.save();
if (session) await match.save({ session });
else await match.save();
}
public async processPollJob(job: PollTournamentResultJob): Promise<void> {
@@ -908,12 +913,14 @@ export class TournamentResultService {
private async loadMatch(
matchOrId: MatchDocument | mongoose.Types.ObjectId,
session?: mongoose.ClientSession,
): Promise<MatchDocument> {
const MatchModel = await this.connectionService.getModel('match');
const match =
const query =
matchOrId instanceof mongoose.Types.ObjectId
? await MatchModel.findById(matchOrId)
: await MatchModel.findById(matchOrId._id);
? MatchModel.findById(matchOrId)
: MatchModel.findById(matchOrId._id);
const match = await (session ? query.session(session) : query);
if (!match) throw new NotFoundException('Match not found.');
return match;
}