fix(e2e): prune smoke-post URLs from sitemap on cms-publish-flow cleanup - #1667
Merged
Conversation
cms-publish-flow.spec.js creates a smoke post via the local Decap backend and runs `jekyll build` into the SHARED _site/ the Playwright webServer serves, which bakes /blog/e2e-publish-flow-smoke/ (and the manufactured /tags/e2e-smoke-flow-tag/ archive) into _site/sitemap.xml. Its cleanup deleted the rendered dirs but NOT those sitemap entries, leaving them advertised-but-404ing. image-alt-text.spec.js runs in the same e2e-admin job, shares that _site/, walks the sitemap, and failed: "expected 200 from /blog/e2e-publish-flow-smoke/, got 404" — an intermittent, order-dependent failure on unrelated PRs (e.g. #1654). Fix: extend removeSmokePost() to prune the orphaned <url> blocks from _site/sitemap.xml so it stays consistent with what's on disk. Extracted the prune into a pure helper (e2e/sitemap-prune.js) with a unit test (e2e/sitemap-prune.test.js); verified against the real built sitemap. Not related to #1665 (e0d0256), which only touches cms/* preview-alias DNS slugs in deploy-preview.yml. https://claude.ai/code/session_01Bj5DjryAqCqW4czqyZ47f8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the intermittent
image-alt-text404 that's been failing the requirede2e-admincheck on unrelated PRs (most recently #1654):Root cause — test-isolation bug, shared
_site/:cms-publish-flow.spec.jscreates a smoke post via the local Decap backend and runsjekyll buildinto the shared_site/the Playwright webServer serves. That bakes/blog/e2e-publish-flow-smoke/(and the auto-generated/tags/e2e-smoke-flow-tag/archive) into_site/sitemap.xml.removeSmokePost) deleted the rendered_site/blog/<slug>/dirs but not the sitemap entries — leaving them advertised-but-404ing.image-alt-text.spec.jsruns in the samee2e-adminjob, shares that_site/, walkssitemap.xml, and 404s on the orphan. It's order-dependent (fails whencms-publish-flowhappens to run first), which is why it surfaced intermittently on PRs that select both admin specs.This is purely a local test artifact — the smoke post is never committed to
main. It is not related to #1665 / e0d0256 (that only boundscms/*preview-alias DNS slugs indeploy-preview.yml).Fix
removeSmokePost()to prune the orphaned<url>blocks from_site/sitemap.xml, keeping the sitemap consistent with what's on disk.e2e/sitemap-prune.js(+e2e/sitemap-prune.test.js), and registered both inselect-specs.js.Test plan
sitemap-prune.test.js(pure node) — prunes the smoke/tag URLs, keeps others, trailing-slash needle doesn't over-match, no-ops on empty/no-matchselect-specs.test.jspasses with the new rules (53 tests)_site/sitemap.xml: injected the 2 smoke entries (9→11 URLs), prune removed exactly those 2 (→9), smoke URLs gone, real posts kept,<url>/</url>balancede2e-admingreen (the point of the fix)https://claude.ai/code/session_01Bj5DjryAqCqW4czqyZ47f8
Generated by Claude Code