test(bundles): make remote-lifecycle name-ref test hermetic#366
Merged
Conversation
The 'handles mix of name, path, and url entries' test passed an
unresolvable { name } ref through startBundleSource and asserted it
rejects. An uncached name cache-misses and the mpak SDK fetches the
public registry (https://registry.mpak.dev); under a slow CI network
that round-trip blew the test's 15s budget and flaked intermittently.
Isolate MPAK_HOME to a temp dir whose config.json points the registry
at a closed local port, so the lookup returns ECONNREFUSED immediately
instead of hanging. The test now rejects fast and offline (170ms vs a
15s timeout) with no public-network dependency.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The
startBundleSource — remote url entries > handles mix of name, path, and url entries via allSettledintegration test flakes intermittently in CI with a 15s timeout (seen most recently on #300's CI).Root cause
The test passes an unresolvable
{ name: "@nonexistent/bundle" }ref throughstartBundleSourceand asserts it rejects. An uncached name cache-misses, so the mpak SDK falls through to a public-registry fetch (https://registry.mpak.dev/v1/bundles/...). When that fetch 404s quickly the test passes; under a slow CI network the round-trip exceeds the test's 15s budget and the test times out. It's a non-hermetic test reaching the public internet.Fix
Isolate
MPAK_HOMEto a temp dir whoseconfig.jsonpointsregistryUrlat a closed local port (http://127.0.0.1:1). The name lookup now returnsECONNREFUSEDimmediately instead of hanging — the ref still rejects (preserving the test's intent: a mix of failing name/path refs alongside a succeeding url ref), but fast and offline.Scoped to the one
describeblock that uses a name ref;MPAK_HOMEis saved and restored inbeforeEach/afterEachso sibling tests and other files are unaffected.Verification
bun run test:integration: 654 pass / 12 skip / 0 failbun run lint/format:check/check: cleanThis is a test-only change — no production code touched.