Skip to content

feat(core)!: migrate to angular 22 and fix vantage-reported vulnerabilities - #98

Merged
rohit-sourcefuse merged 8 commits into
masterfrom
GH-97
Nov 25, 2026
Merged

rohit-sourcefuse merged 8 commits into
masterfrom
GH-97

Conversation

@piyushsinghgaur1

@piyushsinghgaur1 piyushsinghgaur1 commented Dec 31, 2025 •

Copy link
Copy Markdown
Contributor

Why

The Vantage scan forwarded on 2026-11-17 and 18 reported 116 rows on master's root package-lock.json. Seven are critical, 61 high and 48 medium. Most come from the old Angular 13 packages, axios, form-data, handlebars, tar, nx, pacote and older transitive packages.

After this PR, trivy reports no findings at any severity in the root, projects/workflows-creator, workflow-sandbox and projects/workflows-element lockfiles.

BREAKING CHANGE:
Yes

What changed

  • Angular 13 is now 22.2.6 for the library, the web component and the sandbox. This builds on the Angular 19 and 20 work already in this PR: standalone components, signal inputs and outputs, and CDK overlays in place of ngx-popperjs.
  • @angular/build replaces the deprecated @angular-devkit/build-angular.
  • ng-select 24, TypeScript 6, and eslint 9 with a flat config. The .eslintrc files are gone.
  • lerna 10. bootstrap and useWorkspaces are removed from lerna.json.
  • The three GitHub workflows run on Node 24 with actions v5. They run npm ci instead of lerna bootstrap.
  • The trivy workflow fails the PR on HIGH or CRITICAL findings.
  • semantic-release and typedoc are no longer dev dependencies. build:docs runs typedoc through npx.
  • The library declares its runtime dependencies: bpmn-moddle, camunda-bpmn-moddle, lodash and moment.
  • tsx and fs-extra are pinned and run locally in the release workflow, so nothing is downloaded at release time. ts-node and concat are dropped.
  • The root npm run build targets workflows-creator, and the docs workflow relies on it. The root package has an engines field.
  • The web component keeps zone-based change detection.
  • The element bundle is rebuilt. The element package now ships its icon fonts in media/.
  • The READMEs show provideWorkflowCreator() with the standalone BuilderComponent.
  • The sandbox runs on Angular 22 and loads the element from its dist folder.

Deleted files

  • .eslintrc.json and projects/workflows-creator/.eslintrc.json: replaced by the ESLint 9 flat config in eslint.config.js. ESLint 9 no longer reads .eslintrc files.
  • projects/workflows-creator/src/test.ts: no longer needed. Since Angular 15 the karma builder finds the spec files itself, and the zone.js testing polyfill is set in angular.json under polyfills, so this bootstrap file is unused.
  • projects/workflows-creator/src/lib/workflow-builder.module.ts (removed in 42aec8e): the components are standalone now. The NgModule is replaced by the standalone BuilderComponent and provideWorkflowCreator() in projects/workflows-creator/src/lib/provide-workflow-creator.ts. That function registers the same services and BPMN nodes, elements and inputs the module provided. The module also pulled in ngx-popperjs, ng-multiselect-dropdown and BrowserAnimationsModule. ngx-popperjs is no longer a dependency, and the library no longer imports BrowserAnimationsModule. ng-multiselect-dropdown is removed as well. It was listed only for the IDropdownSettings type in the group component, and that import is gone.
  • projects/workflows-creator/src/lib/workflow-element.module.ts: unused. main.ts defines the element, and the module no longer provided the builder services.
  • projects/workflows-creator/src/zone-flags.ts: this patched Object.getPrototypeOf globally to work around a leak. The element bundle concatenated the ES module chunks into one classic script, so saxen's top-level var hasOwnProperty hoisted onto window. Each chunk is now wrapped in its own strict-mode scope, so no globals leak and the patch is not needed.
  • The web-component-sandbox copies of the bundle, styles, fonts, icon assets and the old styles build. The page now loads ../projects/workflows-element/dist.

