mirror of
https://github.com/stablyai/orca.git
synced 2026-10-21 00:03:46 +00:00
style: oxfmt the OutputSpan capability changes
This commit is contained in:
@@ -148,7 +148,9 @@ function describeFrames(frames: Iterable<TerminalOutputFrameChunk>): FrameShape[
|
||||
|
||||
function expectEquivalent(data: string, meta: TerminalOutputMeta | undefined, label: string): void {
|
||||
const legacy = describeFrames(legacyIterateTerminalOutputFrameChunks(data, meta))
|
||||
const next = describeFrames(iterateTerminalOutputFrameChunks(data, meta, { supportsOutputSpan: true }))
|
||||
const next = describeFrames(
|
||||
iterateTerminalOutputFrameChunks(data, meta, { supportsOutputSpan: true })
|
||||
)
|
||||
expect(next, label).toEqual(legacy)
|
||||
}
|
||||
|
||||
@@ -498,7 +500,11 @@ describe('iterateTerminalOutputFrameChunks equivalence with the pre-optimization
|
||||
|
||||
it('keeps every emitted frame within the wire cap and reassembles to the input', () => {
|
||||
const data = `${'a'.repeat(200 * 1024)}${SURROGATE_PAIR.repeat(4096)}${LONE_HIGH}`
|
||||
const frames = [...iterateTerminalOutputFrameChunks(data, seqPreservingMeta(data, 999_999), { supportsOutputSpan: true })]
|
||||
const frames = [
|
||||
...iterateTerminalOutputFrameChunks(data, seqPreservingMeta(data, 999_999), {
|
||||
supportsOutputSpan: true
|
||||
})
|
||||
]
|
||||
expect(frames.length).toBeGreaterThan(4)
|
||||
for (const frame of frames) {
|
||||
expect(frame.bytes.byteLength).toBeLessThanOrEqual(TERMINAL_STREAM_CHUNK_BYTES)
|
||||
@@ -516,10 +522,15 @@ describe('iterateTerminalOutputFrameChunks equivalence with the pre-optimization
|
||||
// 3-byte code points: 16384 code units = 49152 bytes = exactly the cap.
|
||||
const exact = '\u20ac'.repeat(TERMINAL_STREAM_CHUNK_BYTES / 3)
|
||||
expect(Buffer.byteLength(exact, 'utf8')).toBe(TERMINAL_STREAM_CHUNK_BYTES)
|
||||
expect([...iterateTerminalOutputFrameChunks(exact, undefined, { supportsOutputSpan: true })]).toHaveLength(1)
|
||||
expect([
|
||||
...iterateTerminalOutputFrameChunks(exact, undefined, { supportsOutputSpan: true })
|
||||
]).toHaveLength(1)
|
||||
expect([...legacyIterateTerminalOutputFrameChunks(exact)]).toHaveLength(1)
|
||||
const overByOne = `${exact}a`
|
||||
expect([...iterateTerminalOutputFrameChunks(overByOne, undefined, { supportsOutputSpan: true })].length).toBeGreaterThan(1)
|
||||
expect(
|
||||
[...iterateTerminalOutputFrameChunks(overByOne, undefined, { supportsOutputSpan: true })]
|
||||
.length
|
||||
).toBeGreaterThan(1)
|
||||
expect([...legacyIterateTerminalOutputFrameChunks(overByOne)].length).toBeGreaterThan(1)
|
||||
})
|
||||
|
||||
|
||||
@@ -26,33 +26,37 @@ describe('terminal output frame source ranges', () => {
|
||||
it('maps encoded chunk boundaries to exact ordered source subranges', () => {
|
||||
const data = 'a'.repeat(TERMINAL_STREAM_CHUNK_BYTES + 2)
|
||||
const frames = Array.from(
|
||||
iterateTerminalOutputFrameChunks(data, {
|
||||
seq: data.length,
|
||||
rawLength: data.length,
|
||||
sourceRanges: [
|
||||
range({
|
||||
sourceEndSu: TERMINAL_STREAM_CHUNK_BYTES - 1,
|
||||
displayEnd: TERMINAL_STREAM_CHUNK_BYTES - 1,
|
||||
transform: {
|
||||
transformed: false,
|
||||
rawLengthSu: TERMINAL_STREAM_CHUNK_BYTES - 1,
|
||||
scalarSafe: true
|
||||
}
|
||||
}),
|
||||
range({
|
||||
spanId: 'span-2',
|
||||
sourceStartSu: TERMINAL_STREAM_CHUNK_BYTES - 1,
|
||||
sourceEndSu: data.length,
|
||||
displayStart: TERMINAL_STREAM_CHUNK_BYTES - 1,
|
||||
displayEnd: data.length,
|
||||
transform: {
|
||||
transformed: false,
|
||||
rawLengthSu: data.length - TERMINAL_STREAM_CHUNK_BYTES + 1,
|
||||
scalarSafe: true
|
||||
}
|
||||
})
|
||||
]
|
||||
}, { supportsOutputSpan: true })
|
||||
iterateTerminalOutputFrameChunks(
|
||||
data,
|
||||
{
|
||||
seq: data.length,
|
||||
rawLength: data.length,
|
||||
sourceRanges: [
|
||||
range({
|
||||
sourceEndSu: TERMINAL_STREAM_CHUNK_BYTES - 1,
|
||||
displayEnd: TERMINAL_STREAM_CHUNK_BYTES - 1,
|
||||
transform: {
|
||||
transformed: false,
|
||||
rawLengthSu: TERMINAL_STREAM_CHUNK_BYTES - 1,
|
||||
scalarSafe: true
|
||||
}
|
||||
}),
|
||||
range({
|
||||
spanId: 'span-2',
|
||||
sourceStartSu: TERMINAL_STREAM_CHUNK_BYTES - 1,
|
||||
sourceEndSu: data.length,
|
||||
displayStart: TERMINAL_STREAM_CHUNK_BYTES - 1,
|
||||
displayEnd: data.length,
|
||||
transform: {
|
||||
transformed: false,
|
||||
rawLengthSu: data.length - TERMINAL_STREAM_CHUNK_BYTES + 1,
|
||||
scalarSafe: true
|
||||
}
|
||||
})
|
||||
]
|
||||
},
|
||||
{ supportsOutputSpan: true }
|
||||
)
|
||||
)
|
||||
|
||||
expect(frames).toHaveLength(2)
|
||||
@@ -84,12 +88,16 @@ describe('terminal output frame source ranges', () => {
|
||||
splittable: false,
|
||||
transform: { transformed: true, rawLengthSu: 9, scalarSafe: false }
|
||||
})
|
||||
const [frame] = iterateTerminalOutputFrameChunks('xyz', {
|
||||
seq: 9,
|
||||
rawLength: 9,
|
||||
transformed: true,
|
||||
sourceRanges: [sourceRange]
|
||||
}, { supportsOutputSpan: true })
|
||||
const [frame] = iterateTerminalOutputFrameChunks(
|
||||
'xyz',
|
||||
{
|
||||
seq: 9,
|
||||
rawLength: 9,
|
||||
transformed: true,
|
||||
sourceRanges: [sourceRange]
|
||||
},
|
||||
{ supportsOutputSpan: true }
|
||||
)
|
||||
|
||||
expect(frame?.sourceRanges).toEqual([sourceRange])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user