Showing 6 changed files with 119 additions and 5 deletions
+2 -2
HealthProbe/Doc/04-project/IMPLEMENTATION_STATUS.md
@@ -27,7 +27,7 @@ There are no real deployments, only test installations. Existing prototype datab
27 27
 | HealthKit capture | Capture now opens one archive observation per user-visible snapshot and attaches HealthKit pages, deleted-object evidence, and type verification to that observation id before finishing it | Continue moving UI/cache reads to archive-backed observation ids |
28 28
 | SQLite archive | Archive v2 schema, snapshot-level observation grouping, differential write path, v2 verification/delete bookkeeping, daily aggregate rebuilds, integrity report, v2 record reads, SQL diff/count/aggregate/provenance/consolidation-evidence APIs, large synthetic diff pagination coverage, formal timing/memory metrics, and XCTest coverage are in place; the legacy `archive_samples` mirror has been removed | Move Snapshots/Data Types from SwiftData previews to archive/cache DTOs |
29 29
 | Core Data cache | Initial programmatic Core Data model, full-cache rebuild service, read DTOs for observation/type/diff/health rows, and Dashboard archive-cache status wiring are in place | Move remaining export/report paths to cache DTOs and add targeted partial invalidation |
30
-| SwiftData cache | Exists; test builds now reset legacy prototype UI/archive/cache stores once for archive v2 so old SwiftData-only snapshots are not treated as backed-up observations | Treat as disposable prototype data; reset/ignore during v2 transition |
30
+| SwiftData cache | Exists; test builds now reset legacy prototype UI/archive/cache stores once for archive v2 so old SwiftData-only snapshots are not treated as backed-up observations. Remaining SwiftData imports are inventoried in [`SwiftData-Retirement-Inventory.md`](SwiftData-Retirement-Inventory.md) | Treat as disposable prototype data; replace Settings/local rows, capture review actions, and navigation handles before removing `ModelContainer` |
31 31
 | UI | Prototype exists; Snapshots/Data Types now default to the local device timeline instead of a multi-device picker. Dashboard status prefers archive/cache observation rows and shows cache health; Snapshots timeline, snapshot detail summaries/type rows, and Data Types list prefer Core Data cache rows when archive observation ids exist; data type detail reads Core Data type/diff summaries and uses SQLite `diffRecords` for paged drill-down; export preview reads the archive export API before showing/exporting JSON; simplified detail mode replaces heavy charts with summary rows on small/accessibility layouts or when enabled in Settings; visible change labels now use neutral new/missing/change-review language, with SwiftData detail cache as transition fallback | Remove remaining SwiftData navigation handles |
32 32
 | Diff/change explanation | Prototype/legacy anomaly logic exists | Move heavy diffing into SQLite and use neutral change classifications |
33 33
 | Export | SQLite export preview, paged JSON writing, SHA256 manifest hashing, and `export_manifests` rows are in place for selected records and observation diffs | Fill remaining recovery-compatible envelope metadata, CSV export, relationship preservation, and reproducibility checks |
