fix: replace ipfs-http-client with kubo-rpc-client#3034
Draft
Conversation
6bc019a to
0b7cc30
Compare
- migrate from ipfs-http-client to kubo-rpc-client - migrate from ipfsd-ctl v10 to v16 - bundle ESM-only deps to CJS via esbuild (fixes Electron compatibility) - fix multiaddr API: replace deprecated nodeAddress() with getComponents() - fix ipfsd-ctl v16 API: use init/start: false, call manually - fix repo path defaulting to ~/.ipfs when empty
0b7cc30 to
ae22d72
Compare
the macOS universal binary build was failing with "pattern is too long" from minimatch during ASAR merge. the ESM packages and their transitive deps had long file paths exceeding minimatch's limit. since these packages are bundled into esm-bundle.cjs at build time, they don't need to be in runtime dependencies. moving them to devDependencies reduces the packaged node_modules from 1237 to 1130 packages. also inlines p-defer (was a transitive dep) to avoid adding a new runtime dependency.
8bb79a7 to
0172ea8
Compare
e2e tests that start external daemons via `makeRepository({ start: true })`
must stop them before the Electron app closes. On Windows, leaving an
external daemon running while calling `app.close()` can cause Playwright
to hang because the app maintains an RPC connection to the daemon.
added try/finally blocks with fallback to RPC shutdown if stop() fails.
detect whether we spawned the daemon or connected to an external one by checking if `$IPFS_PATH/api` exists before starting: - api existed → external daemon, just disconnect on quit - api didn't exist → we spawned it, wait for graceful shutdown also handle stale api file case: if connection fails and we have config, remove api file and retry - mark as our daemon.
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.
this fixes sporadic "invalid ip address" errors on Windows (and occasionally macOS) caused by a V8 JIT optimization bug corrupting complex regex patterns.
the old
multiaddrpackage usedis-ipwhich relies on a 1,150-character IPv6 regex fromip-regex. under certain conditions, V8's JIT compiler would incorrectly optimize this regex, causing valid IPs like "127.0.0.1" to fail validation.the fix migrates from deprecated packages to their maintained successors:
ipfs-http-client->kubo-rpc-clientipfsd-ctl@10->ipfsd-ctl@16multiaddr->@multiformats/multiaddr@13multiaddr-to-uri->@multiformats/multiaddr-to-urithe new
@multiformats/multiaddruses@chainsafe/is-ipwhich validates IPs with a parser-based approach instead of regex, eliminating the bug.the migration also restores proper daemon output monitoring for migration progress detection by accessing ipfsd-ctl's subprocess streams directly, with runtime checks that log warnings if internals change in future versions.
closes #2329
TODO
since the new packages are ESM-only and ipfs-desktop uses CommonJS, this adds
src/esm-loader.jsto handle dynamic imports at startup.