-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Agent: print out helpful error message on missing recording (#3197)
Previously, it could be difficult to debug why an agent test case was failing due to missing HTTP recordings. In many cases, the failure happened because 1) we leaked an absolute path into the recording or 2) we forgot to sort context files before constructing the prompt. This PR is an attempt to make it easier to debug failures in this cases by * Taking the body and URL of the HTTP request with missing recording * Find the entry in the recording file with matching URL and closest levenshein distance from the body * Prints out a unified diff of the multi-line formatted JSON bodies ## Test plan Green CI. Manually tested by making modifications to the recording file. The output looks like this ![CleanShot 2024-02-16 at 15 20 02@2x](https://github.com/sourcegraph/cody/assets/1408093/41a7e0b6-a169-42d8-9cb4-20d5c6e1a130) <!-- Required. See https://sourcegraph.com/docs/dev/background-information/testing_principles. -->
- Loading branch information
Showing
8 changed files
with
138 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
.../src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ClosestPostDataParams.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@file:Suppress("FunctionName", "ClassName") | ||
package com.sourcegraph.cody.protocol_generated | ||
|
||
data class Testing_ClosestPostDataParams( | ||
var url: String? = null, | ||
var postData: String? = null, | ||
) | ||
|
7 changes: 7 additions & 0 deletions
7
.../src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ClosestPostDataResult.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@file:Suppress("FunctionName", "ClassName") | ||
package com.sourcegraph.cody.protocol_generated | ||
|
||
data class Testing_ClosestPostDataResult( | ||
var closestBody: String? = null, | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.