Skip to content

perf(ci): keep the Node.js archive so re-setup skips the download - #4001

Merged
zackees merged 1 commit into
masterfrom
perf/keep-node-download-cached
Aug 23, 2026
Merged

zackees merged 1 commit into
masterfrom
perf/keep-node-download-cached

Conversation

@zackees

@zackees zackees commented Aug 23, 2026 •

Copy link
Copy Markdown
Member

Problem

ci/setup-js-linting-fast.py already guarded the download with if not download_path.exists() — but then deleted the archive at the end of the function:

# Clean up download file
if download_path.exists():
    download_path.unlink()

So the reuse path was dead code and every re-provision re-fetched ~30MB from nodejs.org.

Change

  • The archive is retained in .cache/js-tools/. Removing that directory still forces a clean re-provision, so there is no new escape hatch to learn.
  • Extraction is factored out into _extract() and wrapped: a truncated or corrupt cached archive (an interrupted download) is discarded and fetched once more rather than failing setup. Without this, retaining the archive would trade one failure mode for another.

Measured (Windows)

Scenario Time
Cold — download + extract + npm install 25.1s
Warm — archive retained, extracted tree removed 13.7s (−45%)
Corrupt archive (truncated to 500KB) detected, re-downloaded, exit 0

Corruption path verified end to end:

Reusing cached archive: node-v20.11.0-win-x64.zip
Cached archive unusable (File is not a zip file); re-downloading
Downloading from: https://nodejs.org/dist/v20.11.0/node-v20.11.0-win-x64.zip
SUCCESS: Node.js extracted

bash lint clean.

Refs #3968

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when setting up the JavaScript linting environment.
    • Reuses downloaded archives to speed up repeated setup runs.
    • Automatically detects corrupted cached archives, removes them, and retries the download.
  • Performance
    • Retains downloaded archives for faster future installations.

The setup script already checked `if not download_path.exists()` before
downloading, but then deleted the archive at the end — making that reuse
path dead code. Every re-provision re-fetched ~30MB from nodejs.org.

The archive is now retained in .cache/js-tools/. Removing that directory
still forces a clean re-provision.

Extraction is factored into `_extract()` and wrapped so a truncated or
corrupt cached archive (an interrupted download) is discarded and fetched
once more instead of failing setup.

Measured on Windows:
  cold (download + extract + npm install)   25.1s
  warm (archive retained, tree removed)     13.7s   -45%
  corrupt archive                           detected, re-downloaded, exit 0

Refs #3968

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@zackees
zackees merged commit 9aff0a4 into master Aug 23, 2026
25 checks passed
@zackees
zackees deleted the perf/keep-node-download-cached branch August 23, 2026 00:36
@coderabbitai

coderabbitai Bot commented Aug 23, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a9f5e172-5a6c-4b46-9b80-1352d3d4a831

📥 Commits

Reviewing files that changed from the base of the PR and between d14b9ed and 91c5616.

📒 Files selected for processing (1)
  • ci/setup-js-linting-fast.py

📝 Walkthrough

Walkthrough

The Node.js setup script now caches downloaded archives, separates downloading from extraction, preserves platform-specific extraction behavior, and retries once after detecting a corrupted archive.

Changes

Node.js archive handling

Layer / File(s) Summary
Archive download, extraction, and recovery
ci/setup-js-linting-fast.py
The script adds _download_archive() and _extract(). It reuses existing archives, retains them after extraction, and deletes and re-downloads corrupted archives before one retry.

Estimated code review effort: 3 (Moderate) | ~20 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/keep-node-download-cached

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Aug 23, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant