시간 도메인과 정지 중 메시지·베팅 경계 정리

This commit is contained in:
2026-09-03 16:01:19 +00:00
parent 10cddbb565
commit abceee8315
108 changed files with 3504 additions and 1473 deletions
+9 -3
View File
@@ -26,6 +26,8 @@ for (const modelMatch of schema.matchAll(/model\s+(\w+)\s*\{([\s\S]*?)\n\}/g)) {
databaseField.endsWith('_tick') ||
databaseField === 'clock_revision' ||
databaseField === 'deadline_generation' ||
databaseField.endsWith('_clock_revision') ||
databaseField.endsWith('_deadline_generation') ||
(table.startsWith('clock_') && databaseField.endsWith('_revision'))
) {
discovered.push(`${table}.${databaseField}`);
@@ -57,17 +59,21 @@ for (const requiredKey of [
'world-clock',
'turn-cursor',
'general-next-turn',
'selection-reselection-deadline',
'general-recent-war-occurrence',
'auction-open-occurrence',
'auction-bid-occurrence',
'auction-deadline',
'auction-finalizing-recovery',
'message-occurrence',
'message-expiry',
'message-action-occurrence',
'message-action-expiry',
'message-action-clock-coordinate',
'inheritance-effect-coordinate',
'vote-start-occurrence',
'vote-end-deadline',
'select-pool-reservation',
'npc-selection-window',
'accepted-command-coordinate',
'daemon-command-coordinate',
'tournament-deadlines',
'movable-json-rule-anchors',
'unification-wait',
@@ -516,7 +516,10 @@ describe('auction integration flow', () => {
WHERE id = ${auction.id}
`
);
const result = await transport.requestCommand({ type: 'auctionFinalize', auctionId: auction.id }, 30_000);
const result = await transport.requestCommand(
{ type: 'auctionFinalize', auctionId: auction.id, expectedCloseTick: finalizeTick },
30_000
);
expect(result).toMatchObject({ type: 'auctionFinalize', ok: true });
const finished = await prisma.auction.findUnique({
@@ -705,13 +708,16 @@ describe('auction integration flow', () => {
closeTick: BigInt(turnDaemon.world.dateToGameTick(siblingCloseAt)),
},
});
const siblingBidGameAt = turnDaemon.world.getGameNow(new Date());
await prisma.auctionBid.create({
data: {
auctionId: siblingAuction.id,
generalId: spareBidder.generalId,
amount: 350,
eventId: `same-slot-race-${siblingAuction.id}`,
eventAt: turnDaemon.world.getGameNow(new Date()),
eventAt: siblingBidGameAt,
occurredGameTick: BigInt(turnDaemon.world.dateToGameTick(siblingBidGameAt)),
requestedAtWall: new Date(),
},
});
await expect(
@@ -752,7 +758,10 @@ describe('auction integration flow', () => {
WHERE id = ${auction.id}
`
);
const result = await directTransport.requestCommand({ type: 'auctionFinalize', auctionId: auction.id }, 30_000);
const result = await directTransport.requestCommand(
{ type: 'auctionFinalize', auctionId: auction.id, expectedCloseTick: finalizeTick },
30_000
);
expect(result).toMatchObject({ type: 'auctionFinalize', ok: false });
const reopened = await prisma.auction.findUnique({
@@ -914,7 +923,10 @@ describe('auction integration flow', () => {
WHERE id = ${auction.id}
`
);
const result = await transport.requestCommand({ type: 'auctionFinalize', auctionId: auction.id }, 30_000);
const result = await transport.requestCommand(
{ type: 'auctionFinalize', auctionId: auction.id, expectedCloseTick: finalizeTick },
30_000
);
expect(result).toMatchObject({ type: 'auctionFinalize', ok: true });
const winner = await prisma.general.findUnique({
@@ -1205,7 +1217,10 @@ describe('auction integration flow', () => {
},
});
const transport = new DatabaseTurnDaemonTransport(prisma, 30_000);
const result = await transport.requestCommand({ type: 'auctionFinalize', auctionId: auction.id }, 30_000);
const result = await transport.requestCommand(
{ type: 'auctionFinalize', auctionId: auction.id, expectedCloseTick: finalizeTick },
30_000
);
expect(result).toMatchObject({ type: 'auctionFinalize', ok: true });
await expect(prisma.auction.findUniqueOrThrow({ where: { id: auction.id } })).resolves.toMatchObject({
@@ -407,7 +407,7 @@ integration('NPC possession selector Ref differential', () => {
refresh: hasPreviousToken,
keepIds: testCase.keepIds,
now: acceptedAt(fixture),
acceptedGameTick,
createdGameTick: acceptedGameTick,
selectionObserver: {
onRandomDraw: (value) => randomDraws.push(value),
onCandidateDraw: (selectedId) => draws.push(Number(selectedId)),