Skip to content

chore(foundryup): upgrade to tar 8 and tune streaming extraction - #11896

Open
davidmurdoch wants to merge 5 commits into
mainfrom
david/foundryup-tar-8
Open

davidmurdoch wants to merge 5 commits into
mainfrom
david/foundryup-tar-8

Conversation

@davidmurdoch

@davidmurdoch davidmurdoch commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

Upgrade @metamask/foundryup to tar@8.0.5. Tar 8 replaces its Node stream extraction API with async extraction and Web Stream transforms. Foundryup still streams the download directly into extraction, selects only the requested binaries, and verifies checksums in the same pass when configured. The old transform was the only direct use of minipass, so this also removes that dependency. ZIP extraction is unchanged.

Tar 8's gzip path was sensitive to small HTTP chunks in local benchmarks. This PR keeps the initial input batch at 256 KiB so extraction can start promptly, then uses 2 MiB input batches, a 1 MiB download stream high-water mark, and 1 MiB gzip output chunks to reduce stream and decompressor overhead. The download, unpack, and checksum pipeline remains bounded and still uses tar's decompression-ratio guard.

Performance

Official Foundry v1.10.1 Linux x64 archive, Node 26. The initial tar 8 migration regressed at matched 64 KiB settings, especially with SHA-256. The final tuning reduced the time spent in the HTTP download and extraction path.

Mode Tar 7 Untuned Tar 8 Optimized Tar 8 Diffs
SHA-256 742 ms 863 ms 501 ms 16.3% longer vs. tar 7
14.0% less time vs. tar 8 HTTP baseline
No checksum 776 ms 785 ms 499 ms 1.2% longer vs. tar 7
12.3% less time vs. tar 8 HTTP baseline

The Tar 7 and Untuned Tar 8 columns show median times with matched 64 KiB compressed input chunks and gzip output buffers. The HTTP comparison uses fast loopback delivery and reports median paired reductions versus the earlier tar 8 implementation with 256 KiB input and output buffers. The optimized HTTP times are not directly comparable to the fixed-input times.

Paced HTTP completion time was effectively unchanged; the first extracted file appeared about 2 ms later. Tar 8 was slower on a synthetic incompressible fixture at matched settings, so the measurements do not imply universal parity.

Testing

  • yarn workspace @metamask/foundryup test --run (24 tests passed)
  • yarn workspace @metamask/foundryup build
  • yarn lint:oxlint packages/foundryup
  • yarn lint:misc:check packages/foundryup oxlint-suppressions.json
  • yarn workspace @metamask/foundryup changelog:validate

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Touches the core Foundry binary download/unpack/checksum path and a major tar major version, so regressions could affect install reliability even with new tests.

Overview
Upgrades @metamask/foundryup to tar@8.0.5, drops the direct minipass dependency, and updates the tar.gz path for tar 8’s async extract API and Web Streams transforms (checksum hashing via TransformStream instead of Minipass). Downloaded bytes are fed through batchTarInput, tuned gzip codecs, and an optional streamHighWaterMark on startDownload to cut overhead from small HTTP chunks.

Adds extract.test.ts coverage for selective binary extraction with/without checksums and cleanup when verification or HTTP fails. ZIP extraction is unchanged; changelog and lockfile reflect the dependency bump.

Reviewed by Cursor Bugbot for commit 62b3b54. Configure here.

@davidmurdoch
davidmurdoch requested review from a team as code owners December 2, 2026 19:16
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

🛑 Files requiring codeowner review

To merge this PR, you'll need to get approvals from the following owner groups.

(Note: For files with multiple owners, approval from one owner is sufficient.)

@MetaMask/extension-platform or @MetaMask/mobile-platform (6 files)
  • packages/foundryup/CHANGELOG.md
  • packages/foundryup/package.json
  • packages/foundryup/src/download.ts
  • packages/foundryup/src/extract.test.ts
  • packages/foundryup/src/extract.ts
  • packages/foundryup/src/types.ts

ℹ️ Files co-owned by @MetaMask/core-platform

For convenience in maintaining this repo, this team co-owns the following files and thus may approve changes to them.

Note

You do not need to get approval from @MetaMask/core-platform to merge this PR.

(Expand to view list of files)
  • packages/foundryup/CHANGELOG.md
  • packages/foundryup/package.json

@socket-security

socket-security Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedtar@​8.0.51001009996100

View full report

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 62b3b54. Configure here.

Comment thread packages/foundryup/src/extract.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the tar 8 extraction migration.

No open issues 🎉

What changed in this PR

Migrates @metamask/foundryup to tar 8’s async extraction API while preserving selective extraction and optional checksum verification. ZIP extraction is unchanged.

Changes:

  • Upgrade to tar@^8.0.5 and remove the direct minipass dependency.
  • Tune download buffering, input batching, and gzip output chunks.
  • Add extraction and failure-cleanup tests.
File Description
yarn.lock Update resolved dependencies.
packages/​foundryup/​src/​types.ts Add download buffering option.
packages/​foundryup/​src/​extract.ts Migrate tar extraction and tune streaming.
packages/​foundryup/​src/​extract.test.ts Test selective extraction, checksums, and cleanup.
packages/​foundryup/​src/​download.ts Apply configurable stream buffering.
packages/​foundryup/​package.json Upgrade tar and remove minipass.
packages/​foundryup/​CHANGELOG.md Document dependency changes.
oxlint-suppressions.json Remove obsolete lint suppression.

Review effort: Balanced

Comment thread packages/foundryup/CHANGELOG.md Resolved

@cryptodev-2s cryptodev-2s left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested locally with the extension and mobile configs: tar 7 and tar 8 install the same verified anvil. One small note inline, fine as a follow-up. LGTM.

Comment on lines +170 to +178
await extractTar(
{
codecs: foundryTarCodecs,
cwd: dir,
input: batchTarInput(
startDownload(url, {
streamHighWaterMark: TAR_DOWNLOAD_HIGH_WATER_MARK,
}),
),

@cryptodev-2s cryptodev-2s Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tar 8 now accepts an archive that's missing its last few bytes (the gzip trailer); tar 7 rejected it with zlib: unexpected end of file. Checksums still catch a bad binary, so clients are fine. Worth a test for a truncated archive?

This branch was previously deployed

1 inactive (outdated) deployment
default-branch — 30a93e9f Deployed Dec 2, 2026 by davidmurdoch via Determine whether this PR is a release PR #7908
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.

4 participants