Harden the package-publish pipeline against stuck/corrupted PRs#11423
Harden the package-publish pipeline against stuck/corrupted PRs#11423borisschlosser wants to merge 2 commits into
Conversation
Follow-up to #11410 (which sanitizes malformed Hugo shortcode delimiters on fetch). Three independent hardening changes: P1: One PR per provider instead of one per run. new-provider-version-pr used a per-run branch name embedding ${github.run_id}, so every publish run opened a brand-new branch and PR. Failing publishes piled up (e.g. 24 stacked megaport PRs over two weeks). Use a stable per-provider branch so peter-evans/create-pull-request UPDATES the existing PR; a fixed or failed render is auto-replaced by the next run. P2: Fail fast on malformed delimiters, everywhere. scripts/lint/check-shortcode-delimiters.js scans every content markdown file (including the auto-generated provider _index.md pages, which the front-matter linter skips) for "{{ <" / "{{ %" and fails with a clear file:line error instead of a cryptic whole-site Hugo build abort. Wired into `make lint-markdown` so the existing "Lint Markdown" CI job runs it. Unit-tested with node:test. P3: Avoid stale CDN edges on fetch. readRemoteFile now sends Cache-Control/Pragma: no-cache so intermediary caches revalidate. The original corruption reached us via a stale CloudFront edge that served a pre-re-render object; this reduces the chance of fetching stale docs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Registry Review — PR #11423Thanks for the thorough write-up and tests. This is a well-scoped, defense-in-depth follow-up to #11410, and all three changes are independently sound. Nothing blocking — a few minor observations below. What looks good
Observations (non-blocking) 1. Automerge is only (re)enabled on 2. 3. BUILD-AND-DEPLOY.md currency. This PR adds a new 4. Trivial: test naming. In Overall this is clean, well-tested, and ready once the automerge persistence assumption (1) is confirmed. Mention me (@claude) if you'd like another pass or want me to draft any of the above changes. |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Your site preview for commit 99916e8 is ready! 🎉 http://registry--origin-pr-11423-99916e83.s3-website.us-west-2.amazonaws.com/registry. |
Follow-up to #11410. After megaport@1.10.1 stacked 24 failing publish PRs (and ~25 auto-filed failure issues) over two weeks from a single malformed Hugo shortcode delimiter, these three independent changes harden the pipeline so it can't happen the same way again. Each is small and self-contained.
P1 — One PR per provider instead of one per run
new-provider-version-prembedded${{ github.run_id }}in the branch name, so every publish run opened a fresh branch + PR. A persistently failing publish therefore piled up indefinitely (24 megaport PRs).Switch to a stable per-provider branch (
<provider>/publish-metadata).peter-evans/create-pull-requestthen updates the existing PR each run, so there's at most one open publish PR per provider and a fixed/newer render auto-replaces a broken one.P2 — Fail fast on malformed delimiters, everywhere
A single
{{ </{{ %(stray space) aborts the entire Hugo site build with a cryptic shortcode error — and the existing front-matter linter skips the auto-generated provider_index.mdfiles (those carrying the# WARNING: this file was fetched fromheader), which are exactly the ones that get corrupted.New
scripts/lint/check-shortcode-delimiters.jsscans every content markdown file for malformed opening delimiters and fails with a clearfile:linemessage. Wired intomake lint-markdown, so the existing Lint Markdown CI job runs it on every PR. The matcher mirrorsresourcedocsgen'ssanitizeShortcodeDelimitersand is unit-tested withnode:test(6 cases, incl. a Go-template{{ .Value }}negative case).P3 — Avoid stale CDN edges on fetch
The original corruption reached us via a stale CloudFront edge serving a pre-re-render object even after the origin was fixed.
readRemoteFilenow sendsCache-Control: no-cache/Pragma: no-cacheso intermediary caches revalidate. (CloudFront may ignore client no-cache depending on config, so this is a low-cost mitigation on top of the #11410 guard, not a guarantee.)Tests
cmd:TestReadRemoteFileSendsNoCacheHeaders(httptest asserts the request headers) + existing guard tests — fullresourcedocsgensuite green;go vet/gofmtclean.scripts/lint:node --test check-shortcode-delimiters.test.js→ 6/6;make lint-shortcode-delimitersgreen on the current tree (819 files, 0 malformed) and exits 1 on an injected malformed file.🤖 Generated with Claude Code