Repository navigation
feat(core)!: migrate to angular 22 and fix vantage-reported vulnerabilities - #98
Conversation
…vert components to standalone GH-79
2d6d01f to
3f47e3a
Compare
|
==== Karma Test Coverage ==== |
…and add trivy workflow replace input output decorators with signal-based inputs and add trivy workflow BREAKING CHANGE: Yes GH-97
3f47e3a to
c8d4f6c
Compare
|
==== Karma Test Coverage ==== |
added sandbox and fix minor bugs GH-97
|
==== Karma Test Coverage ==== |
rohit-sourcefuse
left a comment
There was a problem hiding this comment.
🎯 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 existFix: 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 thisImportant 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(), andoutput() - Clean migration from
@Input/@Outputdecorators - Correct signal reactivity patterns
🎉 Outstanding Standalone Components:
- Well-implemented with proper
importsarrays - 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.tsupdates 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
@usesyntax
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.tsfile 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! 🚀
📋 Quick Action ChecklistFor faster resolution, here's a prioritized checklist of the critical fixes: Priority 1 - Breaking Issues:
Priority 2 - Memory Management:
Priority 3 - Error Handling:
Optional 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! 🎯 |
…s, trivy, imports, and effect errors
|
==== Karma Test Coverage ==== |
There was a problem hiding this comment.
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-popperjswith Angular CDK overlay system for improved maintainability - Added Trivy security scanning workflow and updated CI/CD workflows to use
--ignore-scriptsflag - 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.
|
==== Karma Test Coverage ==== |
a56e3e3 to
a4a5c75
Compare
|
==== Karma Test Coverage ==== |
…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
…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
|
==== Karma Test Coverage ==== |
rohit-sourcefuse
left a comment
There was a problem hiding this comment.
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-scriptsthennpx 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)
- The "+" button on an event group throws
TypeError: event.preventDefault is not a function, so the AND/OR popup never opens. - The published package does not declare
camunda-bpmn-moddle, so a consumer build fails withCould not resolve "camunda-bpmn-moddle/resources/camunda.json". It also has no Angular peers, and still lists@popperjs/core, which nothing uses now. - 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 holdsNPM_TOKENand the PAT. npm run buildat the root fails withCannot determine project for commandbecausedefaultProjectwas removed from angular.json. The docs workflow runs this step, so docs will not build.src/zone-flags.tsreplacesObject.getPrototypeOfglobally inside the web component bundle, which changes built-in behaviour on every page that embeds the element.
Non-blocking
WorkflowElementModuleis still exported but no longer provides the builder services, so bootstrapping it givesNullInjectorError: BuilderService. Sincemain.tsnow defines the element, I would remove the module and its export, or addprovideWorkflowCreator()to its providers.dropdownSettings: IDropdownSettingsin group.component.ts is no longer used by any template, but it putsimport { IDropdownSettings } from "ng-multiselect-dropdown"into the published typings. A consumer withskipLibCheck: falsegets TS2307. Deleting the property and the import fixes it.trivy.ymlsets noexit-code, so the scan never fails a PR. Addingexit-code: '1'andseverity: 'HIGH,CRITICAL'makes it a real gate.web-component-sandbox/holds byte-identical copies ofprojects/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:
popupTemplatewas removed from GroupComponent and NodeComponent, andNgxPopperjsModuleis no longer re-exported. - When squashing, please delete the
BREAKING CHANGE: Yeslines from c8d4f6c and keep the footer from fb46467, so the changelog entry stays clean. - An
enginesfield (^22.22.3 || ^24.15.0) would make the Node requirement from the description visible to contributors.
Happy to pair on any of these.
…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
|
==== Karma Test Coverage ==== |
rohit-sourcefuse
left a comment
There was a problem hiding this comment.
Thanks Piyush, all five must-fix items are resolved. I re-checked 03cf281 locally:
npm ci --ignore-scriptsand lint pass, and all 318 tests pass, including the new test for the group "+" click.- With
npm_config_offline=true,npm run buildandelementBuildsucceed 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.getPrototypeOfis untouched, and null-prototype objects no longer gain ahasOwnPropertykey. 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:
popupTemplatewas removed from GroupComponent and NodeComponent,NgxPopperjsModuleis no longer re-exported, andWorkflowElementModulewas removed. - The root package.json still lists
@popperjs/core. Its only use is an unusedStateimport inelement-input.interface.spec.ts, so both can go. - When squashing, please delete the
BREAKING CHANGE:/Yeslines from c8d4f6c and keep the footer from fb46467.
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-sandboxandprojects/workflows-elementlockfiles.BREAKING CHANGE:
Yes
What changed
@angular/buildreplaces the deprecated@angular-devkit/build-angular..eslintrcfiles are gone.bootstrapanduseWorkspacesare removed fromlerna.json.npm ciinstead oflerna bootstrap.build:docsruns typedoc throughnpx.npm run buildtargetsworkflows-creator, and the docs workflow relies on it. The root package has anenginesfield.media/.provideWorkflowCreator()with the standaloneBuilderComponent.Deleted files
.eslintrc.jsonandprojects/workflows-creator/.eslintrc.json: replaced by the ESLint 9 flat config ineslint.config.js. ESLint 9 no longer reads.eslintrcfiles.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 inangular.jsonunderpolyfills, 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 standaloneBuilderComponentandprovideWorkflowCreator()inprojects/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 theIDropdownSettingstype in the group component, and that import is gone.projects/workflows-creator/src/lib/workflow-element.module.ts: unused.main.tsdefines the element, and the module no longer provided the builder services.projects/workflows-creator/src/zone-flags.ts: this patchedObject.getPrototypeOfglobally to work around a leak. The element bundle concatenated the ES module chunks into one classic script, so saxen's top-levelvar hasOwnPropertyhoisted ontowindow. Each chunk is now wrapped in its own strict-mode scope, so no globals leak and the patch is not needed.../projects/workflows-element/dist.Fixes
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.
WorkflowBuilderModuleis no longer exported. Import the standaloneBuilderComponentin the host component, and addprovideWorkflowCreator()to the app providers instead:WorkflowElementModuleis removed. Host apps that imported it should useprovideWorkflowCreator().popupTemplateis removed fromGroupComponentandNodeComponent. Hosts that passed it need to drop it.NgxPopperjsModuleis no longer re-exported, and@popperjs/coreis no longer a peer dependency. Hosts that relied on either one need to add it themselves.diagramChangenow emits the BPMN XML string instead of{diagram, isValid}. Read validity from the newdiagramValidationoutput.ng-select 24 moved its theme to CSS custom properties (
--ng-select-*). Host apps that style.ng-selectshould check the visuals.The next release bumps
@sourceloop/workflows-creatorto 2.0.0.Testing
lerna run testpass too.skipLibCheckset to false..action-items.hide) on master and on this branch, so the test overrode that class to reach the button.npm cion both npm 10 and npm 11. CI runs Node 24, which ships npm 11.istanbul-lib-instrumentis a direct dev dependency because@angular/buildneeds 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.Merging
Squash is fine. The repo's squash default uses the commit messages, not the PR body. When squashing, delete the
Yesbreaking-change lines from c8d4f6c, and keep the breaking-change footer from fb46467. Lerna reads that footer for the major bump.Refs GH-97