portfolio icon indicating copy to clipboard operation
portfolio copied to clipboard

Pick File Format Dialog Omits XML with "id" attribute

Open flywire opened this issue 10 months ago • 2 comments

Describe the bug Pick file format dialog omits XML with "id" attribute.

To Reproduce:

  1. File, New, File
  2. Currency - AUD, Next
  3. Securities Account: Broker, Reference Account: Bank, Add, Finish
  4. File, Quit, Do you want to save the changes? Yes,

Note: Pick file format dialog omits XML with "id" attribute.

Expected behavior Should use File, Save as process.

Portfolio Performance Version: 0.74.0 (January 2025) Platform: win32, x86_64 Java: 21.0.5+11-LTS, Azul Systems, Inc.

flywire avatar Jan 26 '25 23:01 flywire

Hi! Flywire, I really appreciate your detailed and important bug report. The missing 'id' attribute in the save dialog is a significant issue since it affects the consistency of our data model and the integrity of files over time.

We believe this problem stems from a difference in serialization logic that occurs specifically when using the 'new file + quit/save prompt' flow, which skips the thorough inclusion of attributes that the standard 'Save As' process typically covers.

To tackle this, we need to streamline our file serialization logic, making sure that all essential attributes, like 'id', are consistently saved across all methods. This will involve taking a closer look at the XML marshalling and unmarshalling processes.

On the preventative side, we plan to set up targeted regression tests that will cover the creation of new files, the initial save, and the subsequent quit/save scenarios. This will help us avoid similar issues in the future and strengthen our data resilience.

sumansuhag avatar Jun 06 '25 15:06 sumansuhag

While reviewing the model please consider store PP's data structures in a database, to eventually switch PP's storage to [optionally] use a database directly. GnuCash for example, has a preference to store the data as a sql database. When the app opens the file it converts the file to xml format and saves it back to the format set in the preferences. This gives seamless sql read data access.

flywire avatar Jun 06 '25 23:06 flywire