mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 16:03:49 +00:00
test(pty): pin the OSC 11 reply as its own write and record the tear the pin misses
The order assertion joined the PTY writes, which erased the per-write boundary the same gate claims. Assert the ordered array instead, so the pin also covers reply atomicity. The torn case tears the color query itself, so both replies still come from one parse turn; the comment claimed it reached ordering the single-write case cannot. Say what it actually covers, and record why a tear between the two queries must not be substituted: the chunk boundary lets a held reply flush before the CPR is produced, so that shape stays green under a real inversion. Gate record: state the two replies as separate writes, restore the real-xterm generation claim the edit replaced, and add the uncovered tear to knownGaps.
This commit is contained in:
@@ -13666,7 +13666,7 @@
|
||||
"providers": ["local", "daemon", "ssh"],
|
||||
"coveredPlatforms": ["macos"],
|
||||
"coveredProviders": ["local", "ssh"],
|
||||
"coverageNotes": "Deterministic renderer and IPC-transport tests prove count and text ceilings, oldest-reply shedding, explicit query-reply source routing, ordinary-input preservation, one-reply-per-write delivery for OSC, DA1, and CPR replies, real xterm OSC 11 then CSI 6n ordering, drain-failure containment, and clear/reuse generation fencing. Remote-runtime tests preserve separate query-reply writes across pending input, async validation, and viewport-claim buffering. Host-contract tests prove a later DA1/CPR reply cannot overtake an earlier OSC reply, including a coalesced legacy-client payload. Live macOS Electron tests cover local PTY OSC replies and interactive typing; a macOS-hosted Docker OpenSSH test proves an upstream-node-pty Linux relay keeps OSC/DA1 replies out of the next fish child's stdin. No live daemon, paired-runtime, WSL, physical Linux/Windows client, or binary mixed-version run is registered.",
|
||||
"coverageNotes": "Deterministic renderer and IPC-transport tests prove count and text ceilings, oldest-reply shedding, explicit query-reply source routing, ordinary-input preservation, one-reply-per-write delivery for OSC, DA1, and CPR replies, real xterm OSC reply generation and OSC 11 then CSI 6n ordering, drain-failure containment, and clear/reuse generation fencing. Remote-runtime tests preserve separate query-reply writes across pending input, async validation, and viewport-claim buffering. Host-contract tests prove a later DA1/CPR reply cannot overtake an earlier OSC reply, including a coalesced legacy-client payload. Live macOS Electron tests cover local PTY OSC replies and interactive typing; a macOS-hosted Docker OpenSSH test proves an upstream-node-pty Linux relay keeps OSC/DA1 replies out of the next fish child's stdin. No live daemon, paired-runtime, WSL, physical Linux/Windows client, or binary mixed-version run is registered.",
|
||||
"motivatingLinks": [
|
||||
"https://github.com/stablyai/orca/issues/13137",
|
||||
"https://github.com/stablyai/orca/issues/7329",
|
||||
@@ -13674,7 +13674,7 @@
|
||||
"https://github.com/stablyai/orca/issues/16672"
|
||||
],
|
||||
"invariant": "The desktop PTY input queue retains at most 64 explicitly sourced pending terminal query replies and 4096 UTF-16 code units. Every retained reply reaches the provider as one atomic write, and the host writes each reply the moment it accepts it, so replies reach the PTY in the order they were produced with no queue that could reorder them. A reply's own echo is contained on the output side by projecting its known echo shapes; the ESC-initial verbatim shape is matched only when complete, never held as a partial, so a query torn at its own ESC is still answered. Overflow removes only the oldest query replies, never ordinary input except the documented modified-F3/CPR byte collision, and drain failures cannot clear a newer queue generation.",
|
||||
"oracle": "Synchronously enqueue separate 10,000-entry OSC and DA1 reply floods before the scheduled drain and assert that only the initial immediate reply and newest 64 pending replies are written, each as one provider write, before a trailing keystroke. Derive the replies to OSC 11 followed by CSI 6n from real xterm, both in one write and with the color query torn across output chunks, and assert the PTY receives the exact OSC response followed by the CPR; preserve the same order for separate or legacy-coalesced host payloads. At the remote-runtime boundary, preserve separate writes around pending ordinary input, async validation, and viewport-claim buffering. Repeat behind 10,000 ordinary inputs and exercise the text ceiling, real xterm generation, provider-write failure, rejected yield, and clear/reuse generation fencing.",
|
||||
"oracle": "Synchronously enqueue separate 10,000-entry OSC and DA1 reply floods before the scheduled drain and assert that only the initial immediate reply and newest 64 pending replies are written, each as one provider write, before a trailing keystroke. Derive the replies to OSC 11 followed by CSI 6n from real xterm, both in one write and with the color query itself torn across output chunks, and assert the PTY receives the exact OSC response and then the CPR as two separate writes; preserve the same order for separate or legacy-coalesced host payloads. At the remote-runtime boundary, preserve separate writes around pending ordinary input, async validation, and viewport-claim buffering. Repeat behind 10,000 ordinary inputs and exercise the text ceiling, real xterm generation, provider-write failure, rejected yield, and clear/reuse generation fencing.",
|
||||
"commands": [
|
||||
"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-input-write-queue.test.ts src/renderer/src/components/terminal-pane/pty-transport-input-write.test.ts src/shared/terminal-query-reply.test.ts src/shared/pty-startup-ingress-live-query-reply.test.ts src/shared/pty-startup-reply-echo-shapes.test.ts",
|
||||
"pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-batching.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-query-reply-immediate.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-input-coalescing.test.ts",
|
||||
@@ -13705,7 +13705,7 @@
|
||||
"reply count and text overflow remove only the oldest pending replies",
|
||||
"real xterm OSC 10/11 query handlers remain subject to the same retention ceiling",
|
||||
"retained OSC, DA1, and CPR replies stay one provider write each and both OSC and DA1 floods remain bounded",
|
||||
"a real xterm OSC 11 query followed by CSI 6n reaches the PTY as the derived OSC reply followed by the CPR, including when the color query is torn across output chunks",
|
||||
"a real xterm OSC 11 query followed by CSI 6n reaches the PTY as two writes, the derived OSC reply then the CPR, including when the color query itself is torn across output chunks",
|
||||
"provider-write and yield failures settle without unhandled rejection, repeated same-generation admission, or stale-generation clearing",
|
||||
"clear releases saturated reply accounting and fences in-flight validation before later input"
|
||||
]
|
||||
@@ -13840,6 +13840,7 @@
|
||||
"knownGaps": [
|
||||
"No live daemon, paired-runtime, WSL, physical Linux/Windows client, mixed-version, or network-fault run is registered.",
|
||||
"Ordinary-input queue growth predates this change and is outside this reply-only gate.",
|
||||
"Query-reply ordering is pinned only where both queries land in one parse turn. A tear between the OSC and the CPR query is not covered: the chunk boundary lets a held reply flush before the CPR is produced, so that shape stays green even when ordering is inverted.",
|
||||
"Reply overload intentionally sheds the oldest synthetic replies; the modified-F3/CPR byte collision shares that budget, and live application behavior under a pathological query flood is not measured."
|
||||
],
|
||||
"demotionRule": "Keep experimental or revert if ordinary input is evicted, pending replies exceed either ceiling, retained replies are coalesced, a trailing key sits behind more than the bounded reply window, or the gate develops unexplained flakes."
|
||||
|
||||
@@ -345,8 +345,10 @@ describe('pty input write queue', () => {
|
||||
|
||||
it.each([
|
||||
['one write', ['\x1b[7;1H\x1b]11;?\x1b\\\x1b[6n']],
|
||||
// The color query is torn mid-sequence, so its reply is only produced by the chunk that
|
||||
// also carries the CPR query — the ordering the single-write case cannot exercise.
|
||||
// Tears the color query itself, so xterm resumes its OSC parse across chunks; both replies
|
||||
// still come from one parse turn. Do not "improve" this into a tear BETWEEN the two queries:
|
||||
// the chunk boundary lets a held reply flush before the CPR exists, so that shape passes
|
||||
// even when the order is genuinely inverted.
|
||||
['a query torn across output chunks', ['\x1b[7;1H\x1b]11;', '?\x1b\\\x1b[6n']]
|
||||
] as const)(
|
||||
'keeps xterm OSC 11 ahead of the following CPR at the PTY host (%s)',
|
||||
@@ -391,7 +393,8 @@ describe('pty input write queue', () => {
|
||||
const oscReply = '\x1b]11;rgb:0000/1313/1a1a\x1b\\'
|
||||
const cprReply = '\x1b[7;1R'
|
||||
expect(generatedReplies).toEqual([oscReply, cprReply])
|
||||
expect(ptyWrites.join('')).toBe(oscReply + cprReply)
|
||||
// Not joined: the array also pins the OSC reply as its own atomic write (#13892).
|
||||
expect(ptyWrites).toEqual([oscReply, cprReply])
|
||||
} finally {
|
||||
xtermReplies.dispose()
|
||||
capabilityReplies.dispose()
|
||||
|
||||
Reference in New Issue
Block a user