Skip to content

Harden linkcheck release-asset extract against partial downloads - #218

Merged
mmcky merged 1 commit into
mainfrom
harden-linkcheck-extract
Jul 7, 2026
Merged

mmcky merged 1 commit into
mainfrom
harden-linkcheck-extract

Conversation

@mmcky

@mmcky mmcky commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Ports the hardening from QuantEcon/lecture-dp#39 (a Copilot-review follow-up) to keep the two repos' link-check workflows in sync.

Why

The fetch step ran curl -sSL "$asset_url" | tar -xz -C _site || true. Under set -eo pipefail, the || true swallows a failed or truncated download/extract — which can leave a partial _site tree where count > 0, so lychee runs against an incomplete site and re-introduces exactly the "file not found" false positives this workflow was fixed to avoid.

Change

Use curl -f (fail on HTTP errors) and an if ! guard that clears _site on any download/extract failure, so a bad fetch is treated as "no usable asset" and surfaced by the existing empty-input guard (which reports "release asset missing") rather than silently checking a half-extracted site.

Single-line-of-logic change to .github/workflows/linkcheck.yml; no behavioural change on the happy path.

🤖 Generated with Claude Code

A failed or truncated `curl | tar` was swallowed by `|| true`, potentially
leaving a partial _site tree where count > 0 — so lychee would run against an
incomplete site and re-introduce 'file not found' false positives. Use `curl
-f` and an `if !` guard that clears _site on failure, so a bad download is
treated as 'no usable asset' and reported via the guard.

Ports the hardening from QuantEcon/lecture-dp#39 (Copilot review follow-up).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 7, 2026 11:42
@netlify

netlify Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploy Preview for sparkly-moxie-de1f0e ready!

Name Link
🔨 Latest commit 0e46efd
🔍 Latest deploy log https://app.netlify.com/projects/sparkly-moxie-de1f0e/deploys/6a4ce62cb9c719000894adb9
😎 Deploy Preview https://deploy-preview-218--sparkly-moxie-de1f0e.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Jul 7, 2026

Copy link
Copy Markdown

Deploy Preview for adorable-cucurucho-69162b ready!

Name Link
🔨 Latest commit 0e46efd
🔍 Latest deploy log https://app.netlify.com/projects/adorable-cucurucho-69162b/deploys/6a4ce62ceca5cd00081e7dfe
😎 Deploy Preview https://deploy-preview-218--adorable-cucurucho-69162b.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the link-check workflow’s “download + extract latest release HTML” step so a failed or truncated release-asset fetch cannot leave a partially extracted _site tree that would cause lychee to report false positives.

Changes:

  • Switches the asset fetch to curl -f to fail on HTTP errors.
  • Wraps the curl | tar pipeline in an if ! ...; then guard that wipes _site on any download/extract failure, ensuring the existing “empty-input” guard surfaces the problem as “release asset missing” instead of silently proceeding.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 7, 2026 11:48 Inactive
@mmcky
mmcky merged commit a4260bc into main Jul 7, 2026
11 checks passed
@mmcky
mmcky deleted the harden-linkcheck-extract branch July 7, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants