From dc6d3525faa66ae88a8bb7f74cc0587b68e3fc8c Mon Sep 17 00:00:00 2001 From: Trey t Date: Sat, 25 Apr 2026 10:39:01 -0500 Subject: [PATCH] test: lock down that updateTask no longer writes _tasksByResidence Catches re-introduction of the conditional _tasksByResidence write branch removed in the previous commit. The per-residence cache is deprecated; updateTask must only mutate _allTasks. --- .../tt/honeyDue/data/DataManagerTaskCacheTest.kt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/composeApp/src/commonTest/kotlin/com/tt/honeyDue/data/DataManagerTaskCacheTest.kt b/composeApp/src/commonTest/kotlin/com/tt/honeyDue/data/DataManagerTaskCacheTest.kt index 98722eb..b050dd7 100644 --- a/composeApp/src/commonTest/kotlin/com/tt/honeyDue/data/DataManagerTaskCacheTest.kt +++ b/composeApp/src/commonTest/kotlin/com/tt/honeyDue/data/DataManagerTaskCacheTest.kt @@ -88,6 +88,21 @@ class DataManagerTaskCacheTest { assertEquals("v2", inProgress.tasks.first { it.id == 5 }.title) } + /// Lockdown: updateTask must NOT touch `_tasksByResidence`. That cache + /// is being deleted in Phase 3; until then, updateTask must leave it + /// alone. If a future commit re-introduces the conditional write + /// branch this test catches it. + @Test + fun updateTask_doesNotMutate_tasksByResidence() { + val before = DataManager.tasksByResidence.value + DataManager.updateTask(sampleTask(id = 1, residenceId = 100, column = "upcoming_tasks")) + assertEquals( + before, + DataManager.tasksByResidence.value, + "updateTask must not write to _tasksByResidence — that cache is deprecated" + ) + } + private fun sampleTask( id: Int, residenceId: Int,