Skip to content

fix(schematics): resolve valid project template before upgrading packages - #1799

Open
ivanvpetrov wants to merge 3 commits into
masterfrom
ipetrov/fix-angular-schematics-upgrade
Open

fix(schematics): resolve valid project template before upgrading packages#1799
ivanvpetrov wants to merge 3 commits into
masterfrom
ipetrov/fix-angular-schematics-upgrade

Conversation

@ivanvpetrov

@ivanvpetrov ivanvpetrov commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Description

This fixes the upgrade-packages fallback logic for Angular projects.

Previously, when a configured project template was missing/invalid, the code fell back to the first project in the library without checking whether it was a valid upgrade target. That allowed hidden/partial templates such as ai-config to be picked, which led to runtime failures such as Method not implemented

Related Issue

Closes #1797

What changed

  • added a shared resolver to select only valid, non-hidden, upgrade-capable templates
  • reused that logic in the Angular schematic, CLI upgrade flow, and package manager upgrade flow
  • fail gracefully when no valid project template can be resolved

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring / code cleanup
  • Build / CI configuration change

Affected Packages

  • igniteui-cli (packages/cli)
  • @igniteui/cli-core (packages/core)
  • @igniteui/angular-templates (packages/igx-templates)
  • @igniteui/angular-schematics (packages/ng-schematics)
  • @igniteui/mcp-server (packages/igniteui-mcp)

Checklist

  • I have tested my changes locally (npm run test)
  • I have built the project successfully (npm run build)
  • I have run the linter (npm run lint)
  • I have added/updated tests as needed
  • My changes do not introduce new warnings or errors

Additional Context

Copilot AI lite review requested due to automatic review settings September 8, 2026 11:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new resolver’s return type is inconsistent with its documented/implemented null behavior, and one upgrade path currently fails silently when no upgradeable template can be resolved (with missing focused test coverage for the resolver).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR fixes upgrade-packages fallback behavior by introducing a shared resolver that selects only valid, non-hidden project templates for upgrade operations, preventing hidden/partial templates (e.g., ai-config) from being chosen and throwing Method not implemented.

Changes:

  • Added resolveUpgradeableProject helper to filter out hidden/non-upgradeable project templates and provide a safe fallback selection.
  • Reused the resolver in Angular schematics, CLI upgrade-packages, and core PackageManager upgrade paths.
  • Added explicit failure handling in the schematic/CLI flows when no upgradeable project template can be resolved.
File summaries
File Description
packages/ng-schematics/src/upgrade-packages/index.ts Uses shared resolver and throws a SchematicsException when no valid template is available.
packages/core/util/ProjectTemplateResolver.ts Introduces resolver to pick a non-hidden, upgrade-capable project template (or none).
packages/core/util/index.ts Re-exports the new resolver from the util barrel.
packages/core/packages/PackageManager.ts Switches upgrade path to use resolver and conditionally invokes the template upgrade hook.
packages/cli/lib/commands/upgrade.ts Switches CLI upgrade flow to use resolver and emits an error when no valid template is resolved.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/core/packages/PackageManager.ts
Comment thread packages/core/util/ProjectTemplateResolver.ts Outdated
Comment thread packages/core/util/ProjectTemplateResolver.ts
@coveralls

coveralls commented Sep 8, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 88.331% (-0.007%) from 88.338% — ipetrov/fix-angular-schematics-upgrade into master

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The shared resolver correctly prevents hidden or unsupported templates from being selected and handles missing targets gracefully.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Angular] Angular schematics upgrade packages throws an error

5 participants