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

@@ -5,6 +5,7 @@ import {
getLogLevel,
nextRequestId,
renderTraceBytes,
runWithoutRequestContext,
runWithRequestId,
runWithTraceRequest,
setLogLevel,
@@ -88,6 +89,20 @@ describe('TRACE diagnostics contract', () => {
expect(currentRequestId()).toBeUndefined();
});
it('detaches long-lived resources from the current request context', async () => {
await runWithRequestId(4243, async () => {
expect(currentRequestId()).toBe(4243);
const detached = await runWithoutRequestContext(async () => {
expect(currentRequestId()).toBeUndefined();
await Promise.resolve();
return currentRequestId();
});
expect(detached).toBeUndefined();
expect(currentRequestId()).toBe(4243);
});
expect(currentRequestId()).toBeUndefined();
});
it('reuses an existing request context even while TRACE is disabled', async () => {
setLogLevel('info');