Read the build identity (deployment id plus source revision) from the health endpoint once, at the moment the comparison window opens, and store that pair alongside the window.

Tag every metric query in the window with the stored deployment id as a filter, so series from a later promotion cannot leak into the open window.

When health reports a different deployment id, close the current window and start a fresh one instead of trying to split a blended series after the fact.

Render the deployment id on the chart itself, so a reader can see which build every number on the page belongs to.