Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions src/launchpad/artifact_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ def process_message(
objectstore_client = ObjectstoreClient(service_config.objectstore_url)
artifact_processor = ArtifactProcessor(sentry_client, statsd, objectstore_client)

requested_features = []
for feature in payload.get("requested_features", []):
try:
requested_features.append(PreprodFeature(feature))
except ValueError:
logger.exception(f"Unknown feature {feature}")

if service_config and project_id in service_config.projects_to_skip:
logger.info(f"Skipping processing for project {project_id}")
return
Expand All @@ -127,7 +120,7 @@ def process_message(
statsd.increment("artifact.processing.started")
logger.info(f"Processing artifact {artifact_id} (project: {project_id}, org: {organization_id})")
try:
artifact_processor.process_artifact(organization_id, project_id, artifact_id, requested_features)
artifact_processor.process_artifact(organization_id, project_id, artifact_id)
except Exception:
statsd.increment("artifact.processing.failed")
duration = time.time() - start_time
Expand All @@ -146,7 +139,6 @@ def process_artifact(
organization_id: str,
project_id: str,
artifact_id: str,
requested_features: list[PreprodFeature],
) -> None:
"""Process an artifact with the requested features."""
dequeued_at = datetime.now()
Expand All @@ -172,10 +164,10 @@ def process_artifact(
app_icon_object_id,
)

if PreprodFeature.SIZE_ANALYSIS in requested_features:
if PreprodFeature.SIZE_ANALYSIS in server_requested_features:
self._do_size(organization_id, project_id, artifact_id, artifact, analyzer)

if PreprodFeature.BUILD_DISTRIBUTION in requested_features:
if PreprodFeature.BUILD_DISTRIBUTION in server_requested_features:
self._do_distribution(organization_id, project_id, artifact_id, artifact, info)

@contextlib.contextmanager
Expand Down
8 changes: 6 additions & 2 deletions tests/e2e/mock-sentry-api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ async def update_artifact(
# Track which fields were updated
updated_fields = list(data.keys())

return {"success": True, "artifactId": artifact_id, "updatedFields": updated_fields}
return {
"success": True,
"artifactId": artifact_id,
"updatedFields": updated_fields,
"requestedFeatures": ["size_analysis"],
}


@app.get("/api/0/organizations/{org}/chunk-upload/")
Expand All @@ -165,7 +170,6 @@ async def upload_chunk(
file: UploadFile,
authorization: str = Header(None),
):
"""Upload a file chunk."""
# Read chunk data
chunk_data = await file.read()

Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_kafka_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from aiohttp.test_utils import TestClient, TestServer

from launchpad.artifact_processor import ArtifactProcessor
from launchpad.constants import PREPROD_ARTIFACT_EVENTS_TOPIC, PreprodFeature
from launchpad.constants import PREPROD_ARTIFACT_EVENTS_TOPIC
from launchpad.kafka import LaunchpadKafkaConsumer, create_kafka_consumer, get_kafka_config
from launchpad.service import LaunchpadService, ServiceConfig, get_service_config
from launchpad.utils.statsd import FakeStatsd
Expand Down Expand Up @@ -214,7 +214,6 @@ def test_process_message_with_allowed_project(self):
"test-org",
"normal-project",
"test-123",
[PreprodFeature.SIZE_ANALYSIS],
)

calls = fake_statsd.calls
Expand Down
5 changes: 0 additions & 5 deletions tests/unit/artifacts/test_artifact_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from launchpad.artifact_processor import ArtifactProcessor
from launchpad.constants import (
PreprodFeature,
ProcessingErrorCode,
ProcessingErrorMessage,
)
Expand Down Expand Up @@ -169,7 +168,6 @@ def test_process_message_ios(self, mock_process, mock_sentry_client):
"test-org-123",
"test-project-ios",
"ios-test-123",
[PreprodFeature.SIZE_ANALYSIS],
)

# Verify metrics were recorded
Expand Down Expand Up @@ -210,7 +208,6 @@ def test_process_message_android(self, mock_process, mock_sentry_client):
"test-org-456",
"test-project-android",
"android-test-456",
[PreprodFeature.SIZE_ANALYSIS, PreprodFeature.BUILD_DISTRIBUTION],
)

# Verify metrics were recorded
Expand Down Expand Up @@ -254,7 +251,6 @@ def test_process_message_error(self, mock_process, mock_sentry_client):
"test-org",
"test-project",
"test-123",
[PreprodFeature.SIZE_ANALYSIS, PreprodFeature.BUILD_DISTRIBUTION],
)

# Verify the metrics were called correctly
Expand Down Expand Up @@ -320,7 +316,6 @@ def test_process_message_project_not_skipped(self, mock_process, mock_sentry_cli
"test-org-123",
"normal-project",
"normal-test-123",
[PreprodFeature.SIZE_ANALYSIS, PreprodFeature.BUILD_DISTRIBUTION],
)

# Verify normal metrics were recorded
Expand Down
Loading