test(#707): preserve approval boundary during session GC
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful

This commit is contained in:
Jarvis
2026-07-12 18:48:04 -05:00
parent f17e70c145
commit a4b6665bd7
2 changed files with 12 additions and 2 deletions

View File

@@ -65,6 +65,13 @@ describe('SessionGCService', () => {
expect(result.cleaned.valkeyKeys).toBeUndefined();
});
it('collect() only scans its session namespace and cannot reach durable approvals', async () => {
await service.collect('abc');
expect(mockRedis.scan).toHaveBeenCalledWith('0', 'MATCH', 'mosaic:session:abc:*', 'COUNT', 100);
expect(mockRedis.del).not.toHaveBeenCalledWith(expect.stringContaining('command-approval'));
});
it('collect() returns sessionId in result', async () => {
const result = await service.collect('test-session-id');
expect(result.sessionId).toBe('test-session-id');