When racing online with AI and real players the races always end 1 lap early. So a 6 lap race ends at the end of lap 5. This is no matter if the AI are leading or a real player at the front. Its been like this for months now.
Could you please provide info what classes and tracks you drove, are you using rolling or standing start?
i also experienced this quite often with GT3s, GTEs (rolling assisted/automated starts - not sure if it occurs on standing starts too) but i doubt its related to the classes/rules themselves. Think its rather related to the starting point of the lap counter. So iirc you set up 5 laps, the race would end f.e. at the end of whats displayed lap 4 but iirc you actually drove five laps. (cause the first lap is displayed as lap zero) Other games usually display f.e. the first race lap of five as 1/5 instead of 0/5. It would look like this 1/5 2/5 3/5 4/5 5/5 (last lap) I will try to reproduce it when i get around it and i will make sure to follow up here then.
If its intentional it would be cool to get an option of how you want it counted/displayed, cause it seems counter intuitive. Me and my brother were quite often surprised of the race ending abruptly, as we were used to other games (ACC, Gran Turismo etc.)