Skip to content

Commit 14c90db

Browse files
Wire up end to end call path (kafka -> monolith endpoints) (#142)
* Wire up end to end call path (kafka -> monolith endpoints) * update integration tests * add error handling * some minor changes, more to come * feedback * cleanup
1 parent d899e43 commit 14c90db

10 files changed

Lines changed: 1188 additions & 209 deletions

File tree

scripts/test_download_artifact.py

Lines changed: 0 additions & 92 deletions
This file was deleted.

src/launchpad/constants.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,71 @@
11
"""Constants used throughout the Launchpad application."""
22

3+
from enum import Enum
4+
35
# Kafka topic names
46
PREPROD_ARTIFACT_EVENTS_TOPIC = "preprod-artifact-events"
7+
8+
9+
# Error code constants (matching the Django model)
10+
class ProcessingErrorCode(Enum):
11+
"""Error codes for artifact processing (matching the Django model)."""
12+
13+
UNKNOWN = 0
14+
UPLOAD_TIMEOUT = 1
15+
ARTIFACT_PROCESSING_TIMEOUT = 2
16+
ARTIFACT_PROCESSING_ERROR = 3
17+
18+
19+
# Artifact type constants
20+
class ArtifactType(Enum):
21+
"""Artifact types for different platforms and formats."""
22+
23+
XCARCHIVE = 0
24+
AAB = 1
25+
APK = 2
26+
27+
28+
# Retry configuration
29+
MAX_RETRY_ATTEMPTS = 3
30+
31+
# Health check threshold - consider unhealthy if file not touched in 60 seconds
32+
HEALTHCHECK_MAX_AGE_SECONDS = 60.0
33+
34+
35+
class OperationName(Enum):
36+
"""Enum for operation names used in retry logic."""
37+
38+
PREPROCESSING = "preprocessing"
39+
SIZE_ANALYSIS = "size analysis"
40+
41+
42+
class ProcessingErrorMessage(Enum):
43+
"""Fixed set of error messages for artifact processing."""
44+
45+
# Network-related errors
46+
DOWNLOAD_FAILED = "Failed to download artifact from Sentry"
47+
UPLOAD_FAILED = "Failed to upload analysis results to Sentry"
48+
UPDATE_FAILED = "Failed to update artifact info in Sentry"
49+
50+
# Processing-related errors
51+
PREPROCESSING_FAILED = "Failed to extract basic app information"
52+
SIZE_ANALYSIS_FAILED = "Failed to perform size analysis"
53+
ARTIFACT_PARSING_FAILED = "Failed to parse artifact file"
54+
UNSUPPORTED_ARTIFACT_TYPE = "Unsupported artifact type"
55+
56+
# System-related errors
57+
TEMP_FILE_CREATION_FAILED = "Failed to create temporary file"
58+
CLEANUP_FAILED = "Failed to clean up temporary files"
59+
60+
# Timeout errors
61+
PROCESSING_TIMEOUT = "Processing timed out"
62+
63+
# Unknown errors
64+
UNKNOWN_ERROR = "An unknown error occurred"
65+
66+
67+
# Operation to error message mapping
68+
OPERATION_ERRORS = {
69+
OperationName.PREPROCESSING: ProcessingErrorMessage.PREPROCESSING_FAILED,
70+
OperationName.SIZE_ANALYSIS: ProcessingErrorMessage.SIZE_ANALYSIS_FAILED,
71+
}

0 commit comments

Comments
 (0)