Skip to content

Commit 78fd909

Browse files
ref(debug-files): Assume server supports all formats (#2955)
### Description All debug file formats have been supported for at least three years, so with the Sentry CLI 3.0 release, all servers we support will support all debug file formats. Therefore, checking supported formats is no longer needed. ### Issues - Resolves #2953 - Resolves [CLI-229](https://linear.app/getsentry/issue/CLI-229/assume-server-supports-all-debug-file-formats)
1 parent 9f10666 commit 78fd909

File tree

6 files changed

+4
-143
lines changed

6 files changed

+4
-143
lines changed

src/api/data_types/chunking/dif.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,21 +52,6 @@ pub struct ChunkedDifResponse {
5252
#[serde(transparent)]
5353
pub struct AssembleDifsRequest<'a>(HashMap<Digest, ChunkedDifRequest<'a>>);
5454

55-
impl AssembleDifsRequest<'_> {
56-
/// Strips the debug_id from all requests in the request. We need
57-
/// to strip the debug_ids whenever the server does not support chunked
58-
/// uploading of PDBs, to maintain backwards compatibility. The
59-
/// calling code is responsible for calling this function when needed.
60-
///
61-
/// See: https://github.com/getsentry/sentry-cli/issues/980
62-
/// See: https://github.com/getsentry/sentry-cli/issues/1056
63-
pub fn strip_debug_ids(&mut self) {
64-
for r in self.0.values_mut() {
65-
r.debug_id = None;
66-
}
67-
}
68-
}
69-
7055
impl<'a, T> FromIterator<T> for AssembleDifsRequest<'a>
7156
where
7257
T: Into<ChunkedDifRequest<'a>>,

src/api/data_types/chunking/upload/capability.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ use serde::{Deserialize, Deserializer};
22

