fix(runner): address review findings for output bounds, key rotation, defaults, and generated uploads

This commit is contained in:
yiling
2026-11-14 15:00:38 +08:00
parent c56ad79213
commit a01bcc42ed
13 changed files with 541 additions and 116 deletions
@@ -0,0 +1,27 @@
import { describe, expect, it } from 'vitest'
import { OutputAccumulator } from './output-accumulator'
describe('OutputAccumulator', () => {
it('does not accumulate rawChunks in memory when disableTempFile is true', () => {
const acc = new OutputAccumulator({
maxBytes: 1024,
maxLines: 50,
disableTempFile: true,
})
const chunk = Buffer.from(`${'x'.repeat(2047)}\n`, 'utf-8')
for (let i = 0; i < 256; i++) {
acc.append(chunk)
}
acc.finish()
const internal = acc as unknown as { rawChunks: Buffer[]; tailBytes: number }
expect(internal.rawChunks).toEqual([])
expect(internal.tailBytes).toBeLessThanOrEqual(1024 * 4)
const snapshot = acc.snapshot({ persistIfTruncated: false })
expect(snapshot.truncation.truncated).toBe(true)
expect(snapshot.fullOutputPath).toBeUndefined()
expect(Buffer.byteLength(snapshot.content, 'utf-8')).toBeLessThanOrEqual(1024)
})
})