fix(bridge): restore active sessions after delayed startup

Allow SnowLuma to discover and restore accounts that were already active before startup.

Avoid reporting sessions ready before they can serve requests, preserve account changes, and keep discovery failures observable.

Add regression coverage for delayed startup, recovery, and process isolation.

Refs #305

Refs #307
This commit is contained in:
DrSmoothl committed 2026-08-03 10:49:47 +08:00
1 parent fb4d7716a1
commit 8526d0c2c5
9 files changed
+591 -126

No files matched your search

@@ -151,6 +151,35 @@ describe('listLiveLinuxPipePids', () => {
});
describe('QqHookClient — pipe frame limits', () => {
it('forwards a probed account as a native identity hint without changing login state', async () => {
const pid = 778819;
const writes: Buffer[] = [];
const connection = mockControlPipe(pid, (socket, payload) => {
writes.push(Buffer.from(payload));
const requestId = payload.readUInt32LE(8);
queueMicrotask(() => socket.emit('data', pipeFrame({
op: PipeOp.sendAck,
requestId,
})));
});
const client = new QqHookClient(pid);
try {
await client.reconcileLoginIdentity('10001');
expect(writes).toHaveLength(1);
expect(writes[0]!.readUInt16LE(6)).toBe(PipeOp.loginIdentityHint);
expect(writes[0]!.readBigUInt64LE(32)).toBe(10001n);
expect(client.getLoginState()).toEqual({
loggedIn: false,
uin: '0',
uinNumber: 0n,
});
} finally {
client.close();
connection.mockRestore();
}
});
it.each([
['command', 20, MAX_PIPE_CMD_BYTES],
['message', 24, MAX_PIPE_MSG_BYTES],