feat(logging): complete runtime trace diagnostics

Complete byte-level diagnostics for network, upload, runtime lifecycle, authenticated write, and background operation paths.

Preserve streaming behavior, file-storage boundaries, and default log volume while making failures, retries, cancellation, and final outcomes independently diagnosable.

Add focused regression coverage for correlation, partial data, resource context ownership, and terminal-state accuracy.
This commit is contained in:
DrSmoothl committed 2026-07-31 11:21:12 +08:00
1 parent 0ed85e7745
commit a67614fa09
27 files changed
+4029 -352

No files matched your search

@@ -1,3 +1,4 @@
import { currentRequestId, runWithRequestId } from '@snowluma/common/logger';
import { describe, expect, it, vi } from 'vitest';
import { OneBotManager } from '../src/manager';
import type { OneBotConfig } from '../src/types';
@@ -34,4 +35,23 @@ describe('OneBotManager config apply value ownership', () => {
expect(instance.reloadConfig).toHaveBeenNthCalledWith(1, a);
expect(instance.reloadConfig).toHaveBeenNthCalledWith(2, b);
});
it('does not attach a caller operation to reconfigured network resources', async () => {
const manager = new OneBotManager();
const observedRequestIds: Array<number | undefined> = [];
let observeDeferred!: () => void;
const instance = {
reloadConfig: vi.fn(async () => {
observedRequestIds.push(currentRequestId());
observeDeferred = () => observedRequestIds.push(currentRequestId());
return { applied: true, errors: [], statuses: [] };
}),
};
(manager as unknown as { instances: Map<string, unknown> }).instances.set('10001', instance);
await runWithRequestId(5101, () => manager.reloadConfig('10001', config('#reload')));
observeDeferred();
expect(observedRequestIds).toEqual([undefined, undefined]);
});
});