Repository navigation
fix(@angular-devkit/schematics): support delegating trees in filter and partition - #34539
Closed
Thanatos9404 wants to merge 3 commits into
Closed
Thanatos9404 wants to merge 3 commits into
Thanatos9404 wants to merge 3 commits into
Conversation
…ter` rule `filter()` only accepted a `HostTree` and threw "Tree type is not supported." for any other tree. A `UnitTestTree` is a `DelegateTree` around a `HostTree`, so a schematic that uses `filter()` failed in unit tests when run on the tree returned by a previous `runSchematic` call. Unwrap delegating trees and filter the `HostTree` they wrap. Closes angular#26000
There was a problem hiding this comment.
Code Review
This pull request updates the filter rule in Angular Devkit Schematics to support DelegateTree wrappers (such as UnitTestTree) by recursively unwrapping them to access the underlying HostTree. It also adds corresponding unit tests to verify this behavior. The review feedback suggests a minor improvement to type safety by using an intersection cast (DelegateTree & { _other: Tree }) instead of casting to unknown first when accessing the private _other property.
alan-agius4
requested changes
Oct 27, 2026
`partition()`, which backs the `partitionApplyMerge` rule, threw "Tree type is not supported." for a `UnitTestTree` and other delegating trees. Branch the tree they wrap instead, as `filter()` does.
filter rulefilter and partition
Collaborator
alan-agius4
pushed a commit
that referenced
this pull request
Oct 27, 2026
…ter` rule (#34539) `filter()` only accepted a `HostTree` and threw "Tree type is not supported." for any other tree. A `UnitTestTree` is a `DelegateTree` around a `HostTree`, so a schematic that uses `filter()` failed in unit tests when run on the tree returned by a previous `runSchematic` call. Unwrap delegating trees and filter the `HostTree` they wrap. Closes #26000 PR Close #34539
angular-robot
pushed a commit
to angular-robot/angular-cli
that referenced
this pull request
Oct 27, 2026
…on` (angular#34539) `partition()`, which backs the `partitionApplyMerge` rule, threw "Tree type is not supported." for a `UnitTestTree` and other delegating trees. Branch the tree they wrap instead, as `filter()` does. PR Close angular#34539
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.
PR Checklist
Please check to confirm your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
filter()only accepts aHostTreeand throws "Tree type is not supported." for anything else. AUnitTestTreeis aDelegateTreearound aHostTree, so a schematic that usesfilter()fails in unit tests when it runs on the tree returned by an earlierrunSchematiccall.Issue Number: #26000
What is the new behavior?
filter()andpartition()(behindpartitionApplyMerge) callbranch()on a delegating tree first, which returns a branch of theHostTreeit wraps. Other tree types still throw as before.Does this PR introduce a breaking change?
Other information
The new specs in
base_spec.tscoverfilteron a plainHostTree(it had no spec) andfilterandpartitionApplyMergeon a nestedUnitTestTree, sincerunSchematicreturns aUnitTestTreearound another one when the schematic edits its input tree in place. Locally, theUnitTestTreespecs fail onmainwith "Tree type is not supported." and pass with this change, and the 86 specs undersrc/rulesandsrc/treepass (run with jasmine, not Bazel).Closes #26000