@@ -266,8 +266,7 @@ def test_format_activity_display_with_activities(self):
266266 assert "P" in display # primary indicator
267267 assert "Legend:" in display
268268 assert "Trend:" in display # new trend column explanation
269- assert "CP Start:" in display # checkpoint start column
270- assert "CP End:" in display # checkpoint end column
269+ assert "Partition:" in display # new partition column explanation
271270
272271 def test_format_activity_display_empty (self ):
273272 """Test formatting activity display with no data"""
@@ -382,6 +381,50 @@ def test_primary_replica_separation(self):
382381 # This test prevents the bug where we mixed primary CP End with replica CP Start
383382 # which created fake deltas like 129434 - 15876 = 113558
384383
384+ def test_partition_separation (self ):
385+ """Test that partitions within the same table/shard are tracked separately"""
386+ # Create snapshots with same table/shard but different partitions
387+ snapshot1 = [
388+ # Partition 1
389+ self .create_test_snapshot ("TURVO" , "appointmentFormFieldData_events" , 0 , "data-hot-8" , True , 32684 , 100.0 ),
390+ # Partition 2 (same table/shard/node/type but different partition)
391+ self .create_test_snapshot ("TURVO" , "appointmentFormFieldData_events" , 0 , "data-hot-8" , True , 54289 , 100.0 ),
392+ ]
393+
394+ # Modify partition_ident for the snapshots to simulate different partitions
395+ snapshot1 [0 ].partition_ident = "04732dpl6osj8d1g60o30c1g"
396+ snapshot1 [1 ].partition_ident = "04732dpl6os3adpm60o30c1g"
397+
398+ snapshot2 = [
399+ # Partition 1 progresses
400+ self .create_test_snapshot ("TURVO" , "appointmentFormFieldData_events" , 0 , "data-hot-8" , True , 32800 , 130.0 ), # +116 delta
401+ # Partition 2 progresses
402+ self .create_test_snapshot ("TURVO" , "appointmentFormFieldData_events" , 0 , "data-hot-8" , True , 54400 , 130.0 ), # +111 delta
403+ ]
404+
405+ # Set partition_ident for second snapshot
406+ snapshot2 [0 ].partition_ident = "04732dpl6osj8d1g60o30c1g"
407+ snapshot2 [1 ].partition_ident = "04732dpl6os3adpm60o30c1g"
408+
409+ activities = self .monitor .compare_snapshots (snapshot1 , snapshot2 , min_activity_threshold = 1 )
410+
411+ # Should have 2 separate activities (partitions tracked separately)
412+ assert len (activities ) == 2
413+
414+ # Verify deltas are calculated correctly for each partition
415+ partition1_activity = next (a for a in activities if "04732dpl6osj8d1g60o30c1g" in a .snapshot1 .shard_identifier )
416+ partition2_activity = next (a for a in activities if "04732dpl6os3adpm60o30c1g" in a .snapshot1 .shard_identifier )
417+
418+ assert partition1_activity .local_checkpoint_delta == 116 # 32800 - 32684
419+ assert partition2_activity .local_checkpoint_delta == 111 # 54400 - 54289
420+
421+ # Verify they have different shard identifiers due to partition
422+ assert partition1_activity .snapshot1 .shard_identifier != partition2_activity .snapshot1 .shard_identifier
423+ assert ":04732dpl6osj8d1g60o30c1g" in partition1_activity .snapshot1 .shard_identifier
424+ assert ":04732dpl6os3adpm60o30c1g" in partition2_activity .snapshot1 .shard_identifier
425+
426+ # This test prevents mixing partitions which would create fake activity measurements
427+
385428 def test_format_activity_display_watch_mode (self ):
386429 """Test that watch mode excludes legend and insights"""
387430 snapshot1 = self .create_test_snapshot ("schema1" , "table1" , 1 , "node1" , True , 1000 , 100.0 )
@@ -404,13 +447,13 @@ def test_format_activity_display_watch_mode(self):
404447 normal_display = self .monitor .format_activity_display ([activity ], show_count = 10 , watch_mode = False )
405448 assert "Legend:" in normal_display
406449 assert "Insights:" in normal_display
407- assert "CP Start :" in normal_display
450+ assert "Checkpoint Δ :" in normal_display
408451
409452 # Test watch mode (should exclude legend and insights)
410453 watch_display = self .monitor .format_activity_display ([activity ], show_count = 10 , watch_mode = True )
411454 assert "Legend:" not in watch_display
412455 assert "Insights:" not in watch_display
413- assert "CP Start:" not in watch_display
456+ assert "Checkpoint Δ" in watch_display # Core data should still be present
414457
415458 # But should still contain the core data
416459 assert "Most Active Shards" in watch_display
0 commit comments