feat(onebot): complete trace operation chains
Make short TRACE captures independently explain OneBot action and event lifecycles from complete input through a truthful terminal conclusion. Preserve request correlation across asynchronous work while keeping disabled TRACE paths allocation-free and lazy. Cover shutdown rejection, stream cancellation, event conversion and suppression, reporter invocation settlement, and HTTP delivery outcomes without changing established transport or observer behavior. Add focused regression coverage for lifecycle uniqueness, context reuse, disconnect handling, and quiesce ingress boundaries.
This commit is contained in:
20 files changed
+1304
-154
No files matched your search
@@ -126,6 +126,32 @@ describe('WsClientAdapter — stale-socket close guard (issue #97)', () => {
|
||||
expect(closed).toBe(true);
|
||||
});
|
||||
|
||||
it('records and drops a valid action after API quiesce', async () => {
|
||||
const processStreamRequest = vi.fn(async () => {});
|
||||
const traceQuiescedStreamRequest = vi.fn();
|
||||
const quiescedCtx: NetworkAdapterContext = {
|
||||
...ctx(),
|
||||
api: {
|
||||
isAcceptingActions: false,
|
||||
processStreamRequest,
|
||||
traceQuiescedStreamRequest,
|
||||
} as never,
|
||||
};
|
||||
const adapter = new WsClientAdapter('ws', cfg(), quiescedCtx);
|
||||
adapter.open();
|
||||
const socket = instances[0];
|
||||
const raw = Buffer.from(JSON.stringify({
|
||||
action: 'get_status',
|
||||
params: { detail: 'complete' },
|
||||
}));
|
||||
|
||||
socket.emit('message', raw);
|
||||
|
||||
expect(traceQuiescedStreamRequest).toHaveBeenCalledWith(raw.toString('utf8'));
|
||||
expect(processStreamRequest).not.toHaveBeenCalled();
|
||||
await adapter.close();
|
||||
});
|
||||
|
||||
it('ignores the close event from a socket replaced by a hot reload', async () => {
|
||||
vi.useFakeTimers();
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user