Platform selection bug: darwin-arm64 extensions served instead of linux-x64 due to alphabetical sorting
@code-asher ci sta già lavorando.
Dal 22/9/2025.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Bug Description
When using the /api/vscode/{publisher}/{extension}/latest endpoint (introduced in v2.4.0), the marketplace incorrectly serves darwin-arm64 extension variants instead of the appropriate platform-specific versions (e.g., linux-x64) due to alphabetical sorting of platform names.
Root Cause
The issue is in the ByVersion.Less() method in /storage/storage.go:
if vs[i].Version == vs[j].Version {
return vs[i].TargetPlatform < vs[j].TargetPlatform
}
When multiple platform variants exist for the same semantic version (e.g., 2.36.4@darwin-arm64, 2.36.4@linux-x64), they are sorted alphabetically by platform string. Since "darwin-arm64" < "linux-x64" alphabetically, darwin-arm64 versions are always selected first when using IncludeLatestVersionOnly.
Impact
- Extensions fail to install in VS Code/code-server running on Linux platforms
- Affects all extensions that have multiple platform-specific variants
- Introduced in v2.4.0 when the new
/latestendpoint started being used by VS Code
Example Logs
Expected behavior (linux-x64 environment should get linux-x64 variant):
ComputeTargetPlatform: linux-x64
2025-09-20 09:42:42.565 [debu] GET /files/hashicorp/terraform/2.36.4@linux-x64/hashicorp.terraform-2.36.4@linux-x64.vsix
Actual behavior (linux-x64 environment incorrectly gets darwin-arm64 variant):
ComputeTargetPlatform: linux-x64
2025-09-20 09:42:40.247 [debu] GET /files/hashicorp/terraform/2.36.4@darwin-arm64/extension/package.json
Environment
- code-marketplace version: v2.4.0
- VS Code/code-server: 1.104.0
- Platform: Linux x64 containers
- Extensions affected: Any extension with multiple platform variants (e.g., HashiCorp Terraform)
Proposed Solutions
- Platform-aware filtering: Filter versions by the requesting client's target platform before sorting
- Universal version priority: Prioritize universal platform versions when available
- Platform preference order: Define a logical platform ordering instead of alphabetical (e.g., prefer common platforms like linux-x64 over darwin-arm64)
- Client platform detection: Extract target platform from request headers or query parameters
Reproduction Steps
- Set up code-marketplace v2.4.0
- Upload an extension with multiple platform variants (e.g., versions for both
linux-x64anddarwin-arm64) - Make a request to
/api/vscode/{publisher}/{extension}/latestfrom a linux-x64 environment - Observe that darwin-arm64 variant is returned instead of linux-x64
Workaround
Temporarily downgrade to v2.3.1 or modify the version sorting logic to prioritize the appropriate platform for your environment.
- Lingua principale
- Go
- Stelle
- 369
- Fork
- 46
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di coder/code-marketplace
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
coder/code-marketplace#131 ·
-
Add checksums Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
coder/code-marketplace#111 ·
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
coder/code-marketplace#104 · 1 commento · 4 reazioni ·
-
bug documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
coder/code-marketplace#66 · 1 commento ·
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
coder/code-marketplace#52 · 5 commenti ·
Tutte le issue di coder/code-marketplace
Issue simili
-
nix: vendorHash is outdated Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Bob Shell support Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
santhosh-tekuri/jsonschema#276 ·