GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(@angular-devkit/schematics): support delegating trees in `filter` and `partition` by Thanatos9404 · Pull Request #34539 · angular/angular-cli

Conversation

@Thanatos9404

@Thanatos9404 Thanatos9404 commented Oct 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

PR Checklist

Please check to confirm your PR fulfills the following requirements:

  • The commit message follows our guidelines: https://github.com/angular/angular-cli/blob/main/CONTRIBUTING.md#-commit-message-guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

filter() only accepts a HostTree and throws "Tree type is not supported." for anything else. A UnitTestTree is a DelegateTree around a HostTree, so a schematic that uses filter() fails in unit tests when it runs on the tree returned by an earlier runSchematic call.

Issue Number: #26000

What is the new behavior?

filter() and partition() (behind partitionApplyMerge) call branch() on a delegating tree first, which returns a branch of the HostTree it wraps. Other tree types still throw as before.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The new specs in base_spec.ts cover filter on a plain HostTree (it had no spec) and filter and partitionApplyMerge on a nested UnitTestTree, since runSchematic returns a UnitTestTree around another one when the schematic edits its input tree in place. Locally, the UnitTestTree specs fail on main with "Tree type is not supported." and pass with this change, and the 86 specs under src/rules and src/tree pass (run with jasmine, not Bazel).

Closes #26000

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction
@Thanatos9404
fix(@angular-devkit/schematics): support delegating trees in the `fil…
0fffc6d
…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
@angular-robot angular-robot Bot added the area: @angular-devkit/schematics label Oct 27, 2026
gemini-code-assist[bot]
gemini-code-assist Bot reviewed Oct 27, 2026
View reviewed changes

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/angular_devkit/schematics/src/rules/base.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

alan-agius4
alan-agius4 requested changes Oct 27, 2026
View reviewed changes
Comment thread packages/angular_devkit/schematics/src/rules/base.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@alan-agius4 alan-agius4 added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews target: patch This PR is targeted for the next patch release labels Oct 27, 2026
Thanatos9404 added 2 commits October 27, 2026 21:19
@Thanatos9404
fixup! fix(@angular-devkit/schematics): support delegating trees in t…
1f1d28d
…he `filter` rule
@Thanatos9404
fix(@angular-devkit/schematics): support delegating trees in partition
68b5efa
`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.
@Thanatos9404 Thanatos9404 changed the title fix(@angular-devkit/schematics): support delegating trees in the filter rule fix(@angular-devkit/schematics): support delegating trees in filter and partition Oct 27, 2026
alan-agius4
alan-agius4 approved these changes Oct 27, 2026
View reviewed changes

@alan-agius4 alan-agius4 left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM, thanks

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Oct 27, 2026
@alan-agius4

alan-agius4 commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

This PR was merged into the repository. The changes were merged into the following branches:

  • main: 9d6baa3
  • 22.2.x: e7fd1bd
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

alan-agius4 pushed a commit that referenced this pull request Oct 27, 2026
@Thanatos9404 @alan-agius4
fix(@angular-devkit/schematics): support delegating trees in the `fil…
1854c17
…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
alan-agius4 pushed a commit that referenced this pull request Oct 27, 2026
@Thanatos9404 @alan-agius4
fix(@angular-devkit/schematics): support delegating trees in `partiti…
e7fd1bd
…on` (#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 #34539
@alan-agius4 alan-agius4 closed this in 5094cd6 Oct 27, 2026
angular-robot pushed a commit to angular-robot/angular-cli that referenced this pull request Oct 27, 2026
@Thanatos9404 @alan-agius4
fix(@angular-devkit/schematics): support delegating trees in `partiti…
9d6baa3
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@alan-agius4 alan-agius4 alan-agius4 approved these changes
+1 more reviewer
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

action: merge The PR is ready for merge by the caretaker area: @angular-devkit/schematics target: patch This PR is targeted for the next patch release

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

filter does not work in UnitTestTree

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Thanatos9404 @alan-agius4
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.