6.5 KiB
6.5 KiB
Report template
Write {AUDIT_DIR}/REPORT.md with this structure. Every table cell that names a file must be a real, project-relative path that exists. Pull content from library/*.md, occurrences.tsv, ledger.tsv and audit.sh tree output — not from memory, not from docs.
# <App name> — Architecture Audit
_Audited <date> from source at <project path> (<git short SHA if available>). Files in scope: N; read: N; contributed: N; redundant: N; trivial: N; skipped: N._
_Source of truth: implementation only. Documentation was not used as evidence._
## 1. At a glance
3–6 bullets: what the app is, the architectural style in one line, UI toolkit, async model, DI, data layer, module count.
## 2. Build & toolchain
| Item | Value | Source |
|---|---|---|
| AGP / Gradle / Kotlin / JDK | … | `gradle/libs.versions.toml` |
| compileSdk / minSdk / targetSdk | … | … |
| Modules | N (list or link to §3) | `settings.gradle.kts` |
| Build types / flavors | … | … |
| Annotation processing | KSP / KAPT | … |
## 3. File tree organization
- **Scheme:** e.g. "multi-module, package-by-feature: `:feature:*` (UI+VM), `:core:*` (data, network, db, designsystem), `:app` (wiring)". State whether packaging is by feature, by layer, or mixed, with evidence.
- A trimmed tree (modules → key packages, file counts), ≤40 lines, from `audit.sh tree`.
- Module dependency direction (Mermaid `graph` or arrow list) if multi-module.
- Naming conventions observed, and notable outliers.
## 4. Implementation summary
| Category | Implementation details | Code pointers |
|---|---|---|
| UI | Jetpack Compose (Material 3), custom theme in `:core:designsystem`; Coil for images | `feature/home/.../HomeScreen.kt`, `core/designsystem/.../Theme.kt` |
| Navigation | Navigation Compose 2.8 type-safe routes; one NavHost | `app/.../AppNavHost.kt` |
| Networking | Retrofit + OkHttp, auth interceptor, kotlinx.serialization converter | `core/network/.../NetworkModule.kt`, `.../AuthInterceptor.kt` |
| Concurrency | Coroutines + Flow; injected dispatchers; `stateIn(WhileSubscribed)` in VMs | … |
| … one row per category that has findings: architecture, serialization, persistence, DI, background work, platform integration, security/auth, observability, testing, build | | |
Rules: "Implementation details" names concrete libraries/mechanisms (+version when known) and, when a category has competing approaches, lists both with rough prevalence ("StateFlow in 14 VMs, LiveData in 3 legacy VMs"). "Code pointers" = 1–3 exemplar files that best show the category (the exemplars from the library, preferring the clearest over the first-seen).
## 5. Features (user perspective)
| Feature | What it lets the user do | Entry point |
|---|---|---|
| Sign in | Log in with email/password or Google; stays signed in across launches | `feature/auth/.../LoginScreen.kt` |
| … | | |
Include user-perceivable background features (sync, notifications, widgets, share targets, deep links). Group by area if > 15 rows.
## 6. Architecture & data flow
- Layering as implemented (UI → VM → UseCase? → Repository → DataSource), with one traced example end-to-end citing each file in the chain.
- State management shape (UiState / events / effects).
- Offline/caching strategy, source of truth.
- Optional Mermaid diagram.
## 7. Module interactions
How modules call each other and what data crosses each boundary, from `library/module-interactions.md` (prevalence from `occurrences.tsv`). In a single-module app, use top-level feature/layer packages as the units and say so.
### 7.1 User-facing interactions
Started by a user action or feeding what's on screen. Group rows by feature (matching §5) when there are more than ~10.
| From → To | Purpose | Mechanism | Data passed (in → out) | Trigger | Code pointers |
|---|---|---|---|---|---|
| `:feature:home` → `:core:data` | Load the feed | Injected `FeedRepository`, collected as `Flow` | `—` → `Flow<List<FeedItem>>` (entity → domain mapped in `:core:data`) | Screen open, pull-to-refresh | `feature/home/.../HomeViewModel.kt:42`, `core/data/.../FeedRepositoryImpl.kt` |
| `:feature:home` → `:feature:detail` | Open an item | Nav route with args | `itemId: String` | Tap on item | `feature/home/.../HomeNavigation.kt` |
### 7.2 Background interactions
No user waiting: workers, services, receivers, push, alarms, startup init, observers of shared storage.
| From → To | Purpose | Mechanism | Data passed (in → out) | Trigger | Code pointers |
|---|---|---|---|---|---|
| `:sync` → `:core:network` → `:core:database` | Refresh cache | `CoroutineWorker` calls API, writes Room | `SyncRequest` → `List<FeedDto>` → `FeedEntity` rows | Periodic WorkManager, 6h, unmetered | `sync/.../SyncWorker.kt` |
### 7.3 Interaction map
A Mermaid `graph LR` of modules, with edges labelled by purpose and data type. Draw user-facing edges solid (`-->`) and background edges dashed (`-.->`). Keep it to the edges in the tables. If there are more than ~25, draw one diagram per group.
### 7.4 Notes
- Shared state reached through more than one path (e.g. a Room table written by a worker and observed by a screen): say which module owns it.
- Module dependencies that no interaction uses (possibly dead), and layer violations, with paths.
## 8. Observations
- **Inconsistencies / migrations in progress** (two ways of doing the same thing, with counts).
- **Risks & tech debt** (with paths).
- **Strengths** worth preserving.
## 9. Coverage & method
How many files were in scope, read, and contributed; what was excluded and why (generated code, resources counted not read: `resource-counts.tsv`); how many subagents/batches. Location of the library: `{AUDIT_DIR}/library/`.
## 10. Usage & duration
Paste `usage.md` verbatim: wall-clock duration, per-phase durations, and the token table per harness / session kind / model, with the total row. Below it, add one line per caveat that applies:
- Tokens for writing this report fall after `finish` and are not included.
- The run was resumed across sessions, so wall clock includes idle time.
- A local model (vLLM/Ollama) reports no cache hits, so its input shows as uncached.
- Another audit or unrelated work ran in the same session during the window, so the session row includes that.
After writing the file, print to the terminal: section 1, the Implementation summary table, the Features table, the two Module interactions tables (or their first ~10 rows each, if long), the top 3–5 observations, the duration and token total row from §10, and the path to REPORT.md.