Skip to content

Commit 0434afa

Browse files
romtsnclaude
andcommitted
test(code-mappings): Add test for HTTP 207 partial success response
Verify the CLI correctly handles HTTP 207 Multi-Status responses from the bulk code-mappings endpoint. The CLI treats 207 as a success at the HTTP level and relies on the JSON body to surface per-mapping errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8735962 commit 0434afa

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
```
2+
$ sentry-cli code-mappings upload tests/integration/_fixtures/code_mappings/mappings.json --org wat-org --project wat-project --repo owner/repo --default-branch main
3+
? failed
4+
Uploading 2 code mapping(s)...
5+
+------------------+---------------------------------------------+-------------------+
6+
| Stack Root | Source Root | Detail |
7+
+------------------+---------------------------------------------+-------------------+
8+
| com/example/maps | modules/maps/src/main/java/com/example/maps | duplicate mapping |
9+
+------------------+---------------------------------------------+-------------------+
10+
11+
Created: 1, Updated: 0, Errors: 1
12+
error: 1 error(s) during upload. See details above.
13+
14+
Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
15+
Please attach the full debug log to all bug reports.
16+
17+
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"created": 1,
3+
"updated": 0,
4+
"errors": 1,
5+
"mappings": [
6+
{"stackRoot": "com/example/core", "sourceRoot": "modules/core/src/main/java/com/example/core", "status": "created"},
7+
{"stackRoot": "com/example/maps", "sourceRoot": "modules/maps/src/main/java/com/example/maps", "status": "error", "detail": "duplicate mapping"}
8+
]
9+
}

tests/integration/code_mappings/upload.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ fn command_code_mappings_upload_partial_error() {
2424
.with_default_token();
2525
}
2626

27+
#[test]
28+
fn command_code_mappings_upload_207_partial_error() {
29+
TestManager::new()
30+
.mock_endpoint(
31+
MockEndpointBuilder::new("POST", "/api/0/organizations/wat-org/code-mappings/bulk/")
32+
.with_status(207)
33+
.with_response_file("code_mappings/post-bulk-207-partial-error.json"),
34+
)
35+
.register_trycmd_test("code_mappings/code-mappings-upload-207-partial-error.trycmd")
36+
.with_default_token();
37+
}
38+
2739
#[test]
2840
fn command_code_mappings_upload_batches() {
2941
// Generate a fixture with 301 mappings to force 2 batches (300 + 1).

0 commit comments

Comments
 (0)