Harden linkcheck release-asset extract against partial downloads - #218
Merged
Merged
Conversation
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>
✅ Deploy Preview for sparkly-moxie-de1f0e ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for adorable-cucurucho-69162b ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
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 -fto fail on HTTP errors. - Wraps the
curl | tarpipeline in anif ! ...; thenguard that wipes_siteon 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.
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.
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. Underset -eo pipefail, the|| trueswallows a failed or truncated download/extract — which can leave a partial_sitetree wherecount > 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 anif !guard that clears_siteon 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