Fixes

  • People selection is saved again. On master the blur handler threw an error and nothing was saved.
  • Typing a date no longer clears the date.
  • Enter commits a Number input and closes its popup.
  • Escape saves and closes a popup.
  • Popup content is styled inside the overlay.
  • Clicking the group "+" opens the AND/OR popup, and the picked group renders.
  • Restoring a saved workflow works again. A diagram and state passed in before the first render are restored. A state-only change no longer brings back the old diagram.
  • Group and node components keep eager change detection. Angular 22 defaults to OnPush, and the builder changes their objects in place.
  • Unused code is removed.

Breaking changes

  • The library has Angular 22 peer dependencies: core, common, forms, elements, platform-browser and cdk. It also needs rxjs ^7.8.0. Building the package needs Node ^22.22.3 or ^24.15.0.

  • WorkflowBuilderModule is no longer exported. Import the standalone BuilderComponent in the host component, and add provideWorkflowCreator() to the app providers instead:

    // app.config.ts
    providers: [provideWorkflowCreator()],
    
    // host component
    imports: [BuilderComponent],
  • WorkflowElementModule is removed. Host apps that imported it should use provideWorkflowCreator().

  • popupTemplate is removed from GroupComponent and NodeComponent. Hosts that passed it need to drop it.

  • NgxPopperjsModule is no longer re-exported, and @popperjs/core is no longer a peer dependency. Hosts that relied on either one need to add it themselves.

  • diagramChange now emits the BPMN XML string instead of {diagram, isValid}. Read validity from the new diagramValidation output.

  • ng-select 24 moved its theme to CSS custom properties (--ng-select-*). Host apps that style .ng-select should check the visuals.

  • The next release bumps @sourceloop/workflows-creator to 2.0.0.

Testing

  • Unit tests: 318 of 318 pass. The new tests cover the group "+" click, picking AND or OR, popup cleanup on destroy for the builder and the group component, and effect error handling. Lint is clean. The library, element and sandbox builds pass, and the offline builds and lerna run test pass too.
  • The packed tarball installs alone in an empty project. It bundles and type-checks with skipLibCheck set to false.
  • Master was built from source and compared with the new element on the same host page, with no patch applied to the page. The run covers 15 scenarios, including the group "+" with OR on an event group. 13 match exactly. The other 2 differ only where master saves nothing: Number with Enter and People. The 4 restore variants match.
  • The group "+" is hidden by CSS (.action-items.hide) on master and on this branch, so the test overrode that class to reach the button.
  • The lockfile now passes npm ci on both npm 10 and npm 11. CI runs Node 24, which ships npm 11. istanbul-lib-instrument is a direct dev dependency because @angular/build needs it for coverage. The trivy action is pinned to v0.35.0 by commit SHA, since the 0.28.0 tag no longer resolves (d6ef721). The npm lint and trivy checks pass on this head.
  • The release and docs workflows have not run on GitHub yet. The release Test step passes locally. A dry run of the release workflow before the next release would be worth it.

Merging

Squash is fine. The repo's squash default uses the commit messages, not the PR body. When squashing, delete the Yes breaking-change lines from c8d4f6c, and keep the breaking-change footer from fb46467. Lerna reads that footer for the major bump.

Refs GH-97

@github-actions

Copy link
Copy Markdown

==== Karma Test Coverage ====
Statements: 40.8% ( 774/1897 )
Branches : 19.22% ( 124 /645 )
Functions : 38.74% ( 160 /413 )
Lines : 41.48% ( 767 /1849 )

…and add trivy workflow

replace input output decorators with signal-based inputs and add trivy workflow

BREAKING CHANGE:
Yes

GH-97
@github-actions

github-actions Bot commented Jan 5, 2026

Copy link
Copy Markdown

==== Karma Test Coverage ====
Statements: 40.8% ( 774/1897 )
Branches : 19.22% ( 124 /645 )
Functions : 38.74% ( 160 /413 )
Lines : 41.48% ( 767 /1849 )

added sandbox and fix minor bugs

GH-97
@github-actions

Copy link
Copy Markdown

==== Karma Test Coverage ====
Statements: 40.82% ( 776/1901 )
Branches : 19.04% ( 124 /651 )
Functions : 38.88% ( 161 /414 )
Lines : 41.5% ( 769 /1853 )

@piyushsinghgaur1
piyushsinghgaur1 marked this pull request as ready for review January 20, 2026 06:08

@rohit-sourcefuse rohit-sourcefuse left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 APPROVE WITH CHANGES - Excellent Angular 19 Migration

This is outstanding migration work that demonstrates deep understanding of Angular 19 patterns and modern best practices. The architectural improvements are substantial and well-executed. However, there are several critical issues that need fixing before merge.

Critical Issues (Must Fix):

1. 🔴 Duplicate ngClass Binding

File: projects/workflows-creator/src/lib/builder/group/group.component.html Line: 47

Remove the duplicate [ngClass] binding (Angular will only use the last one):

<workflow-node
  [ngClass]="{'last-node': i === group().children.length - 1}"
  [node]="node"
  [ngClass]="{'last-node': i === group().children.length - 1}"  <!-- REMOVE THIS -->
  [isLast]="i === group().children.length - 1"

2. 🔴 Memory Leak: Unmanaged Overlay Subscriptions

Files: builder.component.ts:459, group.component.ts:385,520

The backdrop click subscriptions will cause memory leaks:

// Current problematic code:
this.overlayRef.backdropClick().subscribe(() => this.closeOverlay());

// Fix Option 1: Proper cleanup
private subscription?: Subscription;

ngOnDestroy() {
  this.subscription?.unsubscribe();
}

// Fix Option 2: Auto-complete
this.overlayRef.backdropClick().pipe(take(1)).subscribe(() => this.closeOverlay());

3. 🔴 Missing Trivy Configuration File

File: .github/workflows/trivy.yml Line: 29

The workflow references a non-existent config file:

trivy-config: "${{ github.workspace }}/trivy.yaml"  # File doesn't exist

Fix: Either add the trivy.yaml file or remove this line to use Trivy defaults.

4. 🔴 Unused Import Cleanup

File: group.component.spec.ts Line: 37

import {popper} from '@popperjs/core';  // Not used - remove this

Important Issues (Should Fix):

5. Missing OnDestroy Implementation

Both BuilderComponent and GroupComponent should implement OnDestroy:

export class BuilderComponent<E> implements OnInit, OnDestroy {
  ngOnDestroy(): void {
    this.closeOverlay();
  }
}

6. Effect Error Handling

File: builder.component.ts Lines: 98-127

Consider adding error handling to the signal effect:

effect(() => {
  try {
    // existing logic
  } catch (error) {
    console.error('Effect error in BuilderComponent:', error);
    // Handle gracefully - maybe reset state or show user error
  }
});

✅ Excellent Migration Highlights:

🎉 Perfect Signal Implementation:

  • Proper use of input(), input.required(), and output()
  • Clean migration from @Input/@Output decorators
  • Correct signal reactivity patterns

🎉 Outstanding Standalone Components:

  • Well-implemented with proper imports arrays
  • Clean removal of NgModule dependencies
  • Excellent provideWorkflowCreator() provider function

🎉 Solid CDK Integration:

  • Good migration from ngx-popperjs to Angular CDK overlays
  • Proper overlay positioning and management
  • Clean template updates

🎉 Modern Build System:

  • Correct Angular 19 builder configuration (@angular-devkit/build-angular:application)
  • Smart bundle-element.ts updates for hashed output files
  • Good CI/CD improvements with --ignore-scripts

🎉 Security & Dependencies:

  • Thoughtful dependency pinning with overrides
  • Good Trivy security scanning addition (once config is fixed)
  • Clean SCSS migration to @use syntax

Test Coverage Notes:

Consider adding tests for:

  • Signal effect behavior and error handling
  • Overlay subscription cleanup verification
  • Component destruction scenarios
  • Signal reactivity edge cases

Minor Cleanup:

  • Delete the empty workflow-builder.module.ts file entirely

