feat(iios): projectors checkpoint the projection cursor (P9)
All 5 projectors (route/ai/inbox/calendar/raw-event) now advance their IiosProjectionCursor after a freshly-claimed event is applied — split into claim → apply → advance so a duplicate never double-counts and a throw leaves the cursor untouched (event replays via the DLQ). Inbox's two topics get two cursor rows. Proves KG-06 replay reproduction at the projection level. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import { describe, it, expect, beforeAll, afterAll, beforeEach } from 'vitest';
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import { DlqService } from '../outbox/dlq.service';
|
||||
import { resetDb } from '../test-utils/reset-db';
|
||||
import { ProjectionCursorService } from '../projection/projection-cursor.service';
|
||||
import { makeFakePorts } from '@insignia/iios-testkit';
|
||||
import { IIOS_EVENTS, type CloudEvent } from '@insignia/iios-contracts';
|
||||
import { signedFixture, emailFixture } from '@insignia/iios-adapter-sdk';
|
||||
@@ -24,7 +25,7 @@ const SECRET = 'dev-adapter-secret'; // AdapterRegistry default
|
||||
const registry = () => new AdapterRegistry();
|
||||
const inbound = () => new InboundService(asService, registry());
|
||||
const projector = () =>
|
||||
new RawEventProjector(asService, new OutboxBus(), new DlqService(asService), registry(), new IngestService(asService, makeFakePorts(), new ActorResolver(asService)));
|
||||
new RawEventProjector(asService, new OutboxBus(), new DlqService(asService), registry(), new IngestService(asService, makeFakePorts(), new ActorResolver(asService)), new ProjectionCursorService(asService));
|
||||
|
||||
async function rawReceivedEvents(): Promise<CloudEvent[]> {
|
||||
const rows = await prisma.iiosOutboxEvent.findMany({ where: { eventType: IIOS_EVENTS.rawReceived }, orderBy: { createdAt: 'asc' } });
|
||||
|
||||
Reference in New Issue
Block a user