Fix rebucketing, seed upgrades, watch pruning, end re-stamping; add model tests

Editing a workout's start date now removes the file at its old month
bucket so the record no longer duplicates on the next reconcile. Seed
reconcile re-checks the tombstone veto before overwriting an upgraded
seed. The watch applies authoritative-empty pushes so remote deletes
prune, and a re-saved finished workout keeps its original end time.
Adds unit tests for the mappers, path bucketing, and status machine.

Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
This commit is contained in:
2026-07-08 07:54:10 -04:00
parent a93cbc30b7
commit 06fa52345b
11 changed files with 697 additions and 8 deletions
+6 -1
View File
@@ -118,8 +118,13 @@ extension WorkoutDocument {
let anyStarted = statuses.contains { $0 != .notStarted }
if allResolved {
// Only stamp the finish time on the *transition* into completed. A workout
// that was already completed (with an `end`) keeps that original end, so
// editing a finished workout which re-runs this recompute with all logs
// still resolved doesn't jump its end forward to now.
let wasCompletedWithEnd = status == WorkoutStatus.completed.rawValue && end != nil
status = WorkoutStatus.completed.rawValue
end = Date()
if !wasCompletedWithEnd { end = Date() }
} else if anyStarted {
status = WorkoutStatus.inProgress.rawValue
end = nil