Overall Assessment:

This migration showcases excellent Angular expertise. The architectural improvements are significant:

  • Clean separation with standalone components
  • Modern reactive patterns with signals
  • Better maintainability with CDK overlays
  • Improved build pipeline

Once the critical issues are addressed (especially memory leaks and duplicate bindings), this will be a stellar migration that sets a great foundation for Angular 19.

Great work on tackling such a comprehensive framework upgrade! 🚀

@rohit-sourcefuse

rohit-sourcefuse commented Jan 20, 2026 •

Copy link
Copy Markdown

📋 Quick Action Checklist

For faster resolution, here's a prioritized checklist of the critical fixes:

Priority 1 - Breaking Issues:

  • Remove duplicate [ngClass] in group.component.html line 47
  • Add trivy.yaml config file or remove reference in .github/workflows/trivy.yml line 29
  • Remove unused popper import from group.component.spec.ts line 37

Priority 2 - Memory Management:

  • Add OnDestroy to BuilderComponent and GroupComponent
  • Fix overlay subscription cleanup in builder.component.ts line 459
  • Fix overlay subscription cleanup in group.component.ts lines 385, 520

Priority 3 - Error Handling:

  • Add try-catch to signal effect in builder.component.ts lines 98-127
  • Add error handling to overlay disposal methods

Optional Cleanup:

  • Delete empty workflow-builder.module.ts file
  • Add tests for signal effects and overlay cleanup

The Priority 1 items will cause immediate build/runtime issues, so tackle those first. The memory management fixes (Priority 2) are critical for production stability.

Excellent work on this migration - these are just polish items on an otherwise outstanding Angular 19 upgrade! 🎯

@github-actions

Copy link
Copy Markdown

==== Karma Test Coverage ====
Statements: 40.99% ( 781/1905 )
Branches : 19.04% ( 124 /651 )
Functions : 39.66% ( 165 /416 )
Lines : 41.61% ( 774 /1860 )

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the Angular codebase by upgrading to Angular 19, refactoring components to use standalone architecture and signal-based inputs, replacing ngx-popperjs with Angular CDK overlays, and enhancing CI/CD workflows with security scanning and improved dependency management.

Changes:

  • Upgraded Angular and related dependencies to v19 with standalone component architecture and signal-based inputs/outputs
  • Replaced ngx-popperjs with Angular CDK overlay system for improved maintainability
  • Added Trivy security scanning workflow and updated CI/CD workflows to use --ignore-scripts flag
  • Refactored bundling script to handle new Angular build output structure with hashed filenames

Reviewed changes

