Task 2.2: Implement "Safe Update" Logic
Goal: Implement the first, automated part of the 3-Way Merge to protect user-cleaned data.
Prompt for AI Coding Agent:
Context:
Based on section 4.3 of the Project Constitution, you are to implement the "Safe Update" portion of the 3-Way Merge strategy. This is a critical step to prevent odoo-data-flow from destructively overwriting manually cleaned data.
Use the j-base branch
Requirements:
- Snapshotting:
- Modify the odoo-data-flow import logic. When it imports or updates a record in the destination database, it must also write a JSON representation of the imported data into a new field on that record.
- This field must be named x_odf_original_snapshot and should be of type JSONB if the database supports it.
- Merge Logic:
- Before performing an update on an existing record, the tool must now perform a comparison.
- It must fetch three versions of the data:
- The new Transformed Source data it is about to import.
- The Current Destination data from the target Odoo instance.
- The Original Snapshot data from the x_odf_original_snapshot field.
- For each field, if Current Destination's value is the same as Original Snapshot's value, the update is considered safe. The new value from Transformed Source can be written.
- If Current Destination's value is different from Original Snapshot's value, a human has changed it. This is a conflict. For this task, simply log the conflict and skip updating that specific field.
Deliverable:
Provide the modified Python code for the odoo-data-flow import/update function that implements this snapshotting and safe update logic.
Task 2.2: Implement "Safe Update" Logic
Goal: Implement the first, automated part of the 3-Way Merge to protect user-cleaned data.
Prompt for AI Coding Agent:
Context:
Based on section 4.3 of the Project Constitution, you are to implement the "Safe Update" portion of the 3-Way Merge strategy. This is a critical step to prevent odoo-data-flow from destructively overwriting manually cleaned data.
Use the
j-basebranchRequirements:
Deliverable:
Provide the modified Python code for the odoo-data-flow import/update function that implements this snapshotting and safe update logic.