Skip to content

Bugfix: invalid starting workflow form handling#3760

Open
andrewbrazzatti wants to merge 1 commit intofeature/ng19-formsfrom
bugfix/handle-no-form
Open

Bugfix: invalid starting workflow form handling#3760
andrewbrazzatti wants to merge 1 commit intofeature/ng19-formsfrom
bugfix/handle-no-form

Conversation

@andrewbrazzatti
Copy link
Contributor

Summary

This pull request fixes an issue where fetching the starting workflow form could crash the application when the form was not configured correctly.

The FormsService has been updated to improve error handling and logging around starting workflow form retrieval. The RxJS pipeline was also simplified to make the logic clearer and more reliable, ensuring that failures do not break the observable chain.


Context / related work

  • Improves robustness of workflow form loading when configuration is incomplete or incorrect.
  • Ensures the application fails gracefully instead of crashing when a starting form is missing.
  • Adds better diagnostic logging to assist with debugging workflow configuration issues.

Technical implementation details

Improved error handling and logging

Additional safeguards were added when fetching starting workflow forms:

  • A warning log is now emitted when no starting form is found for a given branding and record type.
  • Errors occurring during starting form retrieval are now caught and logged, preventing them from terminating the observable chain.

This ensures:

  • The application remains stable even when configuration is incorrect.
  • Administrators and developers have clearer logs when diagnosing configuration problems.

RxJS pipeline refactor

The RxJS pipeline used to fetch the starting workflow form was simplified for clarity and correctness.

Changes include:

  • Replaced filter and last with take(1) to retrieve the first matching result more reliably.
  • Updated RxJS imports to include only operators that are actually used:
    • take
    • tap
    • map
    • catchError
  • Removed unused imports for improved code clarity.

Code readability improvements

  • Renamed the variable inside the flatMap callback from recordType to recordTypeRecord to avoid shadowing and improve readability.

Testing

  • Verified that the application no longer crashes when the starting workflow form is missing or misconfigured.
  • Confirmed appropriate warning and error logs are emitted.
  • Angular build and tests pass successfully.

Impact

  • Prevents application crashes when starting workflow forms are missing or misconfigured.
  • Improves logging for diagnosing workflow configuration issues.
  • Simplifies and clarifies the RxJS implementation used for form retrieval.

@andrewbrazzatti andrewbrazzatti self-assigned this Mar 6, 2026
@andrewbrazzatti andrewbrazzatti added this to the v5.0 milestone Mar 6, 2026
@andrewbrazzatti andrewbrazzatti requested a review from shilob March 6, 2026 00:16
@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.54%. Comparing base (cea8b87) to head (bab7bff).

Additional details and impacted files
@@                  Coverage Diff                   @@
##           feature/ng19-forms    #3760      +/-   ##
======================================================
- Coverage               53.54%   53.54%   -0.01%     
======================================================
  Files                     396      396              
  Lines                   29298    29303       +5     
  Branches                 6723     6727       +4     
======================================================
+ Hits                    15689    15690       +1     
- Misses                  12758    12762       +4     
  Partials                  851      851              
Flag Coverage Δ
backend-bruno-general 63.88% <ø> (ø)
backend-bruno-oidc 50.00% <ø> (ø)
backend-mocha 50.00% <ø> (ø)
backend-redbox-core 43.46% <ø> (-0.02%) ⬇️
backend-redbox-dev-tools-cli 63.56% <ø> (ø)
backend-sails-ng-common 70.48% <ø> (ø)
frontend-admin-vocabulary 55.75% <ø> (ø)
frontend-app-config 80.63% <ø> (ø)
frontend-branding 52.80% <ø> (ø)
frontend-core-lib 40.79% <ø> (ø)
frontend-dashboard 69.29% <ø> (ø)
frontend-deleted-records 84.53% <ø> (ø)
frontend-export 100.00% <ø> (ø)
frontend-form 78.34% <ø> (+0.02%) ⬆️
frontend-local-auth 100.00% <ø> (ø)
frontend-manage-roles 63.33% <ø> (ø)
frontend-manage-users 64.95% <ø> (ø)
frontend-record-search 83.22% <ø> (ø)
frontend-report 94.44% <ø> (ø)
frontend-translation 67.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant