Fix aggregateDependencies to skip versions whose dependencies can't be fetched #2277
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.
Previously, when
aggregateDependenciesencountered a version whose dependencies couldn't be fetched, it would throw an error and fail the entire aggregation process. This caused package installation to fail completely even when other compatible versions were available.This PR changes the behavior to gracefully handle dependency fetching failures by:
Catching errors for individual versions: When dependency fetching fails for a specific version, the error is caught and that version is removed from the aggregated results instead of propagating the error.
Continuing aggregation with remaining versions: The process continues with other available versions, allowing the package resolution to proceed with working versions.
Maintaining data consistency: Failed versions are properly cleaned up from the dnps object, including removing empty package entries when all versions fail.
Example Scenario
Before this fix:
After this fix:
Testing
Added comprehensive test coverage for:
All existing tests continue to pass, ensuring backward compatibility and no regressions.
This change improves system resilience and provides a better user experience by allowing package installations to succeed even when some package versions have dependency issues.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
binaries.soliditylang.org/usr/local/bin/node ./build/cli.bundled.js obtain --solc=0.5.16(dns block)ethereum.github.io/usr/local/bin/node ./build/cli.bundled.js obtain --solc=0.5.16(dns block)ns.dappnode.io/usr/local/bin/node --experimental-specifier-resolution=node --import=tsx/esm /home/REDACTED/work/DNP_DAPPMANAGER/DNP_DAPPMANAGER/packages/utils/node_modules/mocha/lib/cli/cli.js ./test/unit packages/installer/test/unit/dappGet/aggregate/aggregateDependencies.test.ts --no-config --recursive --no-package --color --exit --extension ts --require dotenv/config --diff --reporter spec --slow 75 --timeout 2000 --ui bdd --watch-ignore node_modules --watch-ignore .git(dns block)relay.trufflesuite.com/usr/local/bin/node ./build/cli.bundled.js obtain --solc=0.5.16(dns block)solc-bin.ethereum.org/usr/local/bin/node ./build/cli.bundled.js obtain --solc=0.5.16(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.