Skip to content

fix(e2e): prune smoke-post URLs from sitemap on cms-publish-flow cleanup - #1667

Merged
Adam-S-Daniel merged 1 commit into
mainfrom
claude/fix-cms-publish-flow-sitemap
May 24, 2026
Merged

fix(e2e): prune smoke-post URLs from sitemap on cms-publish-flow cleanup#1667
Adam-S-Daniel merged 1 commit into
mainfrom
claude/fix-cms-publish-flow-sitemap

Conversation

@Adam-S-Daniel

Copy link
Copy Markdown
Owner

Summary

Fixes the intermittent image-alt-text 404 that's been failing the required e2e-admin check on unrelated PRs (most recently #1654):

expected 200 from /blog/e2e-publish-flow-smoke/, got 404

Root cause — test-isolation bug, shared _site/:

  • 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. That bakes /blog/e2e-publish-flow-smoke/ (and the auto-generated /tags/e2e-smoke-flow-tag/ archive) into _site/sitemap.xml.
  • Its cleanup (removeSmokePost) deleted the rendered _site/blog/<slug>/ dirs but not the sitemap entries — leaving them advertised-but-404ing.
  • image-alt-text.spec.js runs in the same e2e-admin job, shares that _site/, walks sitemap.xml, and 404s on the orphan. It's order-dependent (fails when cms-publish-flow happens 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 bounds cms/* preview-alias DNS slugs in deploy-preview.yml).

Fix

  • Extend removeSmokePost() to prune the orphaned <url> blocks from _site/sitemap.xml, keeping the sitemap consistent with what's on disk.
  • Extracted the prune into a pure, unit-tested helper e2e/sitemap-prune.js (+ e2e/sitemap-prune.test.js), and registered both in select-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-match
  • select-specs.test.js passes with the new rules (53 tests)
  • End-to-end simulation against the real built _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> balanced
  • CI e2e-admin green (the point of the fix)

https://claude.ai/code/session_01Bj5DjryAqCqW4czqyZ47f8


Generated by Claude Code

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
@github-actions github-actions Bot added the cms/draft Content draft — not ready for publish label May 24, 2026
@Adam-S-Daniel
Adam-S-Daniel merged commit 0c5907e into main May 24, 2026
17 checks passed
@github-actions github-actions Bot added the not-decap-created PR was not created by Decap CMS (head branch is not cms/<col>/<slug>) label May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cms/draft Content draft — not ready for publish not-decap-created PR was not created by Decap CMS (head branch is not cms/<col>/<slug>)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants