@@ -407,7 +407,7 @@ void _syncTests<T>({
407407 containsPair (
408408 'status' ,
409409 containsPair (
410- 'internal_applied_checkpoint_request_id ' , anything))))),
410+ 'internal_last_applied_checkpoint_request_id ' , anything))))),
411411 );
412412 expect (
413413 instructions,
@@ -624,8 +624,8 @@ void _syncTests<T>({
624624 'UpdateSyncStatus' ,
625625 containsPair (
626626 'status' ,
627- containsPair (
628- 'internal_applied_checkpoint_request_id' , anything))))),
627+ containsPair ('internal_last_applied_checkpoint_request_id' ,
628+ anything))))),
629629 );
630630 expect (lastAppliedCheckpointRequestId (), isNull);
631631
@@ -652,13 +652,18 @@ void _syncTests<T>({
652652 ),
653653 ),
654654 );
655+ expect (
656+ appliedInstructions,
657+ contains (containsPair ('LogLine' ,
658+ {'severity' : 'DEBUG' , 'line' : 'Applied checkpoint request id 1' })),
659+ );
655660 expect (
656661 appliedInstructions,
657662 contains (containsPair (
658663 'UpdateSyncStatus' ,
659664 containsPair (
660665 'status' ,
661- containsPair ('internal_applied_checkpoint_request_id ' , 1 ),
666+ containsPair ('internal_last_applied_checkpoint_request_id ' , 1 ),
662667 ),
663668 )),
664669 );
@@ -678,7 +683,7 @@ void _syncTests<T>({
678683 containsPair (
679684 'status' ,
680685 containsPair (
681- 'internal_applied_checkpoint_request_id ' , anything))))),
686+ 'internal_last_applied_checkpoint_request_id ' , anything))))),
682687 );
683688
684689 final [row] = db.select ('select powersync_offline_sync_status();' );
@@ -691,6 +696,29 @@ void _syncTests<T>({
691696 db.select (r"SELECT * FROM ps_buckets WHERE name = '$local'" ), isEmpty);
692697 });
693698
699+ syncTest ('disconnect clears applied checkpoint request id from status' , (_) {
700+ invokeControl ('start' , null );
701+
702+ pushCheckpoint (buckets: priorityBuckets, writeCheckpoint: '1' );
703+ pushCheckpointComplete ();
704+
705+ final instructions = invokeControl ('stop' , null );
706+ expect (
707+ instructions,
708+ contains (containsPair (
709+ 'UpdateSyncStatus' ,
710+ containsPair (
711+ 'status' ,
712+ allOf (
713+ containsPair ('connected' , false ),
714+ isNot (containsPair (
715+ 'internal_last_applied_checkpoint_request_id' , anything)),
716+ ),
717+ ),
718+ )),
719+ );
720+ });
721+
694722 syncTest ('local writes clear checkpoint request high-water marks' , (_) {
695723 invokeControl ('start' , null );
696724
@@ -1160,7 +1188,13 @@ void _syncTests<T>({
11601188
11611189 // Now complete the upload process.
11621190 probeLocalTargetOp (1 );
1163- invokeControl ('completed_upload' , null );
1191+ final uploadCompleteInstructions =
1192+ invokeControl ('completed_upload' , null );
1193+ expect (
1194+ uploadCompleteInstructions,
1195+ contains (containsPair ('LogLine' ,
1196+ {'severity' : 'DEBUG' , 'line' : 'Applied checkpoint request id 1' })),
1197+ );
11641198
11651199 // This should apply the pending write checkpoint.
11661200 expect (fetchRows (), [
0 commit comments