Merged
Conversation
This function sorts a list of modules by their dependencies using topological sort, ensuring that dependencies are processed before the modules that depend on them. For example, if module_a depends on module_b, the result will be [module_b, module_a].
Apply automatic sorting of modules by dependencies in the CLI when multiple -m options are provided. This ensures that if module1 depends on module2, they are executed in the correct order [module2, module1].
Add comprehensive test suite to validate module sorting by dependencies: - Test single module - Test two modules with dependency - Test multiple modules with linear dependencies - Test all modules in dependency chain - Test modules out of order - Test empty list - Test modules without shared dependencies
polsala
approved these changes
Nov 12, 2025
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.
This pull request introduces dependency-aware sorting for modules in the
destralCLI and utilities, ensuring that modules are processed in the correct order based on their dependencies. The main change is the addition of a topological sort function, which is now used before running tests, and is thoroughly tested with new unit tests.Dependency-aware module sorting
sort_modules_by_dependenciesfunction todestral/utils.py, which sorts a list of modules so that dependencies are processed before dependent modules using a topological sort. This prevents issues where a module is tested before its dependencies.destral/cli.pytest runner to use the new sorting function, ensuring modules are tested in dependency order.sort_modules_by_dependenciesindestral/utils.pyso it can be used elsewhere in the codebase.Testing improvements
sort_modules_by_dependenciesintests/test_utils.py, covering various scenarios including linear dependencies, random input order, empty lists, and modules without shared dependencies.