Openbravo Issue Tracking System - POS2
View Issue Details
0057963POS2Corepublic2024-09-05 11:562025-02-23 18:44
AugustoMauch 
AugustoMauch 
normalcriticalhave not tried
closedfixed 
5
 
25Q125Q1 
approved
No
No
0057963: Management of inconsistent application state should be properly addressed in core2 applications
From time to time, the application state gets inconsistent, apparently not reflecting the current state of the application but a previous one.

We looking for those inconsistencies on a case-to-case basis, and introducing mitigation measures on a case-to-case basis as well.

This mechanism should be improved, so that if any inconsistency is found, all the application state modules should be re-initialized properly.
-
No tags attached.
has duplicate backport 005800525Q1 closed cberner Login blocked because of an error related to an inconsistent state 
blocks feature request 0056377 closed AugustoMauch Management of inconsistent application state should be properly addressed in core2 applications 
Issue History
2025-02-12 23:25AugustoMauchTypefeature request => backport
2025-02-12 23:25AugustoMauchTarget Version => 25Q1
2025-02-23 17:56hgbotNote Added: 0176032
2025-02-23 17:58hgbotNote Added: 0176033
2025-02-23 18:00hgbotNote Added: 0176034
2025-02-23 18:02hgbotNote Added: 0176035
2025-02-23 18:20AugustoMauchRelationship addedhas duplicate 0058005
2025-02-23 18:44hgbotResolutionopen => fixed
2025-02-23 18:44hgbotStatusscheduled => closed
2025-02-23 18:44hgbotFixed in Version => 25Q1
2025-02-23 18:44hgbotNote Added: 0176038
2025-02-23 18:44hgbotNote Added: 0176039
2025-02-23 18:44hgbotNote Added: 0176041
2025-02-23 18:44hgbotNote Added: 0176042
2025-02-23 18:44hgbotNote Added: 0176043
2025-02-23 18:44hgbotNote Added: 0176044
2025-02-23 18:44hgbotNote Added: 0176045
2025-02-23 18:44hgbotNote Added: 0176046

Notes
(0176032)
hgbot   
2025-02-23 17:56   
Merge Request created: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/1788 [^]
(0176033)
hgbot   
2025-02-23 17:58   
Merge Request created: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/835 [^]
(0176034)
hgbot   
2025-02-23 18:00   
Merge Request created: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/1932 [^]
(0176035)
hgbot   
2025-02-23 18:02   
Merge Request created: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/3544 [^]
(0176038)
hgbot   
2025-02-23 18:44   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.core2 [^]
Changeset: 92e0ba54f465b627a1acb80b211bbdb682be2bec
Author: Augusto Mauch <a.mauch@orisha.com>
Date: 23-02-2025 18:18:56
URL: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.core2/-/commit/92e0ba54f465b627a1acb80b211bbdb682be2bec [^]

Fixes ISSUE-57963: Global mitigation of state related problems

On each login, the local state is checked, and if it is determined that the state is not valid, it will
be reset.

This code references non-core2 concepts (Ticket, Cashup). It was done intentionally, this code should be
temporary and be removed once we find out the root cause of the back-to-the-past state problems. Instead
of implementing some infra to be able to add the relevant portion of the state to the request payload, it
is hardcoded for now

[stateMitigation] Adds missing adminMode when checking the state validity

[stateMitigation] Properly fail when in offline mode the stateValidity request

[stateMitigation] Use OB.App.reload api instead of manual location reload

Related to ISSUE-56377: Fixes test

Fixes ISSUE-58004: Login blocked because of an error related to an inconsistent state

The checkStateValidity function was not taking into account empty ticket
object or a missing cashup id.

---
M src-db/database/sourcedata/AD_MESSAGE.xml
M web-jspack/org.openbravo.core2/src/authentication/loginInitActions.js
---
(0176039)
hgbot   
2025-02-23 18:44   
Merge request merged: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.core2/-/merge_requests/1788 [^]
(0176041)
hgbot   
2025-02-23 18:44   
Repository: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.mobile.core [^]
Changeset: 6e14cb2298058044695baeaf551c44846c2481cb
Author: Augusto Mauch <a.mauch@orisha.com>
Date: 23-02-2025 17:57:47
URL: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.mobile.core/-/commit/6e14cb2298058044695baeaf551c44846c2481cb [^]

Related to ISSUE-57963: Applies global mitigation to state problems

The specific instances of ApplicationStateCheck will be provided in the functional modules (i.e. org.openbravo.retail.posterminal).
The ApplicationStateChecker endpoint will be invoked from mobile.core and core2 applications, to check if the current state is not,
with the purpose of resetting the state in case it is not valid

[stateMitigation] Adds missing javadoc

[stateMitigation] Adds missing adminMode when checking the state validity

[stateMitigation] Extend reload API function to allow skipping state flushing

[stateMitigation] Updates copyright year

---
A src/org/openbravo/mobile/core/process/ApplicationStateCheck.java
A src/org/openbravo/mobile/core/process/ApplicationStateChecker.java
M src-db/database/sourcedata/OBMOBC_SERVICES.xml
M web/org.openbravo.mobile.core/app/model/application-state/StatePersistence.js
---
(0176042)
hgbot   
2025-02-23 18:44   
Merge request merged: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.mobile.core/-/merge_requests/835 [^]
(0176043)
hgbot   
2025-02-23 18:44   
Repository: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.retail.posterminal [^]
Changeset: fa713f84bf159f54e6030aeebe347c037a7badef
Author: Augusto Mauch <a.mauch@orisha.com>
Date: 23-02-2025 17:59:53
URL: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/fa713f84bf159f54e6030aeebe347c037a7badef [^]

Related to ISSUE-57963: Applies global mitigation to state problems

An application state will be determined as invalid if:
- The Ticket it references is already processed in the backend
- The Cashup it references is already processed in the backend, or it is not processed but
one in the application is outdated (grossSales and grossReturns are checked to determine
if the cashup is outdated

[stateMitigation] Simplifies cashup check by using the totalCompleteTickets column instead of the sold/returned amounts

[stateMitigation] Adds log for state checkers

[stateMitigation] Updates copyright year

---
A src/org/openbravo/retail/posterminal/statechecker/CashupStateChecker.java
A src/org/openbravo/retail/posterminal/statechecker/TicketStateChecker.java
---
(0176044)
hgbot   
2025-02-23 18:44   
Merge request merged: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/1932 [^]
(0176045)
hgbot   
2025-02-23 18:44   
Repository: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.pos2 [^]
Changeset: 0bfaea4dc6fab137f0b809091005c2711f3d2144
Author: André Montenegro <a.montenegro@orisha.com>
Date: 23-02-2025 18:01:37
URL: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.pos2/-/commit/0bfaea4dc6fab137f0b809091005c2711f3d2144 [^]

Related to ISSUE-57963: created intercept in logInProcess to avoid backOffice checks for ticket and cashup ID

The state persistence check cannot be done when running CI, because in the cypress tests there is a
mechanism that reuses previous states in order to skip having to login very often

---
M web-jspack/org.openbravo.pos2/src-test/cypress/support/logIn.js
---
(0176046)
hgbot   
2025-02-23 18:44   
Merge request merged: https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/3544 [^]