@@ -49,7 +49,7 @@ Detailed checkable milestones live in [`Refactoring-Plan.md`](Refactoring-Plan.m
49 49
 - SwiftData currently blocks iOS 15-era device support.
50 50
 - Existing `Anomaly*` model/service names are legacy language.
51 51
 - Some screens still imply snapshot-count monitoring rather than Time Machine inspection.
52
-- Current UI/cache layers still depend on SwiftData prototype models for capture review actions, navigation handles, some charts, and PDF paths.
52
+- Current UI/cache layers still depend on 28 SwiftData-backed files for launch container, local Settings rows, capture review actions, navigation handles, some charts, and PDF paths.
53 53
 - Snapshots timeline, snapshot detail summary/type rows, Data Types list rows, and record drill-down are archive/cache-backed for new archive v2 observations when cache rows exist, but navigation still uses SwiftData snapshot handles during the transition.
54 54
 - Legacy SwiftData-only snapshots can show diffs without archive-backed values; they are now reset for archive v2 test installs rather than migrated.
55 55
 - Capture strategy and some legacy SwiftData transition paths may still decode or cache too much data for low-end devices.
+1 -1
HealthProbe/Doc/04-project/Refactoring-Plan.md
@@ -245,7 +245,7 @@ Acceptance:
245 245
 **Purpose:** Remove prototype persistence from the target architecture.
246 246
 
247 247
 Checklist:
248
-- [ ] Identify all remaining SwiftData imports.
248
+- [x] Identify all remaining SwiftData imports.
249 249
 - [ ] Replace SwiftData models used by active flows.
250 250
 - [ ] Remove/disable `ModelContainer` as required for target builds.
251 251
 - [x] Add prototype-store ignore/delete/reset path for test installs.
+112 -0
HealthProbe/Doc/04-project/SwiftData-Retirement-Inventory.md
@@ -0,0 +1,112 @@
1
+# SwiftData Retirement Inventory
2
+
3
+**Last Updated:** 2026-05-25
4
+
5
+This inventory supports Milestone 9 in [`Refactoring-Plan.md`](Refactoring-Plan.md).
6
+SwiftData is legacy/prototype infrastructure only. The target app must launch
7
+and run active Time Machine flows from SQLite archive + Core Data cache, with
8
+local settings stored outside SwiftData where needed.
9
+
10
+## Current Count
11
+
12
+After removing unused imports from pure legacy services, 28 app files still have
13
+SwiftData imports.
14
+
15
+## Launch Container
16
+
17
+These files keep SwiftData required at app launch:
18
+
19
+- `HealthProbe/HealthProbeApp.swift`
20
+- `HealthProbe/ContentView.swift`
21
+
22
+Retirement path:
23
+- move local settings models (`DeviceProfile`, `MetricTimeoutProfile`,
24
+  `OperationLog`) to non-SwiftData storage or Core Data cache/local store;
25
+- replace prototype snapshot model dependencies in tab roots;
26
+- remove `.modelContainer(...)` once no active view needs `@Query` or
27
+  `ModelContext`.
28
+
29
+## Legacy Model Definitions
30
+
31
+These files define SwiftData `@Model` classes and are the largest retirement
32
+block:
33
+
34
+- `HealthProbe/Models/AnomalyRecord.swift`
35
+- `HealthProbe/Models/DeviceProfile.swift`
36
+- `HealthProbe/Models/HealthRecord.swift`
37
+- `HealthProbe/Models/HealthSnapshot.swift`
38
+- `HealthProbe/Models/MetricTimeoutProfile.swift`
39
+- `HealthProbe/Models/OperationLog.swift`
40
+- `HealthProbe/Models/SnapshotDelta.swift`
41
+- `HealthProbe/Models/TypeCount.swift`
42
+- `HealthProbe/Models/TypeDelta.swift`
43
+- `HealthProbe/Models/TypeDistributionBin.swift`
44
+- `HealthProbe/Models/YearlyCount.swift`
45
+
46
+Retirement path:
47
+- replace `HealthSnapshot`, `TypeCount`, `SnapshotDelta`, `TypeDelta`,
48
+  `YearlyCount`, `TypeDistributionBin`, and `HealthRecord` active reads with
49
+  archive/cache DTOs;
50
+- replace `AnomalyRecord` flows with neutral change/diff DTOs;
51
+- move `DeviceProfile`, `MetricTimeoutProfile`, and `OperationLog` to a local
52
+  non-SwiftData store before removing the launch container.
53
+
54
+## Capture And Maintenance Services
55
+
56
+These services still write/read legacy SwiftData transition models:
57
+
58
+- `HealthProbe/Services/DeltaService.swift`
59
+- `HealthProbe/Services/HealthKitService.swift`
60
+- `HealthProbe/Services/ObserverService.swift`
61
+- `HealthProbe/Services/SnapshotLifecycleService.swift`
62
+- `HealthProbe/Utilities/TypeCountArchiveRepair.swift`
63
+
64
+Retirement path:
65
+- make capture persist archive observations first and expose only bridge ids
66
+  while transition UI still exists;
67
+- move timeout learning and operation logging out of SwiftData;
68
+- delete legacy record repair once old SwiftData stores are no longer opened;
69
+- remove snapshot deletion/repair logic after archive/cache navigation replaces
70
+  prototype snapshots.
71
+
72
+## UI And View Models
73
+
74
+These active surfaces still use `@Query`, `ModelContext`, or SwiftData model
75
+types:
76
+
77
+- `HealthProbe/ViewModels/DashboardViewModel.swift`
78
+- `HealthProbe/ViewModels/DataTypeTemporalDistributionViewModel.swift`
79
+- `HealthProbe/Views/Dashboard/DashboardView.swift`
80
+- `HealthProbe/Views/DataTypes/DataTypeTemporalDistributionView.swift`
81
+- `HealthProbe/Views/DataTypes/DataTypesView.swift`
82
+- `HealthProbe/Views/DataTypes/RecordChangeEvolutionChart.swift`
83
+- `HealthProbe/Views/Settings/SettingsView.swift`
84
+- `HealthProbe/Views/Snapshots/DataTypeSnapshotDetailView.swift`
85
+- `HealthProbe/Views/Snapshots/SnapshotDetailView.swift`
86
+- `HealthProbe/Views/Snapshots/SnapshotsView.swift`
87
+
88
+Retirement path:
89
+- replace tab-root `@Query` snapshot lists with Core Data cache observation
90
+  queries plus archive ids;
91
+- replace detail navigation parameters from SwiftData models to observation/type
92
+  DTOs;
93
+- move Settings device profile and timeout profile rows to local non-SwiftData
94
+  storage;
95
+- keep paged record drill-down and export paths on archive APIs.
96
+
97
+## Removed During This Pass
98
+
99
+The following files no longer import SwiftData because they only use already
100
+declared app model types and do not need SwiftData APIs directly:
101
+
102
+- `HealthProbe/Services/AnomalyDetector.swift`
103
+- `HealthProbe/Services/IntegrityService.swift`
104
+
105
+## Next Recommended Slices
106
+
107
+1. Replace Settings local rows (`DeviceProfile`, `MetricTimeoutProfile`) with a
108
+   small non-SwiftData local store so Settings no longer requires `@Query`.
109
+2. Replace `ContentView` preview/container dependency after tab roots stop using
110
+   `@Query`.
111
+3. Move `DashboardView` capture review actions away from `ModelContext`.
112
+4. Replace Snapshots/Data Types navigation handles with archive/cache DTOs.
+4 -0
HealthProbe/Doc/README.md
@@ -37,6 +37,7 @@ Use the chapter map below. Send agents to the narrowest document that matches th
37 37
 | SwiftUI/UI work | [`00-agent-guides/CLAUDE.md`](00-agent-guides/CLAUDE.md) |
38 38
 | Refactoring milestones and sequencing | [`04-project/Refactoring-Plan.md`](04-project/Refactoring-Plan.md) |
39 39
 | Project status and refactoring priorities | [`04-project/IMPLEMENTATION_STATUS.md`](04-project/IMPLEMENTATION_STATUS.md) |
40
+| SwiftData retirement inventory | [`04-project/SwiftData-Retirement-Inventory.md`](04-project/SwiftData-Retirement-Inventory.md) |
40 41
 | Historical UI notes only | [`99-archive/`](99-archive/) |
41 42
 
42 43
 ## Chapters
@@ -87,6 +88,9 @@ Use the chapter map below. Send agents to the narrowest document that matches th
87 88
 - [`04-project/IMPLEMENTATION_STATUS.md`](04-project/IMPLEMENTATION_STATUS.md)
88 89
   Current implementation status and refactoring priorities.
89 90
 
91
+- [`04-project/SwiftData-Retirement-Inventory.md`](04-project/SwiftData-Retirement-Inventory.md)
92
+  Current SwiftData dependency inventory and retirement slices.
93
+
90 94
 ### 99 Archive
91 95
 
92 96
 Files in [`99-archive/`](99-archive/) are historical implementation notes. They are kept for context only and are not product requirements.
+0 -1
HealthProbe/Services/AnomalyDetector.swift
@@ -1,5 +1,4 @@
1 1
 import Foundation
2
-import SwiftData
3 2
 
4 3
 enum AnomalyDetector {
5 4
     struct DetectionResult {
+0 -1
HealthProbe/Services/IntegrityService.swift
@@ -1,5 +1,4 @@
1 1
 import Foundation
2
-import SwiftData
3 2
 
4 3
 enum IntegrityService {
5 4
     enum ValidationResult: Equatable {