# Cross-Referencing Decompiled APK Against Target Codebase

When the user wants to fix a regression or copy a feature from a reference APK, follow this pattern:

## 1. Trace the Reference Pipeline First
Identify the complete data flow in the decompiled APK:
- Data source (API call) → data model → transformation → UI rendering
- Find the normalization/bridge points (where raw data becomes display-ready)
- Note exact URLs, keys, sizes, and cache configs

## 2. Trace the Target Pipeline
Map the same flow in the user's codebase:
- Start at catalog/data source entry points
- Follow the data through mappers, normalizers, and Room/Postgres layers
- End at the Coil/Glide display composable

## 3. Diff at Each Layer
| Layer | Reference (DebridStream) | Target (NexStream) |
|---|---|---|
| API call | TMDB with api_key= in query | TMDB with api_key= in query |
| Raw data → meta | h3.m object | MetaPreview / HomeMetaItem |
| Image normalization | h3.u.a(url, isBackdrop) | CatalogImageNormalizer |
| JSON → entity | C0682l0.d(JSON) | AddonRepository / TmdbApi |
| Coil display | ImageRequest size(384,576) crossfade=false | CatalogPosterImage |

## 4. Identify Gaps
Common gaps found in NexStream vs DebridStream:
- **TMDB image sizes**: Reference uses w500/w780; NexStream uses w342/w500/w780 (correct for catalog speed)
- **Trakt poster resolution**: Reference passes Trakt CDN URLs through normalizer; NexStream needs TMDB ID lookup for TMDB posters
- **Addon poster passthrough**: Both should pass through valid full URLs unchanged
- **Coil cache key stability**: Both use `memoryCacheKey(url)` — URL must be stable (no query params)
- **Normalizer application point**: Reference applies at JSON creation time; NexStream applies at display time — both valid if complete

## 5. Commit History for Regression
Run `git log --oneline` and `git show <commit> --stat` to find:
- Which commit introduced the normalizer
- Which commit changed image sizes
- Which commit altered catalog provider merging
- Diff the before/after to identify the exact regression point
