-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(snapshot): gate V8 snapshot restore to Node.js >= 24, add docs and cnpmcore e2e #6003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
killagu
merged 9 commits into
eggjs:next
from
killagu:worktree-snapshot-node-gate-docs-ci
Jun 28, 2026
Merged
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
13a9738
feat(snapshot): gate V8 snapshot restore to Node.js >= 24, add docs a…
killagu 8734f30
feat(egg-bundler): member-proxy ESM interop for snapshot lazy-external
killagu 1a74d7d
fix(egg-bundler): delete web globals before stubbing to avoid undici/…
killagu 586deb0
fix(egg-bundler): make snapshot restore work for tegg + leoric apps
killagu 73c76a2
test(ecosystem-ci): get cnpmcore snapshot e2e to /-/ping 200
killagu a6417bb
chore(snapshot): address review feedback on the Node-version gate
killagu b465635
chore(egg-bundler): address review feedback on snapshot internals
killagu 7a873e2
test(scripts): cover the custom --node version-gate branch
killagu 3b5dd96
Merge remote-tracking branch 'origin/next' into worktree-snapshot-nod…
killagu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| #!/usr/bin/env bash | ||
| # Poll an HTTP endpoint until it returns 200, or time out. | ||
| # | ||
| # Usage: wait-health.sh <url> <response-file> [timeout-seconds] [sleep-seconds] | ||
| # Exits 0 on the first HTTP 200; exits 1 on timeout (dumping the last response body). | ||
| # | ||
| # Shared by the cnpmcore and cnpmcore-snapshot e2e jobs in | ||
| # .github/workflows/e2e-test.yml. Deliberately does not `set -e` so the | ||
| # curl-poll loop controls flow; callers wrap it in `if wait-health.sh ...; then`. | ||
| set -uo pipefail | ||
|
|
||
| if [ "$#" -lt 2 ]; then | ||
| echo "Usage: $0 <url> <response-file> [timeout-seconds] [sleep-seconds]" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| URL="$1" | ||
| RESPONSE_FILE="$2" | ||
| TIMEOUT="${3:-120}" | ||
| SLEEP="${4:-5}" | ||
|
|
||
| START_TIME=$(date +%s) | ||
| echo "Waiting for ${URL} to return HTTP 200 (timeout: ${TIMEOUT}s)..." | ||
| while true; do | ||
| STATUS=$(curl -s -o "${RESPONSE_FILE}" -w "%{http_code}" "${URL}" || echo "000") | ||
| echo "Health check at $(date): status=${STATUS}" | ||
|
|
||
| if [ "${STATUS}" = "200" ]; then | ||
| echo "Health check succeeded with status 200" | ||
| exit 0 | ||
| fi | ||
|
|
||
| NOW=$(date +%s) | ||
| ELAPSED=$((NOW - START_TIME)) | ||
| if [ "${ELAPSED}" -ge "${TIMEOUT}" ]; then | ||
| echo "Health check timed out after ${ELAPSED}s with last status ${STATUS}" | ||
| echo "Last response body (if any):" | ||
| cat "${RESPONSE_FILE}" 2>/dev/null || echo "<no response body captured>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| sleep "${SLEEP}" | ||
| done | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
set -uis enabled, running this script with fewer than 2 arguments will cause it to crash immediately with an unbound variable error. Adding an explicit argument count check provides a much friendlier and clearer usage error message.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in a6417bb — added an explicit
[ "$#" -lt 2 ]usage check with a friendly message before theset -upositional reads.