Copilot reviewed 69 out of 85 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
workflow-sandbox/* New standalone Angular 19 sandbox application with modern configuration
web-component-sandbox/* Updated web component sandbox with zone.js patches and updated styling
projects/workflows-element/package.json Updated hash for rebuilt web component bundle
projects/workflows-creator/src/lib/builder/* Converted components to standalone with signal-based inputs, replaced popper with CDK overlays
projects/workflows-creator/src/lib/provide-workflow-creator.ts New provider function replacing WorkflowBuilderModule for Angular 19
projects/workflows-creator/src/zone-flags.ts Added zone.js configuration to fix hasOwnProperty errors
projects/workflows-creator/bundle-element.ts Refactored to handle Angular 19 hashed build outputs
package.json, angular.json Updated dependencies to Angular 19 and modernized build configuration
.github/workflows/* Added Trivy scan and updated workflows with security improvements

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread projects/workflows-creator/src/test.ts Resolved
Comment thread web-component-sandbox/index.html Resolved
Comment thread projects/workflows-creator/src/main.ts Resolved
Comment thread projects/workflows-creator/src/test.ts Resolved
Comment thread projects/workflows-creator/src/test.ts Resolved
@github-actions

Copy link
Copy Markdown

==== Karma Test Coverage ====
Statements: 40.39% ( 778/1926 )
Branches : 17.62% ( 120 /681 )
Functions : 39.28% ( 165 /420 )
Lines : 41.01% ( 771 /1880 )

@github-actions

Copy link
Copy Markdown

==== Karma Test Coverage ====
Statements: 40.39% ( 778/1926 )
Branches : 17.62% ( 120 /681 )
Functions : 39.28% ( 165 /420 )
Lines : 41.01% ( 771 /1880 )

…ities

- Angular 22.2.6, ng-select 24, TypeScript 6, eslint 9 flat config,
  lerna 10 (bootstrap and useWorkspaces removed), CI workflows on Node 24.
- Drop semantic-release and typedoc dev deps; build:docs uses npx typedoc.
- All lockfiles clear of the Vantage/trivy HIGH/CRITICAL findings.

Fixes: People selection is saved again. A typed date is no longer cleared
while typing. Enter and Escape commit and close popups. Overlay content is
styled. Unused code removed.

Restoring a saved workflow works again. Diagram and state passed in before
the first render are restored, and a state-only change no longer restores
the old diagram. Group and node components keep eager change detection,
since Angular 22 defaults to OnPush.

Element bundle rebuilt.

BREAKING CHANGE: requires Angular 22. diagramChange now emits the BPMN XML
string instead of {diagram, isValid}; read validity from the new
diagramValidation output.

Refs GH-97
@piyushsinghgaur1 piyushsinghgaur1 changed the title feat(core): migrate to Angular 19, fix audit vulnerabilities, and convert components to standalone, replace input output decorators with signal-based inputs and add trivy workflow feat(core): migrate to angular 22 and fix vantage-reported vulnerabilities Nov 25, 2026
…kfile

- Pin aquasecurity/trivy-action to commit 57a97c7e7821a5776cebc9bb87c984fa69cba8f1
  (v0.35.0) in trivy.yml, replacing the 0.28.0 tag.
- Add istanbul-lib-instrument ^6.0.3 as a devDependency for coverage
  instrumentation of the @angular/build:karma builder.
- Add the platform-specific optional binaries (esbuild, lmdb, msgpackr-extract,
  napi-rs and similar for linux, windows and darwin x64) to package-lock.json,
  so npm ci works on Linux CI. 210 entries added, 6 removed, no downgrades.

Refs GH-97
@github-actions

Copy link
Copy Markdown

==== Karma Test Coverage ====
Statements: 44.43% ( 859/1933 )
Branches : 23.58% ( 163 /691 )
Functions : 42.45% ( 180 /424 )
Lines : 45.09% ( 851 /1887 )

@piyushsinghgaur1 piyushsinghgaur1 changed the title feat(core): migrate to angular 22 and fix vantage-reported vulnerabilities feat(core)!: migrate to angular 22 and fix vantage-reported vulnerabilities Nov 25, 2026

@rohit-sourcefuse rohit-sourcefuse left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks Piyush, this is a big step forward. I checked it out and ran it locally against master.

What I verified

  • npm ci --ignore-scripts, lint, the 312 unit tests and the library build all pass.
  • The release path (npm ci --ignore-scripts then npx lerna run test) builds both packages, and the rebuilt element bundle is byte-identical to the committed one.
  • Trivy reports 0 findings in all four lockfiles (root on master had 264, 10 of them critical).
  • provideWorkflowCreator() registers the same nodes, elements, inputs and strategies as the old module, and the overlay cleanup looks right.

Must fix before merge (details and tested fixes in the inline comments)

  1. The "+" button on an event group throws TypeError: event.preventDefault is not a function, so the AND/OR popup never opens.
  2. The published package does not declare camunda-bpmn-moddle, so a consumer build fails with Could not resolve "camunda-bpmn-moddle/resources/camunda.json". It also has no Angular peers, and still lists @popperjs/core, which nothing uses now.
  3. The release job runs npx tsx, but tsx is not in package.json or the lockfile, so npx downloads the latest tsx (and esbuild with its install script) inside the job that holds NPM_TOKEN and the PAT.
  4. npm run build at the root fails with Cannot determine project for command because defaultProject was removed from angular.json. The docs workflow runs this step, so docs will not build.
  5. src/zone-flags.ts replaces Object.getPrototypeOf globally inside the web component bundle, which changes built-in behaviour on every page that embeds the element.

Non-blocking

  • WorkflowElementModule is still exported but no longer provides the builder services, so bootstrapping it gives NullInjectorError: BuilderService. Since main.ts now defines the element, I would remove the module and its export, or add provideWorkflowCreator() to its providers.
  • dropdownSettings: IDropdownSettings in group.component.ts is no longer used by any template, but it puts import { IDropdownSettings } from "ng-multiselect-dropdown" into the published typings. A consumer with skipLibCheck: false gets TS2307. Deleting the property and the import fixes it.
  • trivy.yml sets no exit-code, so the scan never fails a PR. Adding exit-code: '1' and severity: 'HIGH,CRITICAL' makes it a real gate.
  • web-component-sandbox/ holds byte-identical copies of projects/workflows-element/dist/* (about 75k lines) and nothing references the folder. I would drop the copies or load them from the dist folder.
  • Please also list these in the breaking notes: popupTemplate was removed from GroupComponent and NodeComponent, and NgxPopperjsModule is no longer re-exported.
  • When squashing, please delete the BREAKING CHANGE: Yes lines from c8d4f6c and keep the footer from fb46467, so the changelog entry stays clean.
  • An engines field (^22.22.3 || ^24.15.0) would make the Node requirement from the description visible to contributors.

Happy to pair on any of these.

Comment thread projects/workflows-creator/package.json Resolved
Comment thread package.json Resolved
…roup popup

- group "+" passes the click event so the AND/OR popup opens, and the picked group now renders
- library declares Angular 22 peers and its runtime dependencies (bpmn-moddle, camunda-bpmn-moddle, lodash, moment); @popperjs/core peer dropped
- tsx and fs-extra pinned and run locally, ts-node and concat dropped; root build targets workflows-creator; engines field added
- element bundle wraps each chunk in its own scope instead of patching Object.getPrototypeOf globally (zone-flags.ts removed); icon fonts shipped in the element dist
- WorkflowElementModule and the unused ng-multiselect-dropdown types removed
- trivy fails the PR on HIGH/CRITICAL; web-component-sandbox loads the element from dist instead of committed copies
- READMEs show provideWorkflowCreator() with the standalone BuilderComponent

Refs GH-97
@github-actions

Copy link
Copy Markdown

==== Karma Test Coverage ====
Statements: 46.08% ( 889/1929 )
Branches : 26.33% ( 182 /691 )
Functions : 43.97% ( 186 /423 )
Lines : 46.76% ( 881 /1884 )

@rohit-sourcefuse rohit-sourcefuse left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks Piyush, all five must-fix items are resolved. I re-checked 03cf281 locally:

  • npm ci --ignore-scripts and lint pass, and all 318 tests pass, including the new test for the group "+" click.
  • With npm_config_offline=true, npm run build and elementBuild succeed using the local tsx, and the rebuilt element bundle is byte-identical to the committed one.
  • I packed the library and installed only the tarball in an empty project. It bundles cleanly and type-checks with skipLibCheck: false.
  • I loaded the element bundle in headless Chrome. It renders with no console errors, Object.getPrototypeOf is untouched, and null-prototype objects no longer gain a hasOwnProperty key. Wrapping each chunk in its own scope is a cleaner fix than the patch.
  • Trivy reports 0 findings in all four lockfiles, dev dependencies included.

Small items, none of them blocking:

  • Please add these to the breaking changes in the description: popupTemplate was removed from GroupComponent and NodeComponent, NgxPopperjsModule is no longer re-exported, and WorkflowElementModule was removed.
  • The root package.json still lists @popperjs/core. Its only use is an unused State import in element-input.interface.spec.ts, so both can go.
  • When squashing, please delete the BREAKING CHANGE: / Yes lines from c8d4f6c and keep the footer from fb46467.

@rohit-sourcefuse
rohit-sourcefuse merged commit caedf18 into master Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to Angular 19, Remove Vulnerabilities, and Migrate to Signals & Standalone Components

4 participants