CLI sorts Feature options fewest-first, against spec
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- cli
Research direction
Start in devcontainers/cli at src/spec-configuration/containerFeaturesOrder.ts, focusing on optionsCompareTo and its option-count ordering. Run the existing container-features order test at src/test/container-features/containerFeaturesOrder.test.ts with the configs/feature-dependencies/dependsOn/local-with-options fixture, then update the expected order so the greatest number of user-defined options comes first.
Written by the indexing model from the issue text.
Description
Note on repo choice: Per the
devcontainers/cliCONTRIBUTING guide, issues concerning the CLI should be filed in this spec repository, so I've opened it here even though it's aboutdevcontainers/clibehavior. Please let me know if you'd prefer it moved to thedevcontainers/clirepo instead.
Summary
When sorting Features within an installation round, the spec says Features are ordered by the greatest number of user-defined options first, but containerFeaturesOrder.ts orders by the fewest options first.
Specification
Features spec — Definition: Round Stable Sort:
Greatest number of user-defined options (note omitting an option will default that value to the Feature's default value and is not considered a user-defined option)
Implementation
optionsCompareTo returns aKeys.length - bKeys.length, which is negative when a has fewer options, so the Feature with fewer options sorts earlier:
This is the option tiebreaker for every source type (OCI, file-path, direct-tarball, legacy).
Test evidence
The existing test valid dependsOn with round sorting based on options (fixture configs/feature-dependencies/dependsOn/local-with-options) pins the fewest-first behavior — the ./b variant with {} (zero options) is expected first, ahead of the two-option variants:
So the implementation and its tests are internally consistent; only the behavior disagrees with the spec.
Proposed fix
Sort by the greatest option count to match the spec (bKeys.length - aKeys.length), with the fixture/expected order updated accordingly. This changes the install order of the same Feature requested with differing option sets within a round.
- Dominant language
- No language data
- Stars
- 5.7k
- Forks
- 497
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from devcontainers/spec
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
devcontainers/spec#754 · 1 comment · 2 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
devcontainers/spec#735 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
devcontainers/spec#579 · 1 comment ·
-
ToeySuKhothai_Pull Open
Difficulty 5/5 Over a week Newbie friendliness 10/100
devcontainers/spec#771 ·
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
devcontainers/spec#770 · 1 comment ·
All issues in devcontainers/spec
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
from:qa priority:P2 reliability tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
spec-kitty/spec-kitty#4874 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
automation code-quality cookie deep-report documentation improvement quick-win task-mining
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100