Express that an event in the past could have occurred, if not for some condition How do I express that an event in the past could have occurred, if not for some other condition that prevented it from occurring?
For example:

We could have deployed the code on Tuesday, but our tests were failing.
I would have bought groceries, if my car had not broken down.
He almost passed the test; unfortunately he ran out of time.
She might have finished the race, however she was dehydrated.

In English we have a lot of different words that can be substituted in for the bolded words above.
What is the simplest way to express this pattern?
What are some other variations that can also express this pattern?
All the conjunctions in the examples you stated are applicable in Chinese

but = 但是/但
Example: [本來][X][但][Y] = [originally][X][but][Y]

~

if not for = 如果不是/如非 (literary)
Example: [如非][Y][那][X] = [If not for] [Y] [then] [X]

~

unfortunately = 可惜
Example: [應該是/應該會][X][可惜][Y] = [should be][X][unfortunately][Y]

~

however = 不過/只不過
Example: [原本][X][不過][Y] = [originally][X][however][Y]

X = event should had happened; Y = reason it didn't happened
Other example:
[明明][X][卻][Y] = [clearly][X][but][Y]
[本應][X][最後][Y]= [originally should][X][at the end][Y]
Y= what ended up happened instead
Depend on the context, some conjunctions are interchangeable
Examples:
[本來][X][但][Y] --&gt; [本來][X][不過][Y]
[應該是][X][可惜][Y] --&gt; [應該是][X][不過][Y]