Skip to content

The board order is not deterministic in core search  #2466

Open
@kittaakos

Description

@kittaakos

Describe the problem

core search --format json provides different output for the same args. The boards item per platform differs.

To reproduce

./arduino-cli version  
arduino-cli  Version: 0.35.0-rc.7 Commit: 77222ecd Date: 2023-12-04T12:29:09Z
./arduino-cli core list
ID               Installed Latest Name
arduino:avr      1.8.6     1.8.6  Arduino AVR Boards
arduino:esp32    2.0.13    2.0.13 Arduino ESP32 Boards
arduino-git:samd 1.8.13    1.8.13 Arduino SAMD (32-bits ARM Cortex-M0+) Boards
pico:rp2040      3.6.0     3.6.0  Raspberry Pi RP2040 Boards

(prints the name + FQBN of the first boards item of the arduino:avr core):

./arduino-cli core search "arduino:avr" --format json | jq '. | map((.id, .name, .boards[0])) | select(.[0] == "arduino:avr")'
[
  "arduino:avr",
  "Arduino AVR Boards",
  {
    "name": "Arduino BT",
    "fqbn": "arduino:avr:bt"
  }
]

Run the same command twice (or sometimes the third time):

./arduino-cli core search "arduino:avr" --format json | jq '. | map((.id, .name, .boards[0])) | select(.[0] == "arduino:avr")'
[
  "arduino:avr",
  "Arduino AVR Boards",
  {
    "name": "Arduino Robot Motor",
    "fqbn": "arduino:avr:robotMotor"
  }
]

Expected behavior

The core search --format json output is deterministic

Arduino CLI version

0.35.0-rc.7 Commit: 77222ec

Operating system

macOS

Operating system version

14.1

Additional context

I remember we had this problem, which was solved, but I could not find the corresponding issue/PR. Please close if it's a duplicate.

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions