Skip to content

Release 1.2.0: Diary table migration (phase 18)#7

Merged
Sundypha merged 34 commits intomainfrom
feat/18-01-diary-schema-migration
Apr 14, 2026
Merged

Release 1.2.0: Diary table migration (phase 18)#7
Sundypha merged 34 commits intomainfrom
feat/18-01-diary-schema-migration

Conversation

@Sundypha
Copy link
Copy Markdown
Owner

@Sundypha Sundypha commented Apr 14, 2026

This pull request ships Luma 1.2.0 (minor) and completes phase 18 — diary table migration.

Highlights

  • Schema v5: standalone diary_entries, tag tables, and join rows; v4 upgrade moves personal diary text into the diary table while clinical notes stay on day entries.
  • App: Diary tab, tag settings, and calendar / home / day-detail hooks; Luma backup v2 diary export/import with v1 compatibility for legacy personal notes.
  • Docs: Phase 18 verification notes, Riverpod migration context, roadmap status, and the Cursor release workflow rule.

Release metadata

  • App version 1.2.0+4 from fvm dart run tool/bump_version.dart minor.
  • CHANGELOG.md includes a filled [1.2.0] section (see chore(release): v1.2.0).

Before merge

  • CI is green (Flutter analyze, tests, ARB DE key parity, pubspec policy).
  • Merge to main when you are ready to land the release.
  • Tag v1.2.0 with the Release workflow when you want a published build (if that is your usual ship step).

Sundypha added 30 commits April 14, 2026 00:31
7 plans across 5 execution waves:
- 01: TDD schema migration v4 to v5 (DiaryEntries, DiaryTags, join table)
- 02: DiaryEntryData domain type + DiaryRepository CRUD/streams
- 03: .luma format v2 with diary_entries + backward-compat v1 import
- 04: DiaryFormSheet (text/mood/tags) + symptom form personalNotes removal
- 05: Calendar blue diary dot + Home Today card diary shortcut
- 06: Day detail routing hub (4 states) + DiaryTagsSettingsScreen
- 07: Diary tab screen (paginated list/search/filter) + tab shell integration
- Assert v4 DB with personal_notes upgrades to diary_entries and drops column
- Assert fresh DB exposes five tables without personal_notes on day_entries
- Add DiaryEntries, DiaryTags, DiaryEntryTagJoin; remove personalNotes from DayEntries
- Migrate non-empty personal_notes into diary_entries; drop column via TableMigration
- Sync diary on save/upsert/update/import; export reads diary; watch includes diary stream
- Replace Migrator.recreateTable with alterTable(TableMigration) for Drift 2.32
- Add 18-01-SUMMARY with outcomes, deviations, and self-check
- Point STATE/ROADMAP at phase 18 progress (1/7 plans)
…yEntryData.personalNotes

- Introduce DiaryEntryData and DiaryTag in diary_types.dart
- Remove personalNotes from DayEntryData equality and string form
- Adjust logging_types_test inequality case to differ on clinical notes
… off DayEntryData

