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 — Provide better story for individual migration results · Issue #16016 · angular/angular-cli

Provide better story for individual migration results #16016

New issue
Copy link
New issue
Copy link
Open
Bug
Open
Provide better story for individual migration results#16016
Bug
Copy link
Labels
area: @angular/clifreq3: highng update DXseverity1: confusingtype: bug/fix
Milestone
Backlog

Description

@filipesilva
filipesilva
opened on Nov 1, 2019
Issue body actions

This issue impacts 9.0.0-rc.0 and happened while updating https://github.com/johannesjo/super-productivity and https://github.com/SAP/cloud-commerce-spartacus-storefront.

A failed update will show a message saying both the individual migration and the update failed:

× Package install failed, see above.
The update failed. See above.
git HEAD was at 85f08a4d93e684566f751e38e2a2feffe0194cd9 before migrations.
×  Migration failed. See above for further details.

The update below did not finish successfully however, and instead just shows the last migration as successful (@devversion confirms this). In this case the migration shows an error that it seems to suggest was actually recovered from, but it fact the intent is that the migration was interrupted and should later be resumed.

>  Undecorated classes with DI migration.
   As of Angular 9, it is no longer supported to use Angular DI on a class that does not have an Angular decorator.
   Read more about this here: https://v9.angular.io/guide/migration-undecorated-classes
    
    This migration uses the Angular compiler internally and therefore projects that no longer build successfully after the update cannot run the migration. Please ensure there are 
no AOT compilation errors and rerun the migration.. The following project failed: projects/storefrontlib/tsconfig.lib.json
    
    TypeError: Cannot read property 'module' of undefined
    
    Could not migrate all undecorated classes that use dependency
    injection. Some project targets could not be analyzed due to
    TypeScript program failures.

    Migration can be rerun with: "ng update @angular/core --from 8.0.0 --to 9.0.0 --migrate-only"

√  Migration succeeded.

A completely successful migration will look the same as the migration above though:

kamik@RED-X1C6 MINGW64 /d/sandbox/latest-app (master)
$ ng update @angular/cli @angular/core --next
The installed Angular CLI version is older than the latest published version.
Installing a temporary version to perform the update.
Installing packages for tooling via yarn.
warning @angular-devkit/[email protected]: The engine "pnpm" appears to be invalid.
warning @schematics/[email protected]: The engine "pnpm" appears to be invalid.
warning @angular-devkit/[email protected]: The engine "pnpm" appears to be invalid.
warning @angular-devkit/[email protected]: The engine "pnpm" appears to be invalid.
warning @schematics/[email protected]: The engine "pnpm" appears to be invalid.
warning @angular/[email protected]: The engine "pnpm" appears to be invalid.
Installed packages for tooling via yarn.
Using package manager: 'yarn'
Collecting installed dependencies...
Found 35 dependencies.
Fetching dependency metadata from registry...
    Updating package.json with dependency @angular/cli @ "9.0.0-rc.0" (was "8.3.17")...
    Updating package.json with dependency @angular/core @ "9.0.0-rc.0" (was "8.2.13")...
    Updating package.json with dependency @angular/language-service @ "9.0.0-rc.0" (was "8.2.13")...
    Updating package.json with dependency @angular/compiler-cli @ "9.0.0-rc.0" (was "8.2.13")...
    Updating package.json with dependency @angular/animations @ "9.0.0-rc.0" (was "8.2.13")...
    Updating package.json with dependency @angular/platform-browser @ "9.0.0-rc.0" (was "8.2.13")...
    Updating package.json with dependency @angular/platform-browser-dynamic @ "9.0.0-rc.0" (was "8.2.13")...
    Updating package.json with dependency @angular/common @ "9.0.0-rc.0" (was "8.2.13")...
    Updating package.json with dependency @angular/compiler @ "9.0.0-rc.0" (was "8.2.13")...
    Updating package.json with dependency @angular/forms @ "9.0.0-rc.0" (was "8.2.13")...
    Updating package.json with dependency @angular/router @ "9.0.0-rc.0" (was "8.2.13")...
    Updating package.json with dependency @angular-devkit/build-angular @ "0.900.0-rc.0" (was "0.803.17")...
UPDATE package.json (1636 bytes)
√ Packages installed successfully.
** Executing migrations of package '@angular/cli' **

>  Update an Angular CLI project to version 9.
UPDATE angular.json (6359 bytes)
UPDATE package.json (1637 bytes)
UPDATE server.ts (1863 bytes)
√ Packages installed successfully.
√  Migration succeeded.

>  Update lazy loading syntax to use dynamic imports.
√  Migration succeeded.

** Executing migrations of package '@angular/core' **

