fix: 커맨드 차등 생명주기와 로그 그래프를 보강

장수 55종과 수뇌 35종의 상태, 로그, 메시지, 예약 턴 비교를 닫습니다.

실제 시나리오 프로필과 대표 PostgreSQL 수명주기, 즉시 외교와 출병 회귀를 추가하고 발견된 Ref 로그 및 생성 장수 저장 차이를 교정합니다.
This commit is contained in:
2026-08-23 21:48:29 +00:00
parent 85591c68ad
commit c63a49bd07
128 changed files with 8615 additions and 848 deletions
@@ -12,11 +12,13 @@ const ids = {
city: 2_147_000_102,
nation: 2_147_000_103,
};
const ownerIdentity = 'turn-differential-database-owner';
integration('core2026 turn state database snapshot adapter', () => {
let db: GamePrismaClient;
let disconnect: (() => Promise<void>) | undefined;
let createdWorldId: number | null = null;
let createdMessageId: number | null = null;
beforeAll(async () => {
const connector = createGamePostgresConnector({ url: databaseUrl! });
@@ -80,6 +82,7 @@ integration('core2026 turn state database snapshot adapter', () => {
await db.general.create({
data: {
id: ids.general,
userId: ownerIdentity,
name: '비교장수',
nationId: ids.nation,
cityId: ids.city,
@@ -97,9 +100,33 @@ integration('core2026 turn state database snapshot adapter', () => {
meta: { killturn: 24, myset: 6, intel_exp: 3 },
},
});
await db.troop.create({
data: {
troopLeaderId: ids.general,
nationId: ids.nation,
name: '비교부대',
},
});
createdMessageId = (
await db.message.create({
data: {
mailbox: ids.general,
type: 'private',
src: ids.general,
dest: ids.general,
time: new Date('0183-01-01T00:01:00.000Z'),
validUntil: new Date('9999-12-31T00:00:00.000Z'),
message: { text: '비교 메시지' },
},
})
).id;
});
afterAll(async () => {
if (createdMessageId !== null) {
await db.message.deleteMany({ where: { id: createdMessageId } });
}
await db.troop.deleteMany({ where: { troopLeaderId: ids.general } });
await db.general.deleteMany({ where: { id: ids.general } });
await db.city.deleteMany({ where: { id: ids.city } });
await db.nation.deleteMany({ where: { id: ids.nation } });
@@ -114,6 +141,8 @@ integration('core2026 turn state database snapshot adapter', () => {
generalIds: [ids.general],
cityIds: [ids.city],
nationIds: [ids.nation],
troopIds: [ids.general],
messageAfterId: (createdMessageId ?? 1) - 1,
});
expect(result.engine).toBe('core2026');
@@ -125,6 +154,7 @@ integration('core2026 turn state database snapshot adapter', () => {
intelligence: 80,
killTurn: 24,
mySet: 6,
ownerIdentity,
})
);
expect(result.cities).toContainEqual(
@@ -143,6 +173,18 @@ integration('core2026 turn state database snapshot adapter', () => {
power: 300,
})
);
expect(result.troops).toContainEqual({ id: ids.general, nationId: ids.nation, name: '비교부대' });
expect(result.messages).toContainEqual(
expect.objectContaining({
id: createdMessageId,
mailbox: ids.general,
type: 'private',
sourceId: ids.general,
destinationId: ids.general,
validUntil: 'infinite',
payload: { text: '비교 메시지' },
})
);
});
it('captures before/after state around a real database execution boundary', async () => {