sartography / spiff-arena

SpiffWorkflow is a software development platform for building, running, and monitoring executable diagrams
https://www.spiffworkflow.org/
GNU Lesser General Public License v2.1
48 stars 36 forks source link

Update get_current_user in process models #1436

Closed sashayar13 closed 3 weeks ago

sashayar13 commented 1 month ago

Update get_current_user in existing process models to satisfy the changes needed for the background processor fixes.

calexh-sar commented 1 month ago

@sashayar13 updates have been made to Good & Services, Travel and Expense in dev.

@madhurrya would you please test these to make sure that the processes still execute as intended and that the BO and SME can be changed by an Admin.

@burnettk are you showing any other processes that need to be updated on dev?

burnettk commented 1 month ago

here's the full list after your updates:

 ~/projects/github/sartography/spiff-arena/spiffworkflow-backend | py 3.12.1 | main *13 | 4s > SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR=/Users/kevin/projects/github/status-im/process-models ./bin/run_local_python_script ./bin/lint_get_current_user_scripts.py
[2024-04-23 14:57:16,342] DEBUG in logging_service: Printing log to create app logger
\2024-04-23 14:57:16,343 - spiffworkflow_backend - DEBUG - SPIFFWORKFLOW_BACKEND_BPMN_SPEC_ABSOLUTE_DIR: /Users/kevin/projects/github/status-im/process-models
Found get_current_user() in script task remove_approver of file /Users/kevin/projects/github/status-im/process-models/misc/test/spiff-demo-testing/examples/1-basic-concepts/1-6-roles/lanes_with_dict.bpmn
Found get_current_user() in script task Activity_0tr6u2s of file /Users/kevin/projects/github/status-im/process-models/misc/test/spiff-demo-testing/examples/1-basic-concepts/1-6-roles/my_vacation.bpmn
Found get_current_user() in script task Activity_GetReviewers of file /Users/kevin/projects/github/status-im/process-models/misc/test/process-model-with-form-and-lane/lane_workflow_2023-02-06_14 57.bpmn
Found get_current_user() in script task Activity_GetReviewers of file /Users/kevin/projects/github/status-im/process-models/misc/test/process-model-with-form-and-lane/form_and_lane.bpmn
Found get_current_user() in script task Activity_04edrsy of file /Users/kevin/projects/github/status-im/process-models/misc/test/dinithi-testing/lane-test/lane-test.bpmn
Found get_current_user() in script task Activity_GetReviewers of file /Users/kevin/projects/github/status-im/process-models/misc/qa/test-lane/test-lane.bpmn
Found get_current_user() in script task set_contact_preferences of file /Users/kevin/projects/github/status-im/process-models/misc/extensions/restricted/api-keys/show/on_form_submit.bpmn
Found get_current_user() in script task load_contact_preferences of file /Users/kevin/projects/github/status-im/process-models/misc/extensions/restricted/api-keys/show/on_load.bpmn
Found get_current_user() in script task load_contact_preferences of file /Users/kevin/projects/github/status-im/process-models/misc/extensions/restricted/api-keys/create/on_load.bpmn
Found get_current_user() in script task load_contact_preferences of file /Users/kevin/projects/github/status-im/process-models/misc/extensions/all-users/user-preferences/on-load/on_load.bpmn
Found get_current_user() in script task SR-User_Info-Set_Defaults of file /Users/kevin/projects/github/status-im/process-models/misc/user-info/user-info.bpmn
Found get_current_user() in preScript of callActivity with id Activity_1u89kok in file misc/mvp-process/cc-invoice-approval-process-v2.bpmn
calexh-sar commented 1 month ago

@madhurrya @dinithihj I updated the following processes that appear to be owned by QA, but did not test:

test - fixed but not tested Found get_current_user() in script task remove_approver of file /Users/kevin/projects/github/status-im/process-models/misc/test/spiff-demo-testing/examples/1-basic-concepts/1-6-roles/lanes_with_dict.bpmn Found get_current_user() in script task Activity_0tr6u2s of file /Users/kevin/projects/github/status-im/process-models/misc/test/spiff-demo-testing/examples/1-basic-concepts/1-6-roles/my_vacation.bpmn Found get_current_user() in script task Activity_GetReviewers of file /Users/kevin/projects/github/status-im/process-models/misc/test/process-model-with-form-and-lane/lane_workflow_2023-02-06_14 57.bpmn Found get_current_user() in script task Activity_GetReviewers of file /Users/kevin/projects/github/status-im/process-models/misc/test/process-model-with-form-and-lane/form_and_lane.bpmn Found get_current_user() in script task Activity_04edrsy of file /Users/kevin/projects/github/status-im/process-models/misc/test/dinithi-testing/lane-test/lane-test.bpmn Found get_current_user() in script task Activity_GetReviewers of file /Users/kevin/projects/github/status-im/process-models/misc/qa/test-lane/test-lane.bpmn

calexh-sar commented 1 month ago

@burnettk I updated the processes listed in the previous comment and assume they will fall off your list. The remaining processes listed below were not update because the were either no longer active to the best of my knowledge and likely should be deleted or were found in the extensions section that I don't feel I have the expertise to address:

not updaged since no longer used Found get_current_user() in script task SR-User_Info-Set_Defaults of file /Users/kevin/projects/github/status-im/process-models/misc/user-info/user-info.bpmn Found get_current_user() in preScript of callActivity with id Activity_1u89kok in file misc/mvp-process/cc-invoice-approval-process-v2.bpmn

