Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion e2e/lib/event-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,19 @@ function tryParseEvent(text: string, events: ParsedEvent[]): void {
if (data.type) {
events.push({ ...data, raw: text })
}
} catch {}
} catch (e) {
if (
text.includes('"startRun"') ||
text.includes('"completeRun"') ||
text.includes('"stopRun')
) {
process.stderr.write(
`[PARSE_FAIL] Failed to parse event (len=${text.length}): ${(e as Error).message}\n`,
)
process.stderr.write(`[PARSE_FAIL] first 200 chars: ${text.slice(0, 200)}\n`)
process.stderr.write(`[PARSE_FAIL] last 200 chars: ${text.slice(-200)}\n`)
}
}
}

export function filterEventsByType<T extends RunEvent["type"]>(
Expand Down
13 changes: 6 additions & 7 deletions e2e/perstack-cli/continue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ describe.concurrent("Continue Job", () => {
{ timeout: LLM_TIMEOUT },
)
const continueResult = withEventParsing(continueCmdResult)
if (!continueResult.events.find((e) => e.type === "completeRun")) {
console.log(`[DEBUG continue] exitCode: ${continueCmdResult.exitCode}`)
console.log(
`[DEBUG continue] events: ${JSON.stringify(continueResult.events.map((e) => e.type))}`,
)
console.log(`[DEBUG continue] stdout: ${continueCmdResult.stdout.slice(0, 2000)}`)
console.log(`[DEBUG continue] stderr: ${continueCmdResult.stderr.slice(0, 2000)}`)
process.stderr.write(
`\n[DEBUG continue] exitCode=${continueCmdResult.exitCode} events=${JSON.stringify(continueResult.events.map((e) => e.type))}\n`,
)
process.stderr.write(`[DEBUG continue] stdout:\n${continueCmdResult.stdout.slice(0, 3000)}\n`)
if (continueCmdResult.stderr) {
process.stderr.write(`[DEBUG continue] stderr:\n${continueCmdResult.stderr.slice(0, 1000)}\n`)
}
expect(assertEventSequenceContains(continueResult.events, ["resumeFromStop"]).passed).toBe(true)
expect(
Expand Down
13 changes: 6 additions & 7 deletions e2e/perstack-cli/providers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ describe.concurrent("LLM Providers", () => {
provider,
})
const result = withEventParsing(cmdResult)
if (result.exitCode !== 0 || !result.events.find((e) => e.type === "completeRun")) {
console.log(`[DEBUG ${provider}] exitCode: ${result.exitCode}`)
console.log(
`[DEBUG ${provider}] events: ${JSON.stringify(result.events.map((e) => e.type))}`,
)
console.log(`[DEBUG ${provider}] stdout: ${result.stdout.slice(0, 2000)}`)
console.log(`[DEBUG ${provider}] stderr: ${result.stderr.slice(0, 2000)}`)
process.stderr.write(
`\n[DEBUG ${provider}] exitCode=${result.exitCode} events=${JSON.stringify(result.events.map((e) => e.type))}\n`,
)
process.stderr.write(`[DEBUG ${provider}] stdout:\n${result.stdout.slice(0, 3000)}\n`)
if (result.stderr) {
process.stderr.write(`[DEBUG ${provider}] stderr:\n${result.stderr.slice(0, 1000)}\n`)
}
expect(result.exitCode).toBe(0)
expect(assertEventSequenceContains(result.events, ["startRun", "completeRun"]).passed).toBe(
Expand Down