- Name Drift row classes DiaryEntryRow/DiaryTagRow to avoid clashing with domain
- Implement DiaryRepository (streams, pagination, tags, seedStarterTags)
- Stop merging diary text into DayEntryData in PeriodRepository watch/saves
- Symptom form preloads and persists personal notes via DiaryRepository
- Export diary types and repository from ptrack_data; simplify day_entry_mapper
- Fix widget tests (mock DB, UTC today cell finder, home VM today alignment)
- Add 18-02-SUMMARY.md with outcomes, deviations, and self-check
- Advance STATE.md and ROADMAP.md for phase 18 plan 02
- Bump lumaFormatVersion to 2; add ExportOptions.includeDiary
- Add ExportedDiaryEntry, ExportedDiaryTag; LumaExportData.diary_entries
- Export new types from ptrack_data; extend schema tests
- ExportService writes diary_entries with tags; drop personal_notes from day JSON
- ImportService merges diary_entries; accept format 1 meta; v1 personal_notes fallback
- Export wizard Diary switch maps to ExportOptions.includeDiary; EN/DE strings
- Extend export/import tests (v1 compat, content_types, progress counts)
- Add 18-03-SUMMARY.md; advance STATE and ROADMAP for phase 18 plan 03
- Add modal diary form with notes, discrete mood slider, tag chips, and inline tag creation
- Add EN/DE ARB strings for diary form labels and delete confirmation
- Regenerate app localizations
- Drop diary coupling from SymptomFormViewModel and SymptomFormSheet
- Remove symptom personal-notes ARB keys and regenerate l10n
- Update symptom form view model unit tests
- Add 18-04-SUMMARY.md with task commits, deviations, and self-check
- Advance STATE and ROADMAP for phase 18 plan 04 completion
- Add CalendarDayData.hasDiaryEntry and diaryDates merge in buildCalendarDayDataMap
- CalendarViewModel subscribes to DiaryRepository.watchAllEntries and passes dates into day map
- Paint primary diary dot in cell strip; show diary in confidence legend with EN/DE label
- Create DiaryRepository in main and pass through TabShell to calendar and home VMs
- HomeViewModel subscribes to diary stream for reactive todayDiaryEntry (UI in next commit)
- Update tests with MockDiaryRepository and TabShell diaryRepository
- TodayCard shows write/edit diary ListTile with optional notes preview
- Wire showDiaryFormSheet with diaryRepository and today UTC day
- Add homeDiaryNewEntry and homeDiaryEditEntry EN/DE ARB strings
- Add 18-05-SUMMARY for calendar dot and Home diary shortcut
- Update STATE position to 18-06 next and 5/7 phase progress
- Mark 18-05 complete in ROADMAP phase 18 plan list
- Expose diaryEntryForDay and populate entries map from diary stream
- Past/today sheet branches on period and diary with dual-mood summary
- Wire diary actions to showDiaryFormSheet after sheet pop
- Add EN/DE strings for period vs diary actions and mood labels
- List tags from watchTags with rename, delete confirm, and add row
- Empty state with shortcut to focus new-tag field
- EN/DE strings including duplicate/empty validation messages
- Add 18-06-SUMMARY for day detail hub and tag settings screen
- Advance STATE and ROADMAP to 6/7 phase-18 plans; next 18-07
- Paginated loading with search, tag, and date-range filters
- List UI with FAB, filter icon, and localized strings (EN/DE)
- Third nav destination, DiaryViewModel lifecycle, starter tag seeding
- Shell AppBar title/actions and FAB on Diary tab (no nested Scaffold)
- Settings drawer tile for DiaryTagsSettingsScreen; EN/DE ARB for tags menu
- 18-07-SUMMARY.md for diary tab and TabShell integration
- STATE.md and ROADMAP.md: 7/7 plans, phase 18 closed
…them

Some backups declare format_version 2 but still include personal_notes on
day_entries (older writers or mixed exports). Import previously gated diary
migration on format < 2 only, so those notes never reached diary_entries.

Also copy mood into the catch-up insert when a diary row is created only in
the final pass.

Tests: add regression for format 2 + legacy personal_notes on day_entries.
… period

DuplicateStrategy.replace (Use imported) still validated imported periods
against all existing spans before inserting, so any calendar overlap with the
DB always failed even when the user explicitly chose to replace data.

When replace is selected and the import candidate overlaps exactly one
existing period, reuse that row id, update start/end from the backup, and
map ref_id to it. Overlap with more than one distinct DB period remains an
error with an explicit message.

DuplicateStrategy.skip behavior for period overlap is unchanged (reject).

Tests: reuse + span update, multi-overlap error, skip overlap rejection.
Diary FAB passed no existing row, so the form treated today as new and
saveEntry overwrote the current record. Load getEntryForDate with the same
calendar key as showDiaryFormSheet before presenting the sheet.
Sundypha and others added 4 commits April 14, 2026 02:10
DiaryViewModel only loaded paginated rows once and never listened for new
rows, so saves from calendar, day detail, or home left the Diary tab stale.

Subscribe to watchAllEntries, replace the in-memory list on each emission,
and add getAllEntries for one-shot reload. loadNextPage is a no-op; scroll
still works because the full list is present.

Also guard the diary FAB after the async getEntryForDate with context.mounted.
Add schema v5 diary tables and migration from v4, repository and import/export paths for diary data and older backups, diary screens and view model reload behavior, roadmap status, phase verification notes, and Riverpod migration context for follow-on work.

Co-Authored-By: Claude <noreply@anthropic.com>
Bump app version to 1.2.0+4 and document the diary table migration release in CHANGELOG.md.

Co-Authored-By: Claude <noreply@anthropic.com>
Stub DiaryRepository calls from TabShell and DiaryViewModel (seedStarterTags, watchEntryCount, pagination, tags, getEntryForDate). Update day-detail expectations for Edit period record and Add diary entry; tap Edit period record from calendar day sheet. Assert Diary bottom-nav label.

Co-Authored-By: Claude <noreply@anthropic.com>
@Sundypha Sundypha merged commit dd3e9d1 into main Apr 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant