-
Notifications
You must be signed in to change notification settings - Fork 105
fix(attachments): Serialize ID without hyphens #5501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -336,6 +336,7 @@ impl UploadServiceInner { | |
| let key = Uuid::from_slice(&trace_item.trace_item.item_id) | ||
| .map_err(Error::from) | ||
| .reject(&trace_item)? | ||
| .as_simple() | ||
| .to_string(); | ||
|
|
||
| #[cfg(debug_assertions)] | ||
|
Comment on lines
336
to
342
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The code attempts to deserialize a 32-byte hex string UUID using 🔍 Detailed AnalysisThe serialization of 💡 Suggested FixUpdate the deserialization logic in 🤖 Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,7 @@ | |
| def create_attachment_metadata(): | ||
| return { | ||
| "trace_id": uuid.uuid4().hex, | ||
| "attachment_id": str(uuid.uuid4()), | ||
| "attachment_id": uuid.uuid4().hex, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The input doesn't need to be hyphen-free, but it makes comparisons with the output easier. |
||
| "timestamp": 1760520026.781239, | ||
| "filename": "myfile.txt", | ||
| "content_type": "text/plain", | ||
|
|
@@ -37,7 +37,6 @@ def create_attachment_metadata(): | |
| def create_attachment_envelope(project_config): | ||
| return Envelope( | ||
| headers={ | ||
| "event_id": "515539018c9b4260a6f999572f1661ee", | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Drive-by fix: trace attachment envelopes should not have an event ID. |
||
| "trace": { | ||
| "trace_id": "5b8efff798038103d269b633813fc60c", | ||
| "public_key": project_config["publicKeys"][0]["publicKey"], | ||
|
|
@@ -203,7 +202,7 @@ def test_standalone_attachment_store( | |
| ), | ||
| pytest.param( | ||
| {"meta_length": None}, | ||
| 273, | ||
| 269, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No more hyphens -> saved some chars. |
||
| "invalid_trace_attachment", | ||
| id="missing_meta_length", | ||
| ), | ||
|
|
@@ -341,9 +340,9 @@ def test_attachment_with_matching_span(mini_sentry, relay): | |
| assert attachment.payload.bytes == combined_payload | ||
| assert attachment.headers == { | ||
| "type": "attachment", | ||
| "length": 260, | ||
| "length": 256, | ||
| "content_type": "application/vnd.sentry.trace-attachment", | ||
| "meta_length": 237, | ||
| "meta_length": 233, | ||
| "span_id": span_id, | ||
| } | ||
|
|
||
|
|
@@ -544,9 +543,9 @@ def test_two_attachments_mapping_to_same_span(mini_sentry, relay): | |
| assert item.payload.bytes == combined_payload | ||
| assert item.headers == { | ||
| "type": "attachment", | ||
| "length": 260, | ||
| "length": 256, | ||
| "content_type": "application/vnd.sentry.trace-attachment", | ||
| "meta_length": 237, | ||
| "meta_length": 233, | ||
| "span_id": span_id, | ||
| } | ||
|
|
||
|
|
@@ -1256,7 +1255,7 @@ def test_attachment_default_pii_scrubbing_meta( | |
| ) | ||
|
|
||
| metadata = { | ||
| "attachment_id": str(uuid.uuid4()), | ||
| "attachment_id": uuid.uuid4().hex, | ||
| "timestamp": ts.timestamp(), | ||
| "filename": "data.txt", | ||
| "content_type": "text/plain", | ||
|
|
@@ -1300,7 +1299,7 @@ def test_attachment_default_pii_scrubbing_meta( | |
| metadata_part = json.loads(payload[:meta_length].decode("utf-8")) | ||
|
|
||
| assert metadata_part == { | ||
| "attachment_id": mock.ANY, | ||
| "attachment_id": metadata["attachment_id"], | ||
| "timestamp": time_within_delta(ts), | ||
| "filename": "data.txt", | ||
| "content_type": "text/plain", | ||
|
|
@@ -1360,7 +1359,7 @@ def test_attachment_pii_scrubbing_meta_attribute( | |
| ) | ||
|
|
||
| metadata = { | ||
| "attachment_id": str(uuid.uuid4()), | ||
| "attachment_id": uuid.uuid4().hex, | ||
| "timestamp": ts.timestamp(), | ||
| "filename": "data.txt", | ||
| "content_type": "text/plain", | ||
|
|
@@ -1394,7 +1393,7 @@ def test_attachment_pii_scrubbing_meta_attribute( | |
| metadata_part = json.loads(payload[:meta_length].decode("utf-8")) | ||
|
|
||
| assert metadata_part == { | ||
| "attachment_id": mock.ANY, | ||
| "attachment_id": metadata["attachment_id"], | ||
| "timestamp": time_within_delta(ts), | ||
| "filename": "data.txt", | ||
| "content_type": "text/plain", | ||
|
|
@@ -1451,7 +1450,7 @@ def test_attachment_pii_scrubbing_body(mini_sentry, relay): | |
| ) | ||
|
|
||
| metadata = { | ||
| "attachment_id": str(uuid.uuid4()), | ||
| "attachment_id": uuid.uuid4().hex, | ||
| "timestamp": ts.timestamp(), | ||
| "filename": "log.txt", | ||
| "content_type": "text/plain", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was largely copied from
TraceId.