fix: harden result polling and Redis 8.10 operations
Preserve tournament result jobs through lock contention and transient failures, atomically schedule retries before acknowledgement, and publish initial polls after releasing the preparation lock. Fix Redis connection blocking, durability Hash cleanup, duplicate auction request ordering, and scheduled-job promotion. Use native Redis 8.10 stream, lock, counter, and field-expiring cache operations with invalidation fencing. Repair 90 test type errors and add a repeatable API typecheck command. Validation: 704 API tests, 129 web tests, 31 real Redis integration tests, 3 dependency checks, workspace type checks and builds, and changed-file lint.
This commit is contained in:
1 parent
0c4c4239ec
commit
4b8ccf0077
49 files changed
+2214
-371
No files matched your search
@@ -22,9 +22,7 @@ describe('CompetitionCommandService', () => {
|
||||
|
||||
it('rejects a stale expected revision and aborts without writing', async () => {
|
||||
const harness = createHarness({ competitionRevision: 8 });
|
||||
const service = new CompetitionCommandService(
|
||||
harness.connectionService as ConnectionService,
|
||||
);
|
||||
const service = new CompetitionCommandService(harness.connectionService);
|
||||
|
||||
await expect(service.acceptGame(acceptGameCommand())).rejects.toMatchObject(
|
||||
{
|
||||
@@ -44,9 +42,7 @@ describe('CompetitionCommandService', () => {
|
||||
|
||||
it('uses the expected revision in the persistence CAS and aborts a lost race', async () => {
|
||||
const harness = createHarness({ casResult: null });
|
||||
const service = new CompetitionCommandService(
|
||||
harness.connectionService as ConnectionService,
|
||||
);
|
||||
const service = new CompetitionCommandService(harness.connectionService);
|
||||
|
||||
await expect(service.acceptGame(acceptGameCommand())).rejects.toMatchObject(
|
||||
{
|
||||
@@ -86,9 +82,7 @@ describe('CompetitionCommandService', () => {
|
||||
return Promise.resolve([receipt]);
|
||||
},
|
||||
);
|
||||
const service = new CompetitionCommandService(
|
||||
harness.connectionService as ConnectionService,
|
||||
);
|
||||
const service = new CompetitionCommandService(harness.connectionService);
|
||||
const command = acceptGameCommand();
|
||||
|
||||
const first = await service.acceptGame(command);
|
||||
@@ -133,9 +127,7 @@ describe('CompetitionCommandService', () => {
|
||||
});
|
||||
},
|
||||
);
|
||||
const service = new CompetitionCommandService(
|
||||
harness.connectionService as ConnectionService,
|
||||
);
|
||||
const service = new CompetitionCommandService(harness.connectionService);
|
||||
|
||||
await expect(
|
||||
service.acceptGame(acceptGameCommand()),
|
||||
@@ -162,9 +154,7 @@ describe('CompetitionCommandService', () => {
|
||||
revision: 8,
|
||||
}),
|
||||
);
|
||||
const service = new CompetitionCommandService(
|
||||
harness.connectionService as ConnectionService,
|
||||
);
|
||||
const service = new CompetitionCommandService(harness.connectionService);
|
||||
|
||||
await expect(service.acceptGame(acceptGameCommand())).rejects.toMatchObject(
|
||||
{
|
||||
@@ -180,9 +170,7 @@ describe('CompetitionCommandService', () => {
|
||||
|
||||
it('atomically accepts a code-backed game, projects it, and enqueues an event', async () => {
|
||||
const harness = createHarness();
|
||||
const service = new CompetitionCommandService(
|
||||
harness.connectionService as ConnectionService,
|
||||
);
|
||||
const service = new CompetitionCommandService(harness.connectionService);
|
||||
const command = {
|
||||
...acceptGameCommand(),
|
||||
tournamentCode: {
|
||||
@@ -279,9 +267,7 @@ describe('CompetitionCommandService', () => {
|
||||
|
||||
it('appends an administrative adjudication through the same command runner', async () => {
|
||||
const harness = createHarness();
|
||||
const service = new CompetitionCommandService(
|
||||
harness.connectionService as ConnectionService,
|
||||
);
|
||||
const service = new CompetitionCommandService(harness.connectionService);
|
||||
|
||||
const result = await service.adjudicateSeries({
|
||||
competitionId: COMPETITION_ID,
|
||||
@@ -316,9 +302,7 @@ describe('CompetitionCommandService', () => {
|
||||
facts: reversal.facts,
|
||||
assignments: reversal.assignments,
|
||||
});
|
||||
const service = new CompetitionCommandService(
|
||||
harness.connectionService as ConnectionService,
|
||||
);
|
||||
const service = new CompetitionCommandService(harness.connectionService);
|
||||
|
||||
const preview = await service.previewSeriesReversal({
|
||||
competitionId: COMPETITION_ID,
|
||||
@@ -348,9 +332,7 @@ describe('CompetitionCommandService', () => {
|
||||
it('rejects a reversal preview at a stale revision', async () => {
|
||||
const reversal = reversalFixture();
|
||||
const harness = createHarness({ competition: reversal.competition });
|
||||
const service = new CompetitionCommandService(
|
||||
harness.connectionService as ConnectionService,
|
||||
);
|
||||
const service = new CompetitionCommandService(harness.connectionService);
|
||||
|
||||
await expect(
|
||||
service.previewSeriesReversal({
|
||||
@@ -372,9 +354,7 @@ describe('CompetitionCommandService', () => {
|
||||
facts: reversal.facts,
|
||||
assignments: reversal.assignments,
|
||||
});
|
||||
const service = new CompetitionCommandService(
|
||||
harness.connectionService as ConnectionService,
|
||||
);
|
||||
const service = new CompetitionCommandService(harness.connectionService);
|
||||
const preview = await service.previewSeriesReversal({
|
||||
competitionId: COMPETITION_ID,
|
||||
expectedRevision: 7,
|
||||
@@ -485,9 +465,7 @@ describe('CompetitionCommandService', () => {
|
||||
}),
|
||||
)
|
||||
.mockResolvedValueOnce([]);
|
||||
const service = new CompetitionCommandService(
|
||||
harness.connectionService as ConnectionService,
|
||||
);
|
||||
const service = new CompetitionCommandService(harness.connectionService);
|
||||
const preview = await service.previewSeriesReversal({
|
||||
competitionId: COMPETITION_ID,
|
||||
expectedRevision: 7,
|
||||
@@ -635,7 +613,7 @@ function createHarness(
|
||||
const connectionService = {
|
||||
createSession: jest.fn().mockResolvedValue(session),
|
||||
getModel: jest.fn((name: string) => Promise.resolve(models[name])),
|
||||
};
|
||||
} as unknown as jest.Mocked<ConnectionService>;
|
||||
|
||||
return {
|
||||
session,
|
||||
|
||||
Reference in new issue
Block a user