>  Static flag migration.
   Removes the `static` flag from dynamic queries.
   As of Angular 9, the "static" flag defaults to false and is no longer required for your view and content queries.
   Read more about this here: https://v9.angular.io/guide/migration-dynamic-flag
√  Migration succeeded.

>  Missing @Injectable migration.
   In Angular 9, enforcement of @Injectable decorators for DI is a bit stricter.
   Read more about this here: https://v9.angular.io/guide/migration-injectable
√  Migration succeeded.

>  ModuleWithProviders migration.
   In Angular 9, the ModuleWithProviders type without a generic has been deprecated.
   This migration adds the generic where it is missing.
   Read more about this here: https://v9.angular.io/guide/migration-module-with-providers
√  Migration succeeded.

>  NGCC postinstall migration.
   Adds an ngcc invocation to npm/yarn's postinstall script.
   Read more about this here: https://v9.angular.io/guide/migration-ngcc
UPDATE package.json (1743 bytes)
√ Packages installed successfully.
√  Migration succeeded.

>  Renderer to Renderer2 migration.
   As of Angular 9, the Renderer class is no longer available.
   Renderer2 should be used instead.
   Read more about this here: https://v9.angular.io/guide/migration-renderer
√  Migration succeeded.

>  Undecorated classes with decorated fields migration.
   As of Angular 9, it is no longer supported to have Angular field decorators on a class that does not have an Angular decorator.
   Read more about this here: https://v9.angular.io/guide/migration-undecorated-classes
√  Migration succeeded.

>  Undecorated classes with DI migration.
   As of Angular 9, it is no longer supported to use Angular DI on a class that does not have an Angular decorator.
   Read more about this here: https://v9.angular.io/guide/migration-undecorated-classes
√  Migration succeeded.

We should confirm the update finished, was successful, or if it was interrupted midway and should later be continued.

Reacted by Elvis Begovic and Paul Gschwendtner

Activity

