refactor: drive paired routing from room mode

This commit is contained in:
Eyejoker
2026-03-31 12:10:00 +09:00
parent bfe164dece
commit 89335ab005
4 changed files with 66 additions and 12 deletions

View File

@@ -1,6 +1,10 @@
import { beforeEach, describe, expect, it } from 'vitest';
import { _initTestDatabase, setRegisteredGroup } from './db.js';
import {
_initTestDatabase,
setExplicitRoomMode,
setRegisteredGroup,
} from './db.js';
import {
activateCodexFailover,
clearGlobalFailover,
@@ -78,4 +82,47 @@ describe('service-routing global failover', () => {
explicit: false,
});
});
it('uses explicit single room mode to suppress reviewer lease on dual registration', () => {
setRegisteredGroup('dc:explicit-single', {
name: 'Explicit Single Claude',
folder: 'explicit-single-claude',
trigger: '@Andy',
added_at: '2024-01-01T00:00:00.000Z',
agentType: 'claude-code',
});
setRegisteredGroup('dc:explicit-single', {
name: 'Explicit Single Codex',
folder: 'explicit-single-codex',
trigger: '@Codex',
added_at: '2024-01-01T00:00:00.000Z',
agentType: 'codex',
});
setExplicitRoomMode('dc:explicit-single', 'single');
expect(getEffectiveChannelLease('dc:explicit-single')).toMatchObject({
chat_jid: 'dc:explicit-single',
owner_service_id: 'codex-main',
reviewer_service_id: null,
explicit: false,
});
});
it('uses explicit tribunal room mode to add reviewer lease on solo rooms', () => {
setRegisteredGroup('dc:explicit-tribunal', {
name: 'Explicit Tribunal Claude',
folder: 'explicit-tribunal-claude',
trigger: '@Andy',
added_at: '2024-01-01T00:00:00.000Z',
agentType: 'claude-code',
});
setExplicitRoomMode('dc:explicit-tribunal', 'tribunal');
expect(getEffectiveChannelLease('dc:explicit-tribunal')).toMatchObject({
chat_jid: 'dc:explicit-tribunal',
owner_service_id: 'claude',
reviewer_service_id: 'claude',
explicit: false,
});
});
});