Skip to content

Implement feature installation order and enhance test suite#500

Open
prulloac wants to merge 4 commits intocoder:mainfrom
prulloac:main
Open

Implement feature installation order and enhance test suite#500
prulloac wants to merge 4 commits intocoder:mainfrom
prulloac:main

Conversation

@prulloac
Copy link

@prulloac prulloac commented Mar 9, 2026

This pull request implements support for advanced feature installation ordering in devcontainer specs, aligning with the devcontainer spec's installation order semantics. It introduces the ability to control feature installation order via the new overrideFeatureInstallOrder property, supports soft and hard feature dependencies (installsAfter and dependsOn), and ensures proper validation and error handling for dependency cycles and missing hard dependencies. Comprehensive tests are added to verify correct behavior in various scenarios.

Feature installation ordering and dependency management:

  • Added the overrideFeatureInstallOrder property to the Spec struct in devcontainer.go, allowing users to explicitly specify the installation order of features. Features not listed are installed alphabetically after the specified ones.
  • Implemented the resolveInstallOrder function, which determines the final installation order by prioritizing user overrides, then honoring installsAfter (soft dependencies) via topological sort, and finally breaking ties alphabetically for determinism. Detects cycles and returns errors if found.
  • Added the validateDependencies function to enforce that all hard dependencies (dependsOn) declared by features are satisfied, returning an error if any required feature is missing.
  • Extended the features.Spec struct to include InstallsAfter and DependsOn fields, representing soft and hard dependencies, respectively.

Testing and documentation:

  • Added comprehensive tests in devcontainer_test.go to verify correct feature installation order, handling of overrides, soft and hard dependencies, cycle detection, and proper error reporting.
  • Updated the documentation in devcontainer-spec-support.md to reflect support for overrideFeatureInstallOrder, dependsOn, and installsAfter. [1] [2]

Solves #226

@prulloac prulloac marked this pull request as ready for review March 9, 2026 22:20
Copilot AI review requested due to automatic review settings March 9, 2026 22:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for devcontainer Feature installation ordering semantics, including a user-specified override order and dependency metadata read from devcontainer-feature.json, and extends the test suite and docs accordingly.

Changes:

  • Add overrideFeatureInstallOrder to devcontainer.Spec and implement order resolution (resolveInstallOrder) plus dependency validation (validateDependencies).
  • Extend devcontainer/features.Spec to parse installsAfter (soft ordering) and dependsOn (hard dependency).
  • Add tests covering override ordering, installsAfter behavior, hard-dependency presence validation, and cycle detection; update spec support documentation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
docs/devcontainer-spec-support.md Updates documented support matrix for devcontainer properties/features.
devcontainer/features/features.go Adds JSON fields for installsAfter and dependsOn to feature metadata parsing.
devcontainer/devcontainer.go Implements feature extraction pre-pass, install-order resolution, and hard dependency validation.
devcontainer/devcontainer_test.go Adds tests for override ordering, installsAfter ordering, dependsOn validation, and cycle detection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants