Openbravo Issue Tracking System - POS2 | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0058169 | POS2 | Core | public | 2025-03-06 15:18 | 2025-03-07 14:02 |
Reporter | shuehner | ||||
Assigned To | shuehner | ||||
Priority | normal | Severity | major | Reproducibility | have not tried |
Status | closed | Resolution | fixed | ||
Platform | OS | 5 | OS Version | ||
Product Version | |||||
Target Version | Fixed in Version | 25Q2 | |||
Merge Request Status | |||||
Review Assigned To | |||||
OBNetwork customer | |||||
Support ticket | |||||
Regression level | |||||
Regression date | |||||
Regression introduced in release | |||||
Regression introduced by commit | |||||
Triggers an Emergency Pack | No | ||||
Summary | 0058169: core2 : ModuleInfoGenerator has unstable output ordering (for lists) and is missing list values | ||||
Description | The ModuleInfoGenerator (among other things) generated a file with the required ad_reflist entries (per language) for all ‘relevant’ modules. https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.core2/-/blob/master/src/org/openbravo/core2/build/ModuleInfoGenerator.java?ref_type=heads#L278 [^] To do that above functions merges the output of 3 calls to trlElementGenerator.apply. If that input is coming from LabelsComponent.getLists then its structure is { “ad_reference_id” : [ {“id”: “ad_ref_list.value”, “name”: as_ref_list.name”}, { nextEntry } ] The current code has 2 problems a.) The ordering of ad_ref_list entries is undefined/random in practice As the code https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.mobile.core/-/blob/master/src/org/openbravo/mobile/core/login/LabelsComponent.java?ref_type=heads#L109 [^] is ordering by ad_ref_list.ad_reference_id, ad_ref_list.seqno However the seqno field is not mandatory and sometimes null => That leads to ordering being undefined The order should be stable to avoid any confusion (for user, debugging, reproducible builds) b.) Some ad_ref_list values get lost and are missing in the generated output The mergeJsons function here https://gitlab.com/orisha-group/bu-commerce/openbravo/product/pmods/org.openbravo.core2/-/blob/master/src/org/openbravo/core2/build/ModuleInfoGenerator.java?ref_type=heads#L298 [^] Just overwrites previous entries from its o1 input with values from o2 input. In case those are JSONArray’s that means that entries come from different calls here that the final entries are not the ‘merged’ entries of both arrays but only then ones from the ‘last’ merge. Depending on ordering of list values appearing in the 3 calls to getTrlElements that least to ‘lost’ ad_ref_list entries in the output. | ||||
Steps To Reproduce | That effect can be seen when comparing generated POS2-lists files for unmodified pos2-modules.json and output after the fix from this bug report. comparing generated POS2-lists output pre- and post-merge of https://openbravo.atlassian.net/browse/RM-18205 [^] That 18205 merged org.openbravo.retail.config into core (intending to not change content + behavior) However regression testing of generated POS2-lists file showed that several ad_ref_list entries for unrelated org.openbravo.retail.posterminal get lost (indirectly caused by different processing order of modules). | ||||
Proposed Solution | a.) add another orderBy field in LabelsComponent.getLists to ensure stable ordering b.) fix code in mergeJsons to properly merge the JSONArray values instead of overwriting the whole array. Note that fix for b.) should ensure to keep the array sorted to not 'undo' the improvement from a.) | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2025-03-06 15:18 | shuehner | New Issue | |||
2025-03-06 15:18 | shuehner | Assigned To | => shuehner | ||
2025-03-06 15:18 | shuehner | Triggers an Emergency Pack | => No | ||
2025-03-06 15:24 | hgbot | Note Added: 0176531 | |||
2025-03-06 15:39 | hgbot | Note Added: 0176532 | |||
2025-03-07 14:02 | hgbot | Note Added: 0176555 | |||
2025-03-07 14:02 | hgbot | Note Added: 0176556 | |||
2025-03-07 14:02 | hgbot | Note Added: 0176557 | |||
2025-03-07 14:02 | hgbot | Resolution | open => fixed | ||
2025-03-07 14:02 | hgbot | Status | new => closed | ||
2025-03-07 14:02 | hgbot | Fixed in Version | => 25Q2 | ||
2025-03-07 14:02 | hgbot | Note Added: 0176558 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|