chore(integration): snapshot local main worktree
This commit is contained in:
1 parent
48a9189939
commit
33fb31fb28
116 files changed
+8108
-3026
No files matched your search
@@ -7,7 +7,10 @@ import { join, resolve } from 'node:path';
|
||||
import { Writable } from 'node:stream';
|
||||
import { PiProcessError } from '../../electron/coding-runtime/pi/process-errors';
|
||||
import { PiRpcClient } from '../../electron/coding-runtime/pi/rpc-client';
|
||||
import { StrictLfJsonlFramer } from '../../electron/coding-runtime/pi/rpc-framer';
|
||||
import {
|
||||
DEFAULT_MAX_PI_RPC_LINE_BYTES,
|
||||
StrictLfJsonlFramer,
|
||||
} from '../../electron/coding-runtime/pi/rpc-framer';
|
||||
import {
|
||||
PiWorkerProcess,
|
||||
buildPiRpcArgs,
|
||||
@@ -85,6 +88,32 @@ describe('strict Pi LF JSONL framing', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('accepts a bounded multi-megabyte Pi image record across stdout chunks', () => {
|
||||
const imageData = 'a'.repeat(Math.floor(4.5 * 1024 * 1024) - 1024);
|
||||
const record = {
|
||||
type: 'tool_execution_end',
|
||||
toolCallId: 'read-image',
|
||||
toolName: 'read',
|
||||
result: {
|
||||
content: [{ type: 'image', data: imageData, mimeType: 'image/jpeg' }],
|
||||
},
|
||||
isError: false,
|
||||
};
|
||||
const source = Buffer.from(`${JSON.stringify(record)}\n`);
|
||||
const records: unknown[] = [];
|
||||
const framer = new StrictLfJsonlFramer({ onRecord: (value) => records.push(value) });
|
||||
|
||||
expect(source.byteLength).toBeGreaterThan(1024 * 1024);
|
||||
expect(source.byteLength).toBeLessThan(DEFAULT_MAX_PI_RPC_LINE_BYTES);
|
||||
for (let offset = 0; offset < source.byteLength; offset += 64 * 1024) {
|
||||
framer.push(source.subarray(offset, offset + 64 * 1024));
|
||||
}
|
||||
framer.finish();
|
||||
|
||||
expect(records).toHaveLength(1);
|
||||
expect((records[0] as typeof record).result.content[0].data).toHaveLength(imageData.length);
|
||||
});
|
||||
|
||||
it('fails closed for malformed, blank, invalid UTF-8, oversized, and partial records', () => {
|
||||
const make = (maxLineBytes = 64) => new StrictLfJsonlFramer({
|
||||
maxLineBytes,
|
||||
@@ -318,6 +347,9 @@ describe('Pi worker process', () => {
|
||||
expect(left.generation).toBe(2);
|
||||
expect(left.protocolError).toBeInstanceOf(PiProcessError);
|
||||
expect(left.protocolError?.diagnostic).toContain('[stdout-protocol]');
|
||||
if (failureType === 'large') {
|
||||
expect(left.protocolError?.diagnostic).toContain('exceeded 128 bytes');
|
||||
}
|
||||
await expect(right.request({ type: 'echo', value: 'still-alive' }))
|
||||
.resolves.toMatchObject({ data: { value: 'still-alive' } });
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user