Next
  1. filipesilva
    added
    type: bug/fix
    freq3: high
    severity1: confusing
    comp: schematics/update
    on Nov 1, 2019
  2. filipesilva
    added this to the 9.0.x milestone on Nov 1, 2019
  3. filipesilva
    changed the title [-]Failed updated shows a confirmation message, but successful one doesn't[/-] [+]It is not clear if the update finished successfully or not[/+] on Nov 1, 2019
  4. devversion commented on Nov 1, 2019

    @devversion
    devversion
    on Nov 1, 2019
    Member
    More actions

    This was previously not an issue because the CLI did not print any message stating that the migration was successful or not. Now with V9 of the CLI, it always prints Migration successful. This is not correct since migrations can be simply incomplete or failing gracefully (for various reasons).

    e.g. most of the time migrations have edge cases which cannot be handled automatically. In those cases user action is required and it does not make sense to make the user think that the migration was successful/complete.

  5. filipesilva commented on Nov 1, 2019

    @filipesilva
    filipesilva
    on Nov 1, 2019
    ContributorAuthor
    More actions

    If a migration can stop midway, it shouldn't print this indication though:

        Could not migrate all undecorated classes that use dependency
        injection. Some project targets could not be analyzed due to
        TypeScript program failures.
    
        Migration can be rerun with: "ng update @angular/core --from 8.0.0 --to 9.0.0 --migrate-only"
    

    This is incorrect because many packages can be updated at the same time. In this example it is only correct to use --migrate-only with @angular/core if that was the last package to be updated. But the migration does not know this.

    The update procedure itself should indicate how to resume from an interrupted migration, and show the full command to resume all un-fully-migrated packages.

  6. devversion commented on Nov 1, 2019

    @devversion
    devversion
    on Nov 1, 2019
    Member
    More actions

    I don't quite follow why that would be incorrect. The migration coming from @angular/core just asks the developer to re-run the migrations for @angular/core since the migration from core failed and manual action is needed. Previous migrations which were successful as part of @angular/core and will be scheduled twice if the given command is ran a second time, will just be a noop.

    Agreed that this is something the CLI could do, but at the time of writing this is not available and we achieved something similar by printing such a message. We did this in version 8 too.

  7. filipesilva commented on Nov 1, 2019

    @filipesilva
    filipesilva
    on Nov 1, 2019
    ContributorAuthor
    More actions

    It's incorrect because the original command was ng update @angular/core @angular/cli --next. The migrations for @angular/cli might not have happened yet when the update process was interrupted.

    So running ng update @angular/core --from 8.0.0 --to 9.0.0 --migrate-only does not get you to the same place as if the migration had not been interrupted. To do that you'd need instead to do ng update @angular/core @angular/cli --from 8.0.0 --to 9.0.0 --migrate-only (including CLI as well).

  8. devversion commented on Nov 1, 2019

    @devversion
    devversion
    on Nov 1, 2019
    Member
    More actions

    Why would the migrations from @angular/cli be relevant though for that particular migration that failed? It's true that the CLI migrations can change things too, but from the perspective of the @angular/core migration, the only prerequisite is that there is an TS project.

    If you are saying that the @angular/core migrations are dependent on migrations of the CLI, then I'm not sure if that is the right thing. I'd expect the the core migrations to be not dependent on migrations outside of the @angular/core scope. In general though.

    The way you are describing the issue is that followed migrations will be interrupted. This is not the goal and not the case currently. The goal is:

    1. All followed migrations continue executing.
    2. But only the incomplete migration will be re-run manually (with the given command)
      • Other migrations as part of @angular/core ran already and will be a noop.
  9. filipesilva commented on Nov 1, 2019

    @filipesilva
    filipesilva
    on Nov 1, 2019
    ContributorAuthor
    More actions

    Ah I see. Yes I did think that the last migration interrupted the process and prevented the remaining ones from executing.

    So that does sound right. We should somehow indicate that some migrations need extra attention and might require action.

    Reacted by Paul Gschwendtner
  10. alan-agius4 commented on Nov 5, 2019

    @alan-agius4
    alan-agius4
    on Nov 5, 2019
    Collaborator
    More actions

    The problem is that if you are handling an error gracefully, it means that the migration was successful. Because a migration fails when either a workflow event of type error or an exception were triggered.

    My 2 cents on the way forward here would be;

    • In the schematics, if there is an error, it should be thrown. As otherwise it will always be with a successful result.
    • In the CLI when a one of the migrations fail we don't stop the other migrations. We continue running the other migrations.
  11. dgp1130
    added 2 commits that reference this issue on Nov 12, 2019

    feat(@angular/cli): Renames "Migration succeeded" to "Migration compl…

    135a5dd

    feat(@angular/cli): Renames "Migration succeeded" to "Migration compl…

    2e43309
  12. 4 remaining items

  13. dgp1130
    added 2 commits that reference this issue on Nov 13, 2019

    fix(@angular/cli): Renames final message to "Migration completed". (#…

    823c658

    fix(@angular/cli): Renames final message to "Migration completed". (#…

    aea093a
  14. dgp1130 commented on Nov 13, 2019

    @dgp1130
    dgp1130
    on Nov 13, 2019
    Collaborator
    More actions

    Message change was merged to master and 9.0.x branches. I'll leave this issue open since it seems to be a larger challenge which will require a greater redesign to address. If that is being tracked elsewhere, then we can maybe close this issue.

  15. filipesilva commented on Nov 13, 2019

    @filipesilva
    filipesilva
    on Nov 13, 2019
    ContributorAuthor
    More actions

    Yeah this looks as good a place to track it as any.

    Reacted by Paul Gschwendtner
  16. devversion commented on Nov 13, 2019

    @devversion
    devversion
    on Nov 13, 2019
    Member
    More actions

    @alan-agius4 I feel differently. An example is that a migration cannot handle all patterns automatically and requests the developer to manually take action. In those case the migration is not successful nor complete. This is actually quite common since migrations most of the time are limited by the possibilities of static analysis. I agree that we could rethink how errors are handled (e.g. not gracefully exiting), but in terms of this issue, it seems to unveil the general issue where the CLI makes an assumption. It's wrong to assume that a migration is complete or successful if it didn't throw. There should be an API to communicate back to the CLI what the status is (for purposes like printing how to rerun the migration). In any case though (except when an error is thrown), the CLI should not make any assumption IMO.

  17. clydin commented on Nov 13, 2019

    @clydin
    clydin
    on Nov 13, 2019
    Member
    More actions

    A larger expansion and refactoring is planned and will include a structured migration system. However, at the current juncture the migrations will need to work within the current confines of the system. This unfortunately means that the migrations themselves will need to contain more boilerplate and infrastructure than should ideally be needed. But this will improve as update is updated.

  18. filipesilva
    modified the milestones: v9-candidates, Backlog on Nov 14, 2019
  19. filipesilva
    changed the title [-]It is not clear if the update finished successfully or not[/-] [+]Provide better story for individual migration results[/+] on Nov 14, 2019
  20. alan-agius4
    added
    triage #1
    on May 27, 2020
  21. alan-agius4
    added
    area: @angular/cli
    and removed
    comp: schematics/update
    on Apr 1, 2021
  22. alan-agius4
    added
    ng update DX
    on May 31, 2021
  23. alan-agius4
    removed
    triage #1
    on Jun 24, 2022
  24. mostafaibr
    added a commit that references this issue on May 29, 2026

    fix(@angular/cli): Renames final message to "Migration completed". (a…

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular/clifreq3: highng update DXseverity1: confusingtype: bug/fix

    Type

    Bug

    Projects

    No projects

      Milestone

      • BacklogNo due date

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.