33
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
44
pub enum ChunkUploadCapability {
5-
/// Chunked upload of debug files
6-
DebugFiles,
7-
85
/// Chunked upload of release files
96
ReleaseFiles,
107

@@ -15,21 +12,6 @@ pub enum ChunkUploadCapability {
1512
/// upload.
1613
ArtifactBundlesV2,
1714

18-
/// Upload of PDBs and debug id overrides
19-
Pdbs,
20-
21-
/// Upload of Portable PDBs
22-
PortablePdbs,
23-
24-
/// Uploads of source archives
25-
Sources,
26-
27-
/// Upload of BCSymbolMap and PList auxiliary DIFs
28-
BcSymbolmap,
29-
30-
/// Upload of il2cpp line mappings
31-
Il2Cpp,
32-
3315
/// Upload of Dart symbol maps
3416
DartSymbolMap,
3517

@@ -49,15 +31,9 @@ impl<'de> Deserialize<'de> for ChunkUploadCapability {
4931
D: Deserializer<'de>,
5032
{
5133
Ok(match String::deserialize(deserializer)?.as_str() {
52-
"debug_files" => ChunkUploadCapability::DebugFiles,
5334
"release_files" => ChunkUploadCapability::ReleaseFiles,
5435
"artifact_bundles" => ChunkUploadCapability::ArtifactBundles,
5536
"artifact_bundles_v2" => ChunkUploadCapability::ArtifactBundlesV2,
56-
"pdbs" => ChunkUploadCapability::Pdbs,
57-
"portablepdbs" => ChunkUploadCapability::PortablePdbs,
58-
"sources" => ChunkUploadCapability::Sources,
59-
"bcsymbolmaps" => ChunkUploadCapability::BcSymbolmap,
60-
"il2cpp" => ChunkUploadCapability::Il2Cpp,
6137
"dartsymbolmap" => ChunkUploadCapability::DartSymbolMap,
6238
"preprod_artifacts" => ChunkUploadCapability::PreprodArtifacts,
6339
"proguard" => ChunkUploadCapability::Proguard,

src/api/data_types/chunking/upload/options.rs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub struct ChunkServerOptions {
2323
pub concurrency: u8,
2424
#[serde(default)]
2525
pub compression: Vec<ChunkCompression>,
26-
#[serde(default = "default_chunk_upload_accept")]
26+
#[serde(default)]
2727
pub accept: Vec<ChunkUploadCapability>,
2828
}
2929

@@ -32,18 +32,4 @@ impl ChunkServerOptions {
3232
pub fn supports(&self, capability: ChunkUploadCapability) -> bool {
3333
self.accept.contains(&capability)
3434
}
35-
36-
/// Determines whether we need to strip debug_ids from the requests. We need
37-
/// to strip the debug_ids whenever the server does not support chunked
38-
/// uploading of PDBs, to maintain backwards compatibility.
39-
///
40-
/// See: https://github.com/getsentry/sentry-cli/issues/980
41-
/// See: https://github.com/getsentry/sentry-cli/issues/1056
42-
pub fn should_strip_debug_ids(&self) -> bool {
43-
!self.supports(ChunkUploadCapability::DebugFiles)
44-
}
45-
}
46-
47-
fn default_chunk_upload_accept() -> Vec<ChunkUploadCapability> {
48-
vec![ChunkUploadCapability::DebugFiles]
4935
}

src/utils/chunks/options.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ impl<'a> ChunkOptions<'a> {
3131
self
3232
}
3333

34-
pub fn should_strip_debug_ids(&self) -> bool {
35-
self.server_options.should_strip_debug_ids()
36-
}
37-
3834
pub fn org(&self) -> &str {
3935
self.org
4036
}

src/utils/chunks/upload.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ where
5353
T: AsRef<[u8]> + Assemblable,
5454
{
5555
let api = Api::current();
56-
let mut request: AssembleDifsRequest<'_> = objects.iter().collect();
57-
58-
if options.should_strip_debug_ids() {
59-
request.strip_debug_ids();
60-
}
56+
let request: AssembleDifsRequest<'_> = objects.iter().collect();
6157

6258
let response =
6359
api.authenticated()?
@@ -188,10 +184,7 @@ where
188184

189185
let assemble_start = Instant::now();
190186

191-
let mut request: AssembleDifsRequest<'_> = chunked_objects.iter().copied().collect();
192-
if options.should_strip_debug_ids() {
193-
request.strip_debug_ids();
194-
}
187+
let request: AssembleDifsRequest<'_> = chunked_objects.iter().copied().collect();
195188

196189
let response = loop {
197190
let response =

src/utils/dif_upload/mod.rs

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use zip::result::ZipError;
3434
use zip::ZipArchive;
3535

3636
use self::error::ValidationError;
37-
use crate::api::{Api, ChunkServerOptions, ChunkUploadCapability};
37+
use crate::api::{Api, ChunkServerOptions};
3838
use crate::config::Config;
3939
use crate::constants::{DEFAULT_MAX_DIF_SIZE, DEFAULT_MAX_WAIT};
4040
use crate::utils::chunks;
@@ -1267,14 +1267,9 @@ pub struct DifUpload<'a> {
12671267
zips_allowed: bool,
12681268
max_file_size: u64,
12691269
max_wait: Duration,
1270-
pdbs_allowed: bool,
1271-
portablepdbs_allowed: bool,
1272-
sources_allowed: bool,
12731270
include_sources: bool,
1274-
bcsymbolmaps_allowed: bool,
12751271
wait: bool,
12761272
upload_il2cpp_mappings: bool,
1277-
il2cpp_mappings_allowed: bool,
12781273
no_upload: bool,
12791274
}
12801275

@@ -1308,14 +1303,9 @@ impl<'a> DifUpload<'a> {
13081303
zips_allowed: true,
13091304
max_file_size: DEFAULT_MAX_DIF_SIZE,
13101305
max_wait: DEFAULT_MAX_WAIT,
1311-
pdbs_allowed: false,
1312-
portablepdbs_allowed: false,
1313-
sources_allowed: false,
13141306
include_sources: false,
1315-
bcsymbolmaps_allowed: false,
13161307
wait: false,
13171308
upload_il2cpp_mappings: false,
1318-
il2cpp_mappings_allowed: false,
13191309
no_upload: false,
13201310
}
13211311
}
@@ -1465,69 +1455,9 @@ impl<'a> DifUpload<'a> {
14651455
.min(Duration::from_secs(chunk_options.max_wait));
14661456
}
14671457

1468-
self.pdbs_allowed = chunk_options.supports(ChunkUploadCapability::Pdbs);
1469-
self.portablepdbs_allowed = chunk_options.supports(ChunkUploadCapability::PortablePdbs);
1470-
self.sources_allowed = chunk_options.supports(ChunkUploadCapability::Sources);
1471-
self.bcsymbolmaps_allowed = chunk_options.supports(ChunkUploadCapability::BcSymbolmap);
1472-
self.il2cpp_mappings_allowed = chunk_options.supports(ChunkUploadCapability::Il2Cpp);
1473-
1474-
if !chunk_options.supports(ChunkUploadCapability::DebugFiles) {
1475-
anyhow::bail!(
1476-
"Your Sentry server does not support chunked uploads for debug files. Please upgrade \
1477-
your Sentry server, or if you cannot upgrade your server, downgrade your Sentry \
1478-
CLI version to 2.x."
1479-
);
1480-
}
1481-
1482-
self.validate_capabilities();
14831458
upload_difs_chunked(self, chunk_options)
14841459
}
14851460

1486-
/// Validate that the server supports all requested capabilities.
1487-
fn validate_capabilities(&mut self) {
1488-
// Checks whether source bundles are *explicitly* requested on the command line.
1489-
if (self
1490-
.formats
1491-
.contains(&DifFormat::Object(FileFormat::SourceBundle))
1492-
|| self.include_sources)
1493-
&& !self.sources_allowed
1494-
{
1495-
warn!("Source uploads are not supported by the configured Sentry server");
1496-
self.include_sources = false;
1497-
}
1498-
1499-
// Checks whether PDBs or PEs were *explicitly* requested on the command line.
1500-
if (self.formats.contains(&DifFormat::Object(FileFormat::Pdb))
1501-
|| self.formats.contains(&DifFormat::Object(FileFormat::Pe)))
1502-
&& !self.pdbs_allowed
1503-
{
1504-
warn!("PDBs and PEs are not supported by the configured Sentry server");
1505-
// This is validated additionally in .valid_format()
1506-
}
1507-
1508-
// Checks whether Portable PDBs were *explicitly* requested on the command line.
1509-
if self
1510-
.formats
1511-
.contains(&DifFormat::Object(FileFormat::PortablePdb))
1512-
&& !self.portablepdbs_allowed
1513-
{
1514-
warn!("Portable PDBs are not supported by the configured Sentry server");
1515-
// This is validated additionally in .valid_format()
1516-
}
1517-
1518-
// Checks whether BCSymbolMaps and PLists are **explicitly** requested on the command line.
1519-
if (self.formats.contains(&DifFormat::BcSymbolMap)
1520-
|| self.formats.contains(&DifFormat::PList))
1521-
&& !self.bcsymbolmaps_allowed
1522-
{
1523-
warn!("BCSymbolMaps are not supported by the configured Sentry server");
1524-
}
1525-
1526-
if self.upload_il2cpp_mappings && !self.il2cpp_mappings_allowed {
1527-
warn!("il2cpp line mappings are not supported by the configured Sentry server");
1528-
}
1529-
}
1530-
15311461
/// Determines if this `DebugId` matches the search criteria.
15321462
fn valid_id(&self, id: DebugId) -> bool {
15331463
self.ids.is_empty() || self.ids.contains(&id)
@@ -1542,11 +1472,6 @@ impl<'a> DifUpload<'a> {
15421472
fn valid_format(&self, format: DifFormat) -> bool {
15431473
match format {
15441474
DifFormat::Object(FileFormat::Unknown) => false,
1545-
DifFormat::Object(FileFormat::Pdb) if !self.pdbs_allowed => false,
1546-
DifFormat::Object(FileFormat::Pe) if !self.pdbs_allowed => false,
1547-
DifFormat::Object(FileFormat::SourceBundle) if !self.sources_allowed => false,
1548-
DifFormat::Object(FileFormat::PortablePdb) if !self.portablepdbs_allowed => false,
1549-
DifFormat::BcSymbolMap | DifFormat::PList if !self.bcsymbolmaps_allowed => false,
15501475
format => self.formats.is_empty() || self.formats.contains(&format),
15511476
}
15521477
}

0 commit comments

Comments
 (0)