Confusing tense in verb+ところ construct


> 二分遅れて着いていたら列車に **乗り遅れるところ** だった。  
>  If I had arrived two minutes later, I would have just missed the train.

I'm struggling to understand why this sentence uses 乗り遅れる rather than 乗り遅れた.
At the time when I am two minutes late, I have already missed the train. The
action of 乗り遅れる is already complete, so I would have expected 乗り遅れた.

I would have translated this as "I would have been just about to miss the
train", suggesting that maybe the train left 3 minutes late.

Is my understanding of verb+ところ wrong? Does the counterfactual scenario maybe
change how the grammar works? Or are both 乗り遅れる and 乗り遅れた acceptable here?

**Edit**

I've looked at the linked answer and this more recent
[post](https://japanese.stackexchange.com/questions/92763/can-%E9%81%85%E3%82%8C%E3%81%A6%E3%81%84%E3%82%8B-be-
used-
in-%E6%96%B0%E5%B9%B9%E7%B7%9A%E3%81%AB%E4%B9%97%E3%82%8A%E9%81%85%E3%82%8C%E3%82%8B%E3%81%A8%E3%81%93%E3%82%8D%E3%81%A7%E3%81%97%E3%81%9F)
but still I remain rather confused. Here's another attempt to explain my
confusion.

If I consider just

> 列車に乗り遅れるところだった

If I'm not mistaken it means

> I was just about to miss the train

That is to say, I had not yet missed the train at the time being discussed.
But somehow, adding 二分遅れて着いていたら in front changes things so that, in the
hypothetical situation, I have already missed the train.

If the answer is simply "that's just the way it is" then that's fine. But I'd
like to be sure I'm not missing some logical explanation.




With or without the hypothetical condition, or whether in the real world or in
an alternative one that didn’t happen, there is a time at which you are still
facing the risk of missing your train in that scenario. I think you can simply
understand 乗り遅れ **る** ところ as referring to a situation seen from that
standpoint.

You could use a past form putting yourself at a later point in the
hypothetical scenario where you have already missed the train. However, 乗り遅れ
**ていた** ところ is much more natural than 乗り遅れ **た** ところ when you talk about a
counterfactual event. 乗り遅れ **た** ところ is normally understood as meaning you
have really just missed the train. 乗り遅れ **ていた** ところ puts focus on the
(undesirable) resulting state of the event, rather than the event itself.

> 二分遅れて着いていたら列車に乗り遅れ **ていた** ところだった。

This sentence sounds a bit redundant, or simply longer than necessary, to me,
though. I would probably use the present tense in the main clause.

> 二分遅れて着いていたら列車に乗り遅れ **ていた** ところ **だ** 。




You understand it just right, but here it is just the way it works: 〜る＋ところだった.

I think, you cannot use 〜た＋ところ in this case.

I see it as "I was standing just there(ところ), about to do something but happily
I didn't".

