@@ -4473,6 +4473,40 @@ it.layer(layerSharedApplicationDataPlaneTest)("snooze projection", (it) => {
44734473 assert . deepEqual ( thread . snoozedAt , firstSnoozedAt ) ;
44744474 assert . deepEqual ( thread . updatedAt , firstUpdatedAt ) ;
44754475
4476+ yield * orchestrator . dispatch ( {
4477+ type : "thread.unsnooze" ,
4478+ commandId : CommandId . make ( "runtime-layer-snoozed-thread-wake" ) ,
4479+ threadId,
4480+ reason : "user" ,
4481+ } ) ;
4482+ const manuallyAwakened = yield * orchestrator . getThreadProjection ( threadId ) ;
4483+ const wakeAt = manuallyAwakened . thread . lastSnoozeWakeAt ;
4484+ assert . isNotNull ( wakeAt ) ;
4485+ assert . isNull ( manuallyAwakened . thread . snoozedUntil ) ;
4486+ assert . deepEqual ( manuallyAwakened . thread . unsettledAt , firstProjection . thread . unsettledAt ) ;
4487+ const projections = yield * ProjectionStore . ProjectionStoreV2 . pipe (
4488+ Effect . provide ( ProjectionStore . layer ) ,
4489+ ) ;
4490+ const candidate = ( yield * projections . getSettlementCandidates ( threadId ) ) [ 0 ] ;
4491+ assert . deepEqual ( candidate ?. lastSnoozeWakeAt , wakeAt ) ;
4492+ yield * TestClock . adjust ( "10 seconds" ) ;
4493+ yield * orchestrator . dispatch ( {
4494+ type : "thread.unsnooze" ,
4495+ commandId : CommandId . make ( "runtime-layer-snoozed-thread-wake-again" ) ,
4496+ threadId,
4497+ reason : "user" ,
4498+ } ) ;
4499+ assert . deepEqual (
4500+ ( yield * orchestrator . getThreadProjection ( threadId ) ) . thread . lastSnoozeWakeAt ,
4501+ wakeAt ,
4502+ ) ;
4503+ yield * orchestrator . dispatch ( {
4504+ type : "thread.snooze" ,
4505+ commandId : CommandId . make ( "runtime-layer-snoozed-thread-snooze-after-wake" ) ,
4506+ threadId,
4507+ snoozedUntil,
4508+ } ) ;
4509+
44764510 yield * orchestrator . dispatch ( {
44774511 type : "message.dispatch" ,
44784512 createdBy : "user" ,
@@ -5055,6 +5089,10 @@ it.layer(layerTest)("usage-limit recovery", (it) => {
50555089 } else {
50565090 assert . isNull ( armedShell . snoozedUntil ) ;
50575091 assert . isNull ( armedShell . snoozedAt ) ;
5092+ assert . deepEqual (
5093+ ( yield * orchestrator . getThreadProjection ( threadId ) ) . thread . lastSnoozeWakeAt ,
5094+ yield * DateTime . now ,
5095+ ) ;
50585096 assert . isTrue ( armedShell . limitRecovery ! . autoResume ) ;
50595097 }
50605098 }
0 commit comments