Extensions Found get_current_user() in script task load_contact_preferences of file /Users/kevin/projects/github/status-im/process-models/misc/extensions/all-users/user-preferences/on-load/on_load.bpmn Found get_current_user() in script task set_contact_preferences of file /Users/kevin/projects/github/status-im/process-models/misc/extensions/restricted/api-keys/show/on_form_submit.bpmn Found get_current_user() in script task load_contact_preferences of file /Users/kevin/projects/github/status-im/process-models/misc/extensions/restricted/api-keys/show/on_load.bpmn Found get_current_user() in script task load_contact_preferences of file /Users/kevin/projects/github/status-im/process-models/misc/extensions/restricted/api-keys/create/on_load.bpmn

madhurrya commented 1 month ago

Thanks for updating those QA models Alex.

@burnettk @calexh-sar we might have to update the demo site also.

madhurrya commented 1 month ago

Alex, got this error when finance approving the manual upload expense process. Happens only in dev.app and it works in test.app. So should be related to this change. https://dev.app.spiff.status.im/i/5411 image

calexh-sar commented 1 month ago

@madhurrya would you please retest the expense process.

madhurrya commented 1 month ago

Noticed a similar/same error with PP2 also image

I'll check the upload expense process

madhurrya commented 1 month ago

Upload expense process error is fixed now.

calexh-sar commented 1 month ago

@madhurrya would you pls retest PP2.

madhurrya commented 1 month ago

PP2 error seems to be fixed now.

madhurrya commented 1 month ago

@calexh-sar were 'Upload expense evidence - procurement' and 'Upload expense evidence - travel' models were also updated or only the 'Upload expense evidence' process?

calexh-sar commented 1 month ago

@calexh-sar were 'Upload expense evidence - procurement' and 'Upload expense evidence - travel' models were also updated or only the 'Upload expense evidence' process?

@madhurrya specifically regarding which Status processes (and not the QA/Test processes) were updated, the budget_owner_approval and smes_approval processes and these three processes called by them: rgs_approval, trvl_approval and exp_approval.

The top level processes listed when clicking the References button for the BO and SME approval processes seem to be the same and are:

[Process_1rpfnak](https://dev.app.spiff.status.im/process-models/manage-talents:manage-compensation-benefits-administer-payroll:business-related-meetingsevents:request-travel-group-request) (manage-talents/manage-compensation-benefits-administer-payroll/business-related-meetingsevents/request-travel-group-request)
[Process_upload_expense_evidence_pur](https://dev.app.spiff.status.im/process-models/manage-finance:accounts-payable:process-expense-reports:upload-expense-evidence-procurement) (manage-finance/accounts-payable/process-expense-reports/upload-expense-evidence-procurement)
[Process_upload_expense_evidence_travel_a58ngzd](https://dev.app.spiff.status.im/process-models/manage-finance:accounts-payable:process-expense-reports:upload-expense-evidence-travel) (manage-finance/accounts-payable/process-expense-reports/upload-expense-evidence-travel)
[Request Goods or Services](https://dev.app.spiff.status.im/process-models/manage-procurement:procurement:requisition-order-management:request-goods-services) (manage-procurement/procurement/requisition-order-management/request-goods-services)
[Request Goods or Services](https://dev.app.spiff.status.im/process-models/misc:prototypes:edit-request:request-goods-or-services-edit-request) (misc/prototypes/edit-request/request-goods-or-services-edit-request)
[Request Travel](https://dev.app.spiff.status.im/process-models/manage-talents:manage-compensation-benefits-administer-payroll:business-related-meetingsevents:request-travel) (manage-talents/manage-compensation-benefits-administer-payroll/business-related-meetingsevents/request-travel)
[Request Travel (temp)](https://dev.app.spiff.status.im/process-models/manage-talents:manage-compensation-benefits-administer-payroll:business-related-meetingsevents:request-travel-with-option-for-changes-temp-model) (manage-talents/manage-compensation-benefits-administer-payroll/business-related-meetingsevents/request-travel-with-option-for-changes-temp-model)
[Request Travel (temp)](https://dev.app.spiff.status.im/process-models/manage-talents:manage-compensation-benefits-administer-payroll:business-related-meetingsevents:request-travel-with-option-for-changes-temp-model) (manage-talents/manage-compensation-benefits-administer-payroll/business-related-meetingsevents/request-travel-with-option-for-changes-temp-model)

I would assume any of these top level processes that are used on prod need to be tested. @sashayar13 would like to know if these changes are ready to push to prod. Please advise if any additional testing is needed before I create the PRs.

madhurrya commented 1 month ago

@calexh-sar Thanks for the details.

I tested these in dev.app PP1, PP2, Upload expense 3 models. And PP1/PP2 BO and SME reassignment.

I guess the Create event - delete error I mentioned on Slack is not related to this.

Please let me know when these are merged to test.app, so I can do some more testing there before pushing to Prod.

madhurrya commented 1 month ago

@burnettk @calexh-sar do you think this can affect any old instances in any way? I assume it'll not as this is just a model update.

KB, was there a code change related to this at all at any point of time? Just want to make sure we have to deploy only the models for this.

burnettk commented 1 month ago

i think old instances should continue to run using the model version they started with and so should be unaffected.

no, i don't think there is any code change required here.

madhurrya commented 1 month ago

Tested the updates in test.app - PP1, PP2, Upload expense 3 models. And PP1/PP2 BO and SME reassignment. And couple of old instances and reassignments and didn't notice any issue.

calexh-sar commented 1 month ago

@usama9500 checking to make sure that get_current_user() should only be used in the Pre-Script or Post-Script of a human task is in our documentation.

madhurrya commented 3 weeks ago

Released to Prod.