A scheduling change that "replaces the shifts it owns" is only safe when ownership is defined before the write, not discovered during it.
In our open-source project shift-planner, applying a plan to an existing roster is a pure transformation: you get a new roster carrying the plan's shifts, and shifts the plan does not speak for stay untouched. The interesting part is how it decides what it speaks for.
Ownership is a claim, not an identity match. A shift is claimed when two things hold: its worker appears in the frozenset of workers named by the plan's patterns, and the plan's horizon covers the date of the shift's start converted into the plan's own timezone. The day boundary gets drawn in the plan's zone, not the server's and not the shift's. On a distributed team that single choice decides whether a Monday-morning shift belongs to this week's plan or the last one.
Everything unclaimed is kept as-is. The plan's generated shifts are appended. The result is rebuilt through the roster constructor with the rest rule set to the stricter of the two, so drawing a plan can tighten a roster's minimum rest and can never loosen it. That direction matters: planning tooling that can silently relax a safety constraint is a compliance incident waiting for an audit.
Two consequences practitioners will recognise.
First, idempotency falls out for free. Generation depends on the plan alone: walk the horizon day by day, skip holidays, apply limits, build each shift from its pattern in the plan's zone. Apply the same plan twice, get an equal roster. No diffing, no "has this run already" flag.
Second, replacement by claim means a hand-added shift for a planned worker inside the horizon is dropped in favour of what the patterns produce. That is the intended behaviour, and probably the behaviour that surprises people most. The same worker's shift just outside the horizon survives, and then gets validated against the newly generated shifts, which is exactly where insufficient-rest and overlap errors surface. The seam between what the plan owns and what it does not is where the hard failures live, so the validation runs there instead of being skipped as "pre-existing data".
We build a lot of systems where a recalculation has to be re-runnable without damage: payment reconciliation, ledger attribution, compliance re-checks. The pattern comes out the same every time. Define the claim set explicitly, replace only inside it, and make the merge boundary the place you validate hardest.
For teams running recurring recalculations, that is the fork. You either define the replacement scope up front, or you derive it from a diff against current state.