( storedData: NormalizedData, requestBody: string | undefined, workDir: string, toolResultNormalizers: ToolResultNormalizer[], )
| 706 | // Checks if the request matches a snapshot that has no assistant response. |
| 707 | // This handles timeout test scenarios where the snapshot only records the request. |
| 708 | async function isRequestOnlySnapshot( |
| 709 | storedData: NormalizedData, |
| 710 | requestBody: string | undefined, |
| 711 | workDir: string, |
| 712 | toolResultNormalizers: ToolResultNormalizer[], |
| 713 | ): Promise<boolean> { |
| 714 | const normalized = await parseAndNormalizeRequest( |
| 715 | requestBody, |
| 716 | workDir, |
| 717 | toolResultNormalizers, |
| 718 | ); |
| 719 | const requestMessages = normalized.conversations[0]?.messages ?? []; |
| 720 | |
| 721 | for (const conversation of storedData.conversations) { |
| 722 | if ( |
| 723 | requestMessages.length === conversation.messages.length && |
| 724 | requestMessages.every( |
| 725 | (msg, i) => |
| 726 | JSON.stringify(msg) === JSON.stringify(conversation.messages[i]), |
| 727 | ) |
| 728 | ) { |
| 729 | return true; |
| 730 | } |
| 731 | } |
| 732 | return false; |
| 733 | } |
| 734 | |
| 735 | async function parseAndNormalizeRequest( |
| 736 | requestBody: string | undefined, |
no test coverage detected
searching dependent graphs…