A sitemap can pass an XML syntax check and still point to URLs that redirect or disagree with the page canonical. A useful release check starts with a small set of URLs whose expected behavior you can explain.
Choose a representative fixture
Include a current article, a legacy page with a known redirect, and one URL with a non-ASCII slug. Store the intended canonical URL for each fixture separately from the sitemap generated by the build. Otherwise both sides of the comparison can inherit the same bug.
Run checks in this order
Parse the XML and collect the URLs under loc. Fail if the expected fixture is missing or appears twice.
Request each listed fixture without silently following redirects. If the site uses a preview domain, map the host explicitly and preserve the path. A production sitemap should list the final URL, rather than a redirect source.
For the indexable fixtures, verify a successful response and compare the page's canonical with the expected production URL.…