Repository navigation
feat(downloader): rank asset variants for the host - #136
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
Rules either remove an asset or rank it, and ranks compare in pipeline order, so a decision that depends on the other assets never removes anything. The gradual search becomes the same pipeline with OS and architecture ranked instead of required, which keeps its old order and tries each asset once. The pipeline is the interceptor chain from Testo without its ordering and conflict options: the rules run in the order the selector lists them, which is the priority of their ranks. Assisted-By: Claude Opus 5.5
An `android` token in an asset name now wins over `linux`, so Android builds are no longer picked on a Linux host. On an Android host (detected by `ANDROID_ROOT`) Linux builds stay a fallback, since static Linux binaries run there. Assisted-By: Claude Opus 5.5
A musl host is detected by the presence of the musl dynamic loader, or set with `--os alpine`. musl builds rank first there and last elsewhere, but are never removed: some tools publish only a static musl build for Linux. Alpine is no longer a separate OS: it was never detected, and treating it as one would have excluded every plain Linux build. Assisted-By: Claude Opus 5.5
feat(registry): select Bun assets with a broad pattern Among assets that fit the host, the one with the fewest name tokens beyond the platform, version and extension wins, so `-baseline`, `-profile` and `-debug` builds become fallbacks without a list of variant names. This also stops TigerBeetle from installing its debug build. Closes #134 Assisted-By: Claude Opus 5.5
roxblnfk
force-pushed
the
feat/asset-ranking
branch
from
October 5, 2026 18:54
f1ca3e4 to
426fe1b
Compare
Assisted-By: Claude Opus 5.5
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Coverage metadata references two nonexistent test-namespace classes, and the new automatic host-detection branches remain untested.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Introduces host-aware asset ranking so the downloader selects the best OS, architecture, libc, and build variant.
Changes:
- Adds a reusable ranking pipeline and selection rules.
- Detects Android and musl hosts and broadens Bun asset matching.
- Adds selection tests, diagnostics, and documentation.
| File | Description |
|---|---|
tests/.../Stub/RuleRunner.php |
Adds rule test helper. |
tests/.../Stub/NamedAssets.php |
Creates named asset fixtures. |
tests/.../SelectionTest.php |
Tests ranking and removal. |
tests/.../Rule/OperatingSystemRuleTest.php |
Tests OS selection. |
tests/.../Rule/NamePatternRuleTest.php |
Tests pattern filtering. |
tests/.../Rule/LibcRuleTest.php |
Tests libc ranking. |
tests/.../Rule/FormatRuleTest.php |
Tests format filtering. |
tests/.../Rule/ExtrasRuleTest.php |
Tests variant ranking. |
tests/.../Rule/ArchiveRuleTest.php |
Tests archive preference. |
tests/.../Rule/ArchitectureRuleTest.php |
Tests architecture selection. |
tests/.../AssetSelectorTest.php |
Tests the complete pipeline. |
tests/.../AssetNameTest.php |
Tests filename parsing. |
tests/Unit/Module/Downloader/DownloaderTest.php |
Injects the selector in fixtures. |
tests/Unit/Module/Downloader/AssetSelectionTest.php |
Adds Bun, Mago, and TigerBeetle cases. |
tests/.../Pipeline/Stub/TraceInterceptor.php |
Adds tracing interceptor fixture. |
tests/.../Pipeline/Stub/HaltInterceptor.php |
Adds halting interceptor fixture. |
tests/.../Pipeline/PipelineTest.php |
Tests pipeline behavior. |
tests/.../OperatingSystemTest.php |
Tests Android and musl OS parsing. |
tests/.../LibcTest.php |
Tests libc parsing and configuration. |
src/.../AssetSelection/Selection.php |
Stores and sorts ranked candidates. |
src/.../Rule/OperatingSystemRule.php |
Ranks compatible operating systems. |
src/.../Rule/NamePatternRule.php |
Filters names by pattern. |
src/.../Rule/LibcRule.php |
Ranks libc compatibility. |
src/.../Rule/FormatRule.php |
Filters accepted formats. |
src/.../Rule/ExtrasRule.php |
Prefers fewer variant tokens. |
src/.../Rule/ArchiveRule.php |
Prefers supported archives. |
src/.../Rule/ArchitectureRule.php |
Ranks host architecture. |
src/.../AssetSelection/Candidate.php |
Represents ranked assets. |
src/.../AssetSelection/AssetSelector.php |
Defines rule priority. |
src/.../AssetSelection/AssetRule.php |
Defines the rule contract. |
src/.../AssetSelection/AssetName.php |
Parses asset traits. |
src/Module/Downloader/Downloader.php |
Integrates ranked selection. |
src/.../Pipeline/Pipeline.php |
Implements interceptor execution. |
src/.../Pipeline/Interceptor.php |
Defines the interceptor base. |
src/Module/Common/OperatingSystem.php |
Adds Android and Alpine mapping. |
src/Module/Common/Libc.php |
Adds libc detection. |
src/Command/Get.php |
Displays musl host information. |
src/Bootstrap.php |
Registers libc dependency. |
skills/.../troubleshooting.md |
Documents ranking diagnostics. |
skills/.../registry-entry.md |
Documents asset variant rules. |
resources/software.json |
Broadens Bun’s asset pattern. |
README.md |
Documents new OS options. |
README-zh.md |
Updates Chinese OS options. |
README-ru.md |
Updates Russian OS options. |
README-es.md |
Updates Spanish OS options. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
fix(downloader): do not detect musl when the loader lookup fails Host detection takes the OS family and the probed facts as arguments, so the Android and musl branches are tested on any host. `glob()` reports an error as `false`, which the old check took for a found loader. Assisted-By: Claude Opus 5.5
roxblnfk
force-pushed
the
feat/asset-ranking
branch
2 times, most recently
from
October 6, 2026 06:53
20f6585 to
c7f8c71
Compare
The libc rule takes the host libc from the container only when the remaining assets differ in libc, so selecting assets through the API does not probe the host for nothing. Assisted-By: Claude Opus 5.5
Rosetta 2 and the Windows emulation run x86-64 binaries on ARM, so such a build is no longer discarded when a release has no ARM build for the host. Linux is left out: it needs qemu-user set up to do the same. Assisted-By: Claude Opus 5.5
roxblnfk
force-pushed
the
feat/asset-ranking
branch
from
October 6, 2026 06:55
c7f8c71 to
f8b6823
Compare
A companion file carries the platform of the build it describes, so it could outrank a build of another libc or variant, and downloading it succeeds, which ended the search with a file that is not the tool. Assisted-By: Claude Opus 5.5
Android has its own libc, which runs no glibc build, while musl builds are usually static. A configured OS other than Linux now also yields glibc instead of probing the host for musl. Assisted-By: Claude Opus 5.5
docs(skill): describe when Android builds are dropped `PREG_NO_ERROR` is an error code, not a flag; the `@` already silences an invalid pattern. Android builds are only dropped on Linux in a strict selection, and Android hosts now prefer musl builds. Assisted-By: Claude Opus 5.5
Rosetta 2 is optional on macOS and Windows 10 on ARM has no x64 emulation, so a fallback build may not run. Assisted-By: Claude Opus 5.5
feat(get): show the libc of Linux and Android hosts Android gets its own libc instead of posing as musl, and Windows, macOS and BSD get a system libc that ranks no build above another. Which builds a libc prefers now lives in the enum, so the rule only asks it. Assisted-By: Claude Opus 5.5
Assisted-By: Claude Opus 5.5
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.


🔍 What was changed
dload now ranks the assets that fit the host instead of taking the first one the API lists, so a broad
asset-patternpicks the right build among variants:--os alpine) and on Android musl builds come first; elsewhere they come last but stay available, since some tools ship only a static musl build. The host is probed only when a release offers both kinds.-baseline,-profileand-debugbuilds become fallbacks without a list of variant names. This also stops TigerBeetle from installing its debug build./^bun-.*/instead of a pattern spelling out its asset names.How it works
src/Module/Downloader/Internal/AssetSelection/Rule). A rule either removes an asset, judging it alone, or gives every asset a named rank.-vvvlogs every asset's ranks.Why?
Variant suffixes were invisible: with
/^bun-.*/every host got a-profilebuild and Linux got the Android one.Checklist
dload get bunon Windows installsbun-windows-x64.zipReview notes
OperatingSystem::Alpineis gone: it was never detected (PHP_OSisLinuxon Alpine), and as an OS it would have excluded every plain Linux build.--os alpine/unknown-muslnow mean Linux with musl.src/Module/Common/Pipelinewithout ordering and conflict options:AssetSelectorlists the rules, and that order is the priority of their ranks.amd64_v3) are in Asset ranking: platform words in tool names, universal macOS builds, amd64 levels #137.