Skip to content
Source
Sign inSign up
pingdotgg/t3code

test(server): ACP replay tests no longer read an empty status file #20113

ClosedAlb11747(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/20113/headopened View on GitHub

Showing 1 changed file with 24 additions and 13 deletions.

x
0 of 1 viewed, 1 left
24 additions and 13 deletionsapps/server/scripts/acp-replay-agent.tsModified
View file
@@ -140,9 +140,19 @@
​
function advance(): void {
cursor += 1;
+ // A clean recorded exit waits on nothing, so it counts in the same write;
+ // otherwise a transcript ending in an answer then an exit would publish the
+ // exit only after the client has seen that answer.
+ while (isCleanExit(transcript.entries[cursor])) cursor += 1;
writeStatus();
​
+function isCleanExit(entry: ReplayEntry | undefined): boolean {
+ return (
+ entry?.type === "runtime_exit" && (entry.status === "success" || entry.status === "cancelled")
+ );
+}
+​
function send(message: JsonRpcMessage): void {
process.stdout.write(`${JSON.stringify(message)}\n`);
@@ -182,42 +192,40 @@
​
-function emitInbound(recorded: LogicalFrame): void {
+function inboundMessage(recorded: LogicalFrame): JsonRpcMessage | undefined {
const frame = materializeInbound(recorded) as LogicalFrame;
switch (frame.kind) {
case "notification":