Additional display of a key change before repetitions placed before the barline

Is this what you want to achieve? I added a bar after the A, set D minor KS, removed the barline before the key signature, removed the rests, and made a small spacing adjustment in Engrave mode.

Cautionnary.dorico (474,0 Ko)