Overview › Module Dependencies & API Surface
Module Dependencies & API Surface
Detailed static-analysis report for module dependencies & api surface.
Executive summary
Costco Android has 56 modules (1 app + 22 features + 30 shared + 3 core/lib). The graph is densely connected — features import 15-24 shared modules each — and the public-API discipline of those shared modules is poor: shared/sdui exposes ~209 public top-level declarations with only 0-2% marked internal. Three shared modules (util, blankutil, common) have overlapping responsibilities. feature/savings appears to be a candidate for consolidation.
Module fan-in (most-depended-upon shared modules)
These are the modules every feature touches. Changes ripple far.
| Shared module | Fan-in (dependents) | Risk |
|---|---|---|
shared/storage | 20 | High — any change touches everything |
shared/statemanagement | 18 | High |
shared/common | 14 | High |
shared/ui | 13 | High |
shared/pallet | 7 | Medium |
Heavy-coupled features (highest fan-out)
| Feature module | Shared deps | Notes |
|---|---|---|
feature/account | 24 | Couples to auth, data, featurehelper, sdui, security, geofence |
feature/discover | 16 | |
feature/warehouse | 15 | |
feature/dmc | 15 |
Findings
HIGH
Overlapping shared utility modules
shared/util (8 lines, depends on core/core + shared/storage) and shared/blankutil (UI-leaning utilities) and shared/common (general utilities) have unclear boundaries. New utility code likely lands in the closest module by accident.
Recommendation: Merge into a single
shared/util module with sub-packages (util/text, util/time, util/format, util/ui). Run a one-time package move + internal sweep to firewall implementation details.HIGH
Public API leaks in shared modules
| Module | Public decl. | Internal decl. | Encapsulation |
|---|---|---|---|
shared/sdui | ~209 | ~0-2 | CRITICAL <1% |
shared/auth | 139 | 11 | MEDIUM 8% |
shared/common | 86 | 3 | HIGH 3.5% |
shared/data | 11 | 2 | PASS 18% |
Recommendation: Define each module's public surface explicitly (a top-level
api/ package). Mark everything else internal. Use Kotlin's -Xexplicit-api=strict compiler flag on shared modules.MEDIUMPossibly orphan module:
Possibly orphan module: feature/savings
Only depends on
shared/translation, only consumed by feature/warehouse. Either deprecate or absorb into feature/warehouse.Recommendation: Confirm with product whether
feature/savings still ships separately; if not, retire the module.MEDIUM
Heavy feature coupling
feature/account imports 24 shared modules. Changes anywhere in shared/* have a high probability of forcing recompiles or bugs in Account.Recommendation: Introduce module-level interfaces that account depends on (anti-corruption layer). Convert direct imports of
shared/sdui implementation classes into interface-only imports.INFO
No dependency-graph artifact in CI
Modularization at this scale benefits from a generated module graph in CI to detect new cycles and unintended dependencies.
Recommendation: Add the
kotlinx-dataframe-driven dependency-graph Gradle plugin (or Ben Mansfield's module-graph-assert) to generate a Mermaid graph per build and fail PRs that introduce new cycles.Costco Android · Code Review Report · Generated 2026-05-07 · 626 machine-curated findings