Repository navigation
sleep: list deleted nights on iOS and macOS, with recompute and hide - #2660
UtkuDenizAltiok wants to merge 2 commits into
Conversation
|
Thanks for this, @UtkuDenizAltiok. Careful work, and the write-up made it quick to check. One defect worth addressing before merge, one wording point, and a trivial rebase. Worth noting first: this wires up two functions that were sitting on main with no callers at all. I confirmed on Verified clean
1. An orphaned hidden entry can leave a night deleted with no row to reopen itThere is a third route by which a marker disappears, besides the two that now unhide. I built a harness over the real That is the invariant It needs roughly 500 tombstones to reach, so this is narrow rather than urgent. The cause is structural though, and worth naming: Apple keeps one fact in two independently mutated lists, where Android's 2. The recompute note asserts more than the pass can deliver
Kotlin's Not a finding, but worth stating as a decisionAndroid shows four toasts here and this ports the two success halves. That looks defensible to me: Android needs its two failure strings because the DAO write returns a row count that can be zero, whereas on Apple both the hide and the reopen are pure array rewrites into the defaults with no failure to report. Worth a line in the description so it reads as a choice rather than an oversight. Happy to take this once the first point is addressed, in whatever form you prefer. A rebase is needed for the catalogue regardless. |
A deleted night keeps a marker so the detector does not bring it back, and the undo strip lasts seven seconds. After that a night deleted by mistake could not come back on Apple platforms. Android has had a persistent list since ryanbr#526/ryanbr#679; this brings the same card to the shared SleepView: - each deleted night, newest first, "d MMM, HH:mm – d MMM, HH:mm"; - "Recompute this night" lifts the marker and re-scores, so the detector finds the night again in the raw data (a footnote says an imported night with no raw data may not return); - "Hide" takes the row off the list and keeps the marker, so a sleep deleted on purpose stays deleted. Android stores that as the managementVisible column; here the markers live in the defaults, so the hidden ones are a second token list beside them, pruned to markers that still stand and cleared when a marker is lifted (recompute or undo). The card and the undo strip also show on the empty screen, which is where deleting the only recorded night lands. Strings reuse Android's, in all nine locales, with the computer-sense "sleep" in pl/pt-PT corrected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3869d0b to
e9ee598
Compare
|
Addressed in e9ee598, after rebasing onto 9f98f81. A fresh delete now clears its hidden entry beside the marker write. The new test uses the actual Repository delete path: it reproduces the 500-marker eviction case, makes room, re-deletes that window, and checks a repeated delete too. Its four visibility/unhide assertions fail before the fix and pass afterwards. Recompute now reports only "Deletion marker cleared." The card states that the scan covers the most recent 21 days and retains the raw-sample caveat. I kept the normal scan window rather than expanding one click into a full-history pass. The description also explains the two success notes: Apple rewrites defaults arrays, while Android's additional failure toasts correspond to its DAO row counts. The catalogue was merged by key; all upstream entries are unchanged. Full local verification passed, including 2,272 macOS tests (two existing skips, zero failures on this Mac) and the iOS build. The simulator also showed a fresh deleted row after an orphaned hidden entry and the undo strip expired, and the older-window action showed the revised note. Both new messages are compiled in all ten locales on both Apple targets. |
A deleted night could only come back through the seven-second undo strip; after that the deletion marker kept the detector from finding it again for good. The Sleep screen now lists each deleted night whose marker still stands. "Recompute this night" lifts the marker (allowSleepReDetection) and rescans the recent 21 days; "Hide" takes the row off the list and keeps the marker, so a night deleted on purpose stays deleted. The undo strip and the list also show on the empty screen, where deleting the only night lands. From upstream PR ryanbr#2660 by @UtkuDenizAltiok, fitted to the fork's Sleep screen: the list sits under the undo strip of the reworked layout, loads with the fork's night task, and the recompute goes through the dashboard app model without day reuse, since lifting a marker changes no raw input a fingerprint would notice. The fork's multi-night undo also unhides every restored night. Analysis migration required: no
|
Hey @ryanbr, the changes from your review are in and all checks are passing. This would be a useful safety net for iPhone and Mac users: if someone deletes a night by mistake and misses the short undo window, they still have a way to lift the deletion and try detecting it again. The card also explains the scan limit. I’d appreciate another look when you have time. |
What this PR does
On iOS and macOS, a deleted night could only be brought back from the undo strip, which lasts seven seconds. After that, a night deleted by mistake was gone for good: the deletion marker keeps the detector from finding it again, and nothing on screen could lift it. Android has had a persistent list since #526 and #679. This brings the same card to the shared
SleepView:Repository.allowSleepReDetection, which already existed with no caller) and runs the normal scan of the most recent 21 days. The card names that limit and says an imported night without raw samples may not return; the success note reports only "Deletion marker cleared."Android stores "hidden" as the
managementVisiblecolumn ofdismissedSleep. On Apple platforms the markers live in the defaults (sleep.dismissedSessions), so the hidden ones are a second token list beside them (sleep.dismissedSessions.hiddenFromList).DeletedSleepList(pure, tested) keeps it to markers that still stand. Lifting a marker clears its hidden entry, whether by recompute or undo. A fresh deletion also unhides its window, including when an old hidden token outlived a marker evicted by the 500-marker cap. The detector reads only the markers, so hiding never changes what is detected.The card, and the undo strip, also show on the empty screen. That is where deleting the only recorded night lands, and nothing there could bring it back before.
Strings: Android's, in all nine locales. In Polish and Portuguese, Android's versions use the computer sense of "sleep" ("uśpienie", "suspensão"), and one Portuguese line leaves "sleep" in English. Those are corrected here to the words the iOS catalog already uses ("sen", "sono"). Android's own strings are untouched.
Apple shows two success notes: marker cleared and row hidden. Android also has two failure toasts because its DAO reports an affected-row count that can be zero. Apple rewrites defaults arrays for these actions, so it has no matching row-count failure to report.
Type of change
How it was tested
DeletedSleepListTests, 5): list order and malformed markers; hiding keeps suppression; hidden-list pruning; reopening unhides; and the actualRepository.deleteSleepSessionpath unhides both a standing marker and a hidden token whose marker was evicted by the 500-marker cap. The last test fills the real capped list, evicts the oldest hidden night, makes room, re-deletes it, then checks a repeated delete too. On the pre-fix code its four visibility/unhide assertions fail; the marker and stored-row checks still pass.e9ee598e, rebased onto current upstream9f98f811: WhoopStore 632 · StrandAnalytics 2135 · StrandImport 327 (one existing skip) · doc lint · i18n · parity ledger · parity ratchet · parity governance 127 · macOSStrandTests2,272 (two existing skips, zero failures on this Mac) · iOS build. Both new keys are in compilerSleepView.stringsdataand all ten built macOS/iOSLocalizable.stringsfiles. Every upstream catalogue entry is unchanged.Checklist
StrandDesigntokens — no hardcoded colors, fonts, or spacingdocs/CONTRIBUTING.mdStrand.xcodeproj/) or any secrets/keystoresRelated issues
Refs #515