docs: document app audit fixes and test coverage

Captures the full audit checklist, all direct fixes applied (router
dedup, PetType canonical import, FAB fix, Czech diacritics, entity
alignment), and the 7 new test files (78 tests) added in this task.
Lists remaining AITM tasks for missing features.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
TrochtaOndrej
2026-03-18 20:18:09 +01:00
parent c425e99ecc
commit 95752b704b
+100
View File
@@ -0,0 +1,100 @@
# App Audit — Fixes & Test Coverage
**Branch**: `NDM-App-231-check-all-task-and-verify-if-is-everything-in-app`
**Commits**: `ed4d988`, `c425e99`
## What Was Done
Full audit of the KittieMobile Flutter app. Small issues fixed in-place; larger missing features queued as AITM tasks.
---
## Direct Fixes Applied
### 1. Router deduplication
**File**: `lib/core/router/routes.dart`, `lib/core/router/app_router.dart`
- Merged duplicate `Routes` class — it existed in both files. Canonical location is now `routes.dart` only.
- Removed unused `Routes.home = '/'` constant (`initialLocation` already uses `Routes.tasks`).
- Deleted orphaned generated files: `app_router.g.dart`, `pet_providers.g.dart`, `task_providers.g.dart` — they were generated by a mismatched Riverpod version and caused compile errors.
### 2. PetType canonical import
**Files**: `lib/features/onboarding/providers/onboarding_providers.dart`, `lib/features/onboarding/screens/onboarding_screen.dart`
- Removed local re-declaration of `PetType` enum in onboarding providers.
- Added import from canonical location: `lib/domain/entities/pet_type.dart`.
### 3. FAB navigation fix
**File**: `lib/features/tasks/screens/tasks_screen.dart`
- FAB was calling `context.push(Routes.addTask)` — the route does not exist as a named route.
- Changed to call `showAddTaskSheet(context)` directly (the bottom sheet function).
### 4. Pet mood display fix
**File**: `lib/features/tasks/screens/tasks_screen.dart`
- `PetBubble` `mood` parameter was receiving `petMood.name` (raw enum string, e.g. `"happy"`).
- Changed to `petMood.emoji` — now shows the actual emoji character.
- `_petMessage` function signature updated to accept `PetMood` enum directly (exhaustive switch, no silent fall-through on future renames).
### 5. Czech diacritics
**Files**: `tasks_screen`, `energy_badge`, `task_card`, `app_shell`, `pet_screen`, `profile_screen`, `zen_screen`, `lib/domain/entities/pet_type.dart`, `lib/shared/utils/czech_date.dart`
- Multiple UI strings had broken diacritics (e.g. `"Přidat úkol"` was corrupted).
- All fixed in-place. `flutter analyze` confirmed no issues after fix.
### 6. Entity alignment with DB schema
**Files**: `lib/domain/entities/task_entity.dart`, `lib/domain/entities/user_entity.dart`
- `TaskEntity.id` and `UserEntity.id` changed from `int` to `String` to match Drift UUID schema.
- `TaskEntity` gained: `photoPath`, `snoozeUntil`, `syncedAt`, `localId`.
- `UserEntity` gained: `deviceId`, `createdAt`, `updatedAt`.
- `TasksNotifier` methods updated to accept `String` ids.
---
## Test Coverage Added
7 new test files, 78 new tests — all passing (162 total with existing).
| File | Tests | Coverage |
|------|-------|----------|
| `test/domain/entities/task_entity_test.dart` | 11 | defaults, `isCompleted`, `copyWith` |
| `test/domain/entities/user_entity_test.dart` | 7 | defaults, `copyWith` |
| `test/domain/entities/pet_state_entity_test.dart` | 12 | defaults, `copyWith` with sentinel pattern |
| `test/domain/entities/task_status_test.dart` | 7 | `fromString` all 5 values + throws on unknown |
| `test/domain/entities/pet_type_test.dart` | 11 | `fromString` all 3 values + unknown→cat fallback, `.emoji`, `.label` |
| `test/shared/utils/czech_date_test.dart` | 8 | `czechDateHeader` known dates, all weekdays, all months |
| `test/shared/utils/kittie_date_utils_test.dart` | 22 | `isToday`, `isTomorrow`, `isOverdue`, `formatRelativeDate`, `getWeekdayLabel`, `getStreakDays` |
---
## Audit Checklist
| Feature | Status |
|---------|--------|
| Onboarding (3-step wizard) | Done |
| Task list + pet bubble + energy bar | Done |
| Add task bottom sheet (4-step) | Done |
| Pet screen | Done |
| Profile screen | Done |
| Zen mode | Done |
| Czech diacritics | Done (fixed in this task) |
| Router / Routes class | Done (fixed in this task) |
| Task persistence → Drift DB | **Missing** → AITM `mmwesrifqrzt` |
| User/onboarding → DB | **Missing** → AITM `mmwet4su7xai` |
| Daily reset energy check-in | **Missing** → AITM `mmwetkuvry2f` |
| Task detail/edit + swipe delete | **Missing** → AITM `mmwetzyqw7lm` |
| L10n ARB CZ+EN | **Missing** → AITM `mmweufu125yi` |
---
## AITM Tasks Created
| AITM ID | Title | Priority |
|---------|-------|----------|
| `mmwesrifqrzt` | Connect AddTask to Drift DB — remove sample tasks | high |
| `mmwet4su7xai` | User/onboarding persistence — save to DB, load on startup | high |
| `mmwetkuvry2f` | Daily reset screen — morning energy check-in | medium |
| `mmwetzyqw7lm` | Task detail/edit screen + swipe-to-delete | medium |
| `mmweufu125yi` | L10n ARB-based CZ/EN locale switching | low |