Skip to content

fix: resume spec test downloads and show progress#9217

Open
shrirajpawar4 wants to merge 2 commits intoChainSafe:unstablefrom
shrirajpawar4:fix/spec-test-download-resume-progress
Open

fix: resume spec test downloads and show progress#9217
shrirajpawar4 wants to merge 2 commits intoChainSafe:unstablefrom
shrirajpawar4:fix/spec-test-download-resume-progress

Conversation

@shrirajpawar4
Copy link
Copy Markdown

Motivation

download-spec-tests still had the original #6991 behavior on unstable:
same-version interrupted runs were not resumable because completion was tracked
only by a final root version.txt, and download progress was not shown in a
useful way.

Description

This change fixes the downloader in @lodestar/spec-test-util by:

  • tracking completion per archive in a hidden .download-state directory
  • keeping the root version.txt for compatibility
  • resuming same-version interrupted runs by downloading only missing archives
  • downloading through *.tar.gz.part and only marking an archive complete after extraction succeeds
  • adding terminal-safe progress reporting for concurrent downloads
  • falling back to plain milestone logs outside TTY environments
  • ignoring .download-state during spec test iteration so existing spec discovery is unaffected

It also adds targeted unit coverage for:

  • same-version resume
  • legacy version.txt migration
  • failure isolation between archives
  • TTY and non-TTY progress behavior

Closes #6991

AI Assistance Disclosure

I used Codex to inspect the existing downloader, compare it with the stale PR,
design the fix, and generate the initial implementation and tests. I reviewed the final
changes manually.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a resumption mechanism for spec test downloads by tracking progress in a .download-state directory and using marker files for completed extractions. It also adds a DownloadProgressReporter to provide visual progress bars in TTY environments and milestone-based logging elsewhere. A bug was identified where a malformed content-length header could result in a NaN value, leading to a RangeError during progress bar rendering; a suggestion was provided to validate the parsed value before use.

Comment thread packages/spec-test-util/src/downloadTests.ts Outdated
@shrirajpawar4 shrirajpawar4 marked this pull request as ready for review April 14, 2026 17:18
@shrirajpawar4 shrirajpawar4 requested a review from a team as a code owner April 14, 2026 17:18
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e264513642

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +113 to +116
if (!stateDirExists) {
for (const test of testsToDownload) {
fs.closeSync(fs.openSync(getDoneMarkerPath(stateDir, test), "w"));
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Re-check archive completeness before auto-migrating state

This migration path assumes that a matching version.txt with no .download-state always means a fully downloaded legacy dataset, then writes .done markers for every archive. If the hidden state directory is missing for any other reason (for example, copied artifacts that dropped dot-directories or cleanup scripts removing hidden folders), the downloader will silently skip required archives and report the version as complete even when test data is missing. Please validate each archive's extracted content (or force re-download) before creating all done markers.

Useful? React with 👍 / 👎.

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.

Improve experience of download-spec-tests

1 participant