This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Launchpad is a Python-based microservice for analyzing iOS and Android app bundle sizes. It provides detailed analysis of app binaries, generates optimization insights, and offers size breakdowns with visualization. This is a Sentry internal service that processes mobile app artifacts.
Always use uv run to run scripts instead of manually invoking python.
# Setup
devenv sync # or: make install-dev && source .venv/bin/activate
# Code quality (run before committing)
make check # All checks: lint, format, types, deps
make fix # Auto-fix formatting and imports
# Testing
make test # All tests (unit + integration)
make test-unit # Unit tests only
make test-integration # Integration tests only
# Run a single test
uv run pytest tests/unit/path/to/test_file.py::test_function_name -v
uv run pytest tests/unit/path/to/test_file.py -v # whole file
uv run pytest -k "test_name_pattern" -v # by pattern
# CLI usage
launchpad size path/to/app.xcarchive.zip # iOS
launchpad size path/to/app.apk # Android
launchpad size app.xcarchive.zip --skip-swift-metadata --skip-symbols # faster
# Service development
make worker # Start Launchpad worker (TaskWorker mode)- CLI (
src/launchpad/cli.py): Main entry point, uses Click - Worker (
src/launchpad/worker/): TaskWorker — receives tasks via TaskBroker RPC (launchpad worker) - Analyzers (
src/launchpad/size/analyzers/): Platform-specific analysis engines (AppleAppAnalyzer, AndroidAnalyzer) - Parsers (
src/launchpad/parsers/): Binary parsing - Mach-O via LIEF, custom DEX parsers - Insights (
src/launchpad/size/insights/): Optimization recommendations (image compression, symbol stripping, etc.) - Artifacts (
src/launchpad/artifacts/): Artifact handlers - ArtifactFactory creates appropriate handler by file type
- Artifact (
.xcarchive.zip,.apk,.aab) → ArtifactFactory - Platform-specific analyzer extracts binaries, resources, metadata
- Parsers analyze binary structure (symbols, sections, Swift metadata)
- Insights engine generates optimization recommendations
- Results serialized as JSON with treemap visualization data
AppleAnalysisResults/AndroidAnalysisResults: Platform analysis outputAppComponent: Individual app component with size and type infoTreemapElement: Hierarchical size data for visualizationBaseInsightResult: Optimization recommendation with potential savings
- Python 3.13+ with type hints (use
| NonenotOptional) - Ruff for linting/formatting (120 char line length)
- ty for type checking (not mypy)
- Empty
__init__.pyfiles preferred - Comments: Only add comments for complex logic or important business decisions
When handling paths derived from untrusted input (zip member names, plist values, manifest entries, user-supplied filenames), use SafeDirectory from launchpad.artifacts.providers.safe_directory — never use raw Path operations.
SafeDirectory(base).resolve(untrusted)— validates and returns a safePath, raisesUnsafePathErroron traversal attemptsSafeDirectory(base).child(untrusted)— returns a newSafeDirectoryscoped to a validated subdirectory- Trusted operations (glob,
/, iterdir) are delegated directly and don't need validation - Import
UnsafePathErrorfromlaunchpad.artifacts.providers.exceptions
- Prefer integration tests using real artifacts from
tests/_fixtures/over unit tests with mocks - Use pytest fixtures for setup
- Test artifacts include sample iOS (.xcarchive) and Android (.apk/.aab) files
A feature is not complete until:
- All tests pass:
make test-unit - All checks pass:
make check - Code formatted:
make fixif needed
- Create class in
insights/apple/,insights/android/, orinsights/common/ - Implement the
Insightprotocol - Implement
analyze()returning a subclass ofBaseInsightResult - Register in platform analyzer's insight list
- Add integration tests