Conversation
The GitHub-dependency tests in bun-add.test.ts fetched real tarballs from api.github.com. When GitHub serves 5xx (as during the 2026-07-22 outage), all 6 attempts fail and the tests go red on every lane. dummy.registry.ts now exposes makeGithubTarball()/setGithubTarball() and routes /repos/:owner/:repo/tarball/:ref on the existing server. The affected tests point GITHUB_API_URL at it and consume fixtures that reproduce the GitHub tarball layout (root dir <owner>-<repo>-<short-sha>), so every assertion (resolved commit, bin links, cache folder name, directory listing) is preserved. The file drops from ~58s to ~3s.
|
Warning Review limit reached
Next review available in: 8 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
Comment |
|
Status: ready for review. Self-review found no surviving concerns.
Remaining red in that build is unrelated to this diff (test-only change under
|
|
Updated 10:42 AM PT - Jul 22nd, 2026
❌ @robobun, your commit 9836c2a has 3 failures in
🧪 To try this PR locally: bunx bun-pr 35149That installs a local version of the PR into your bun-35149 --bun |
There was a problem hiding this comment.
LGTM — test-only change that makes seven GitHub-tarball bun add tests hermetic without weakening any assertions.
What was reviewed:
alloc_github_urlinsrc/install/PackageManager/runTasks.rs— confirmed the constructed path (/repos/{owner}/{repo}/tarball/{ref}, including empty-ref) matches the fixture keys and route.requestedcounter — the new/repos/…route returns beforerequested++, soexpect(requested).toBe(0)in the GitHub tests still holds.- Hook ordering — fixture registration only touches a module-level Map;
githubEnv()readsroot_urlat spawn time, afterdummyBeforeAllhas set it. - Checked the route prefix is narrow enough not to collide with other
dummy.registry.tsconsumers, and that no existing assertion was loosened.
Extended reasoning...
Overview
This PR removes live api.github.com dependencies from seven tests in test/cli/install/bun-add.test.ts by serving equivalent tarball fixtures from the existing dummy.registry.ts server via the GITHUB_API_URL override. It adds two exported helpers (makeGithubTarball, setGithubTarball) and a /repos/:owner/:repo/tarball/:ref route to the shared dummy server. No src/** files are touched.
Security risks
None. Test-infrastructure only; no production code paths, no auth/crypto/permissions changes.
Level of scrutiny
Low-to-medium. The changes are confined to test harness code and follow an established pattern already used by symlink-path-traversal.test.ts (pointing GITHUB_API_URL at a local server). The important thing to verify is that test coverage is preserved rather than weakened — and it is: every existing expect (directory listings, cache-folder names, resolved-commit sha in stdout, bin linking) is left byte-for-byte unchanged, with the fixtures constructed to satisfy them.
Other factors
- Verified against
alloc_github_urlthat the URL shape (including trailing-slash + empty committish for theliz3/empty-bun-repocase) matches the fixture map keys exactly. - The new route intentionally returns before incrementing
requested, preservingexpect(requested).toBe(0)in the GitHub tests (which previously never touched the local server). - The ustar writer is minimal but valid; a similar hand-rolled writer already exists in
symlink-path-traversal.test.ts. Placing the new one indummy.registry.tsmakes it reusable for the follow-ups the description names. - 54/54 pass on both debug and release per the PR body, and the release-build wall time drops from ~58s to ~3s — a meaningful CI-cost win on top of the flake fix.
- The fixup commit addressed Windows extraction by giving each asserted subdirectory a real file entry; the remaining
{}fixture (install-test-3 v1.0.0) has no subdirectory assertions and only the root dir, so it is unaffected.
|
#39115 adds a |
|
Closing in favor of #42800. It converts the same seven tests in |
Problem
test/cli/install/bun-add.test.tswent red on every retry in build 77839 (and 77787/77818) with:Seven tests in this file fetch real tarballs from
api.github.com(via theowner/repo#refdependency form, whichalloc_github_urlturns into…/repos/{owner}/{repo}/tarball/{ref}). bun already retries 5xx up tomax_retry_counttimes, but the retries are immediate with no backoff, so a GitHub 504 window exhausts all 6 attempts. The tests themselves exercisebun add's GitHub-shorthand handling (package.json writing, bin linking, cache folder naming, resolved-commit extraction from the tarball root directory), not GitHub.Fix
Make the affected tests hermetic:
test/cli/install/dummy.registry.ts: addmakeGithubTarball(rootDir, files)(builds a gzip'd tar whose single top-level directory matches GitHub's<owner>-<repo>-<short-sha>layout) andsetGithubTarball(owner, repo, ref, bytes). The existing server now routes/repos/:owner/:repo/tarball/:refto those fixtures so an install under test can pointGITHUB_API_URLat it.test/cli/install/bun-add.test.ts: register fixtures formishoo/UglifyJS#v3.14.1,dylan-conway/install-test-3#v1.0.{0,1,2}andliz3/empty-bun-repoinbeforeAll, and passGITHUB_API_URLfor the seven GitHub-tarball tests. The fixtures reproduce the exact directory listing,package.jsonname/version andbinentry the tests already assert, so every existingexpect(including the@GH@mishoo-UglifyJS-e219a9a@@@1cache-folder name and thee219a9aresolved commit in stdout, which bun reads from the tarball's root directory name) is preserved unchanged.The two tests that go through
git clone(should handle Git URL in dependencies (SCP-style)andgit dep without package.json and with default branch) do not useGITHUB_API_URLand are left alone; #35035 addresses the SCP-style one.Why this is the right fix
These tests have no reason to depend on api.github.com being up: they are asserting bun's behavior, and every byte of the GitHub response they care about is now produced locally. #34419 applied the same pattern (point
GITHUB_API_DOMAINat a local server) tobun create; this extends it to the install path'sGITHUB_API_URL. The newmakeGithubTarball/setGithubTarballhelpers are exported so the other files in the same cluster (bunx.test.ts,bun-install-lifecycle-scripts.test.ts) can adopt them in their own follow-ups.Verification
Release build: 54 pass / 0 fail in 3.28s (down from ~58s before, since no network round-trips to GitHub). A couple of unrelated files that import
dummy.registry.ts(bun-remove.test.ts,bun-install-retry.test.ts) behave identically before and after.No single culprit PR: the live-GitHub dependency in these tests predates the Rust port.
no test proof · iteration 0 · Platform-specific test-only change; deferring to CI.