@@ -138,6 +138,11 @@ def all_numeric_test_time_series(all_test_time_series: TimeSeriesList) -> TimeSe
138138 return TimeSeriesList ([ts for ts in all_test_time_series if ts .is_string is False ])
139139
140140
141+ @pytest .fixture
142+ def all_instance_id_time_series (all_test_time_series : TimeSeriesList ) -> TimeSeriesList :
143+ return TimeSeriesList ([ts for ts in all_test_time_series if ts .instance_id is not None ])
144+
145+
141146@pytest .fixture
142147def outside_points_ts (all_test_time_series : TimeSeriesList ) -> TimeSeriesList :
143148 return all_test_time_series [:2 ]
@@ -861,6 +866,27 @@ def test_iterating_object_aggregates(
861866 assert list (map (len , dps_lst )) == [17 , 9 , 4 ]
862867
863868
869+ class TestRetrieveUsingChunkingMode :
870+ def test_combining_instance_ids_with_other_identifier_types_could_report_missing (
871+ self , cognite_client : CogniteClient , all_instance_id_time_series : TimeSeriesList
872+ ) -> None :
873+ instance_ids = [ts .instance_id for ts in all_instance_id_time_series if ts .instance_id is not None ]
874+ assert len (instance_ids ) == 3
875+ # Bug prior to 7.86.0, when mixing instance IDs with other identifier types in the same request,
876+ # and some of these other were missing, the instance IDs would be reported as missing too.
877+ with patch (DATAPOINTS_API .format ("EagerDpsFetcher" )): # Ensure chunking mode by patching out eager
878+ with pytest .raises (CogniteNotFoundError ) as err :
879+ cognite_client .time_series .data .retrieve (
880+ id = list (range (1 , 11 )),
881+ external_id = [f"nope-doesnt-exist-{ i } " for i in range (10 )],
882+ instance_id = instance_ids ,
883+ ignore_unknown_ids = False ,
884+ )
885+ assert len (err .value .not_found ) == 20
886+ for missing in err .value .not_found :
887+ assert ("id" in missing or "external_id" in missing ) and "instance_id" not in missing
888+
889+
864890class TestRetrieveRawDatapointsAPI :
865891 """Note: Since `retrieve` and `retrieve_arrays` endpoints should give identical results,
866892 except for the data container types, all tests run both endpoints except those targeting a specific